Class ContentTypeQueryParameters
- Namespace
- CMS.ContentEngine
- Assembly
- CMS.ContentEngine.dll
Provides parameterization options for content item queries.
public sealed class ContentTypeQueryParameters : ContentQueryParametersBase<ContentTypeQueryParameters>
- Inheritance
-
objectContentTypeQueryParameters
- Inherited Members
- Extension Methods
Methods
LinkedFrom(string, string, IEnumerable<IContentItemIdentifier>)
Retrieves content items of the specified contentType
linked from referenceFieldName
.
public ContentTypeQueryParameters LinkedFrom(string contentType, string referenceFieldName, IEnumerable<IContentItemIdentifier> items)
Parameters
contentType
stringContent type name referencing content items to be retrieved.
referenceFieldName
stringName of the field within
contentType
referencing content items to be retrieved.items
IEnumerable<IContentItemIdentifier>Collection of IContentItemIdentifier of items for which to retrieve the linked items.
Returns
Remarks
Can be used together with WithLinkedItems(int) to retrieve further links. Simultaneous call with Linking(string, IEnumerable<int>) is not supported.
Exceptions
- ArgumentException
Thrown when
contentType
orreferenceFieldName
is null or empty.- ArgumentException
Thrown when
contentType
does not exist.- ArgumentNullException
Thrown when
items
is null.- InvalidOperationException
Thrown when field does not exist or it's datatype is not ContentItemReference.
LinkedFromSchemaField(string, IEnumerable<IContentItemIdentifier>)
Retrieves content items linked from referenceSchemaFieldName
.
public ContentTypeQueryParameters LinkedFromSchemaField(string referenceSchemaFieldName, IEnumerable<IContentItemIdentifier> items)
Parameters
referenceSchemaFieldName
stringName of the schema field referencing content items to be retrieved.
items
IEnumerable<IContentItemIdentifier>Collection of IContentItemIdentifier of items for which to retrieve the linked items.
Returns
Remarks
Can be used together with WithLinkedItems(int) to retrieve further links. Simultaneous call with Linking(string, IEnumerable<int>) is not supported.
Exceptions
- ArgumentException
Thrown when or
referenceSchemaFieldName
is null or empty.- ArgumentNullException
Thrown when
items
is null.- InvalidOperationException
Thrown when schema field does not exist or it is not a reusable schema field or it's datatype is not ContentItemReference.
- See Also
Linking(string, IEnumerable<int>)
Configure query to retrieve linked items which reference any of items
in the referenceFieldName
.
public ContentTypeQueryParameters Linking(string referenceFieldName, IEnumerable<int> items)
Parameters
referenceFieldName
stringField name of the retrieved content item which includes the
items
.items
IEnumerable<int>Identifiers of items which are linked from the retrieved items.
Returns
- ContentTypeQueryParameters
Returns this ContentTypeQueryParameters instance to chain further configuration.
Remarks
Can be used together with WithLinkedItems(int) to retrieve further links. Simultaneous call with LinkedFrom(string, string, IEnumerable<IContentItemIdentifier>) is not supported.
Exceptions
- ArgumentException
Thrown when
referenceFieldName
is null or empty.- ArgumentNullException
Thrown when
items
is null.
WithLinkedItems(int)
Configures query to include linked content items recursively up to the specified maxLevel
.
public ContentTypeQueryParameters WithLinkedItems(int maxLevel)
Parameters
maxLevel
intMaximal level of the linked items to include.
Returns
Remarks
Use the GetLinkedItems(string) method during result mapping (GetResult<TModel>(ContentItemQueryBuilder, Func<IContentQueryDataContainer, TModel>, ContentQueryExecutionOptions, CancellationToken) to access the linked content items of an item.
Depending on the content model structure, including items to great depth can negatively affect querying performance.
WithLinkedItems(int, Action<LinkedItemsOptions>)
Configures query to include linked content items recursively up to the specified maxLevel
.
public ContentTypeQueryParameters WithLinkedItems(int maxLevel, Action<LinkedItemsOptions> configureOptionsAction)
Parameters
maxLevel
intMaximal level of the linked items to include.
configureOptionsAction
Action<LinkedItemsOptions>Action to configure specific options for linked items. See LinkedItemsOptions for possible options.
Returns
Remarks
Use the GetLinkedItems(string) method during result mapping (GetResult<TModel>(ContentItemQueryBuilder, Func<IContentQueryDataContainer, TModel>, ContentQueryExecutionOptions, CancellationToken) to access the linked content items of an item.
Depending on the content model structure, including items to great depth can negatively affect querying performance.