Class ContentQueryExecutorExtensions
- Namespace
- CMS.ContentEngine
- Assembly
- CMS.ContentEngine.dll
Extension methods for the IContentQueryExecutor.
public static class ContentQueryExecutorExtensions
- Inheritance
-
objectContentQueryExecutorExtensions
Methods
GetMappedResult<TModel>(IContentQueryExecutor, ContentItemQueryBuilder, ContentQueryExecutionOptions, Func<IContentQueryDataContainer, TModel, Task<TModel>>, CancellationToken)
Executes the content items query, maps the content query result
to content type model registered via RegisterContentTypeMappingAttribute
and casts it to TModel.
public static Task<IEnumerable<TModel>> GetMappedResult<TModel>(this IContentQueryExecutor executor, ContentItemQueryBuilder builder, ContentQueryExecutionOptions options, Func<IContentQueryDataContainer, TModel, Task<TModel>> configureModel, CancellationToken cancellationToken = default)
Parameters
executorIContentQueryExecutorbuilderContentItemQueryBuilderThe content item queries builder.
optionsContentQueryExecutionOptionsOptions object for configuration of query execution.
configureModelFunc<IContentQueryDataContainer, TModel, Task<TModel>>Asynchronous function providing additional configuration for the resulting
TModelinstance based on content query data container.cancellationTokenCancellationTokenThe cancellation instruction.
Returns
- Task<IEnumerable<TModel>>
Type Parameters
TModelType of the selected result.
Remarks
The content type model is created based on the registered model Type for the result content type.
Exceptions
- ArgumentNullException
Thrown when
builderis null.- ArgumentException
Thrown when no model was registered for result content type via RegisterContentTypeMappingAttribute.
- InvalidOperationException
Thrown when the data cannot be bound to the model e.g., the types of the properties doesn't match the registered model type, the registered model type does not have parameterless constructor or when more types are registered to one content type name.
- See Also
GetMappedResult<TModel>(IContentQueryExecutor, ContentItemQueryBuilder, ContentQueryExecutionOptions, Func<IContentQueryDataContainer, TModel, TModel>, CancellationToken)
Executes the content items query, maps the content query result
to content type model registered via RegisterContentTypeMappingAttribute
and casts it to TModel.
public static Task<IEnumerable<TModel>> GetMappedResult<TModel>(this IContentQueryExecutor executor, ContentItemQueryBuilder builder, ContentQueryExecutionOptions options, Func<IContentQueryDataContainer, TModel, TModel> configureModel, CancellationToken cancellationToken = default)
Parameters
executorIContentQueryExecutorbuilderContentItemQueryBuilderThe content item queries builder.
optionsContentQueryExecutionOptionsOptions object for configuration of query execution.
configureModelFunc<IContentQueryDataContainer, TModel, TModel>Function providing additional configuration for the resulting
TModelinstance based on content query data container.cancellationTokenCancellationTokenThe cancellation instruction.
Returns
- Task<IEnumerable<TModel>>
Type Parameters
TModelType of the selected result.
Remarks
The content type model is created based on the registered model Type for the result content type.
Exceptions
- ArgumentNullException
Thrown when
builderis null.- ArgumentException
Thrown when no model was registered for result content type via RegisterContentTypeMappingAttribute.
- InvalidOperationException
Thrown when the data cannot be bound to the model e.g., the types of the properties doesn't match the registered model type, the registered model type does not have parameterless constructor or when more types are registered to one content type name.
- See Also
GetMappedResult<TModel>(IContentQueryExecutor, ContentItemQueryBuilder, ContentQueryExecutionOptions, CancellationToken)
Executes the content items query, maps the content query result
to content type model registered via RegisterContentTypeMappingAttribute
and casts it to TModel.
public static Task<IEnumerable<TModel>> GetMappedResult<TModel>(this IContentQueryExecutor executor, ContentItemQueryBuilder builder, ContentQueryExecutionOptions options = null, CancellationToken cancellationToken = default)
Parameters
executorIContentQueryExecutorbuilderContentItemQueryBuilderThe content item queries builder.
optionsContentQueryExecutionOptionsOptions object for configuration of query execution.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
- Task<IEnumerable<TModel>>
Type Parameters
TModelType of the selected result.
Remarks
The content type model is created based on the registered model Type for the result content type.
Exceptions
- ArgumentNullException
Thrown when
builderis null.- ArgumentException
Thrown when no model was registered for result content type via RegisterContentTypeMappingAttribute.
- InvalidOperationException
Thrown when the data cannot be bound to the model e.g., the types of the properties doesn't match the registered model type, the registered model type does not have parameterless constructor or when more types are registered to one content type name.
- See Also