Class ContentTypesQueryParameters
- Namespace
- CMS.ContentEngine
- Assembly
- CMS.ContentEngine.dll
Provides parameterization options for content item queries operating over multiple content types.
public sealed class ContentTypesQueryParameters
- Inheritance
-
objectContentTypesQueryParameters
- Extension Methods
Methods
LinkedFrom(string, string, IEnumerable<IContentItemIdentifier>)
Retrieves content items of the specified contentTypeName
linked from referenceFieldName
.
public ContentTypesQueryParameters LinkedFrom(string contentTypeName, string referenceFieldName, IEnumerable<IContentItemIdentifier> items)
Parameters
contentTypeName
stringContent type name referencing content items to be retrieved.
referenceFieldName
stringName of the field within
contentTypeName
referencing content items to be retrieved.items
IEnumerable<IContentItemIdentifier>Collection of IContentItemIdentifier of items for which to retrieve the linked items.
Returns
- ContentTypesQueryParameters
Returns this ContentTypesQueryParameters instance to chain further configuration.
Remarks
Can be used together with WithLinkedItems(int) to retrieve further links. Simultaneous call with Linking(string, string, IEnumerable<int>) or LinkingSchemaField(string, IEnumerable<int>) is not supported. Multiple calls of this method are not supported.
Exceptions
- ArgumentException
Thrown when
contentTypeName
orreferenceFieldName
is null or empty.- ArgumentException
Thrown when
contentTypeName
does not exist.- ArgumentNullException
Thrown when
items
is null.- InvalidOperationException
Thrown when field does not exist or it's datatype is not ContentItemReference.
- InvalidOperationException
Thrown when the LinkedFrom(string, string, IEnumerable<IContentItemIdentifier>) method has been called previously.
LinkedFromSchemaField(string, IEnumerable<IContentItemIdentifier>)
Retrieves content items linked from referenceSchemaFieldName
.
public ContentTypesQueryParameters 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
- ContentTypesQueryParameters
Returns this ContentTypesQueryParameters instance to chain further configuration.
Remarks
Can be used together with WithLinkedItems(int) to retrieve further links. Simultaneous call with Linking(string, string, IEnumerable<int>) or LinkingSchemaField(string, IEnumerable<int>) is not supported. Multiple calls of this method are 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, string, IEnumerable<int>)
Configure query to retrieve linked items which reference any of items
in the referenceFieldName
.
public ContentTypesQueryParameters Linking(string contentTypeName, string referenceFieldName, IEnumerable<int> items)
Parameters
contentTypeName
stringThe name of the content type in which to search for the linking references via
referenceFieldName
.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
- ContentTypesQueryParameters
Returns this ContentTypesQueryParameters 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>) or LinkedFromSchemaField(string, IEnumerable<IContentItemIdentifier>) is not supported. Multiple calls of this method are not supported.
Exceptions
- ArgumentException
Thrown when
referenceFieldName
is null or empty.- ArgumentException
Thrown when
contentTypeName
does not exist.- ArgumentNullException
Thrown when
items
is null.- InvalidOperationException
Thrown when field does not exist or it's datatype is not ContentItemReference.
- InvalidOperationException
Thrown when the Linking(string, string, IEnumerable<int>) method has been called previously.
LinkingSchemaField(string, IEnumerable<int>)
Configure query to retrieve linked items which reference in the referenceSchemaFieldName
.
public ContentTypesQueryParameters LinkingSchemaField(string referenceSchemaFieldName, IEnumerable<int> items)
Parameters
referenceSchemaFieldName
stringName of the schema field referencing content items to be retrieved.
items
IEnumerable<int>Identifiers of items which are linked from the retrieved items.
Returns
- ContentTypesQueryParameters
Returns this ContentTypesQueryParameters 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>) or LinkedFromSchemaField(string, IEnumerable<IContentItemIdentifier>) is not supported. Multiple calls of this method are not supported.
Exceptions
- ArgumentException
Thrown when
referenceSchemaFieldName
is null or empty.- ArgumentNullException
Thrown when
items
is null.- InvalidOperationException
Thrown when field does not exist or it is not a reusable schema field or it's datatype is not ContentItemReference.
- InvalidOperationException
Thrown when the Linking(string, string, IEnumerable<int>) method has been called previously.
OfContentType(params string[])
Limits the collection of retrieved items to the specified content types.
public ContentTypesQueryParameters OfContentType(params string[] contentTypeNames)
Parameters
contentTypeNames
string[]Names of the content types to retrieve.
Returns
Exceptions
- ArgumentException
Thrown when
contentTypeNames
is null, empty or collection of nulls.- InvalidOperationException
When the OfReusableSchema(params string[]) method has been called previously.
OfReusableSchema(params string[])
Limits the collection of retrieved items to the content types that have assigned any schema defined by reusableSchemaNames
.
public ContentTypesQueryParameters OfReusableSchema(params string[] reusableSchemaNames)
Parameters
reusableSchemaNames
string[]Names of the reusable field schemas.
Returns
Remarks
Multiple calls of this method are not supported.
Exceptions
- ArgumentException
Thrown when
reusableSchemaNames
is null, empty or collection of nulls.- InvalidOperationException
When the OfContentType(params string[]) or OfReusableSchema(params string[]) method has been called previously.
WithContentTypeFields()
Configures query to include content type fields.
public ContentTypesQueryParameters WithContentTypeFields()
Returns
WithLinkedItems(int)
Configures query to include linked content items recursively up to the specified maxLevel
.
public ContentTypesQueryParameters 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 ContentTypesQueryParameters 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.