Clones or creates documents from several types of values.
- Namespace
- Statiq
.Common - Containing Type
- I
Execution Context Clone Or Create Documents Extensions
Syntax
public static Task<IEnumerable<IDocument>> CloneOrCreateDocumentsAsync(this IExecutionContext executionContext, IDocument document, IEnumerable<IDocument> moduleInputs, object value)
Remarks
If the value is
null the provided document will be returned.
If the value is a IDocument, IEnumerable<T>, or
IAsyncEnumerable<T>, the document(s) will be returned.
If the value is IEnumerable<KeyValuePair<string, object>>,
the document will be cloned with the resulting metadata.
If the value is a IEnumerable<T> or IModule,
the module(s) will be executed with the input document(s) as their input
and the results will be returned.
If the value is an IContentProvider,
IContentProviderFactory, or Stream it will be used to get new content for the
provided document (or create a new document if the provided document is null).
If config value is anything else, the content of the input document will be
changed to (or a new document created with) the string value.
Parameters
| Name | Type | Description |
|---|---|---|
| executionContext | IExecutionContext | The execution context. |
| document | IDocument | The document to clone (if appropriate). |
| moduleInputs | IEnumerable |
The inputs to use when executing if value contains modules. |
| value | object | The value to clone or create documents from. |
Return Value
| Type | Description |
|---|---|
| Task |
The result documents. |