-
Notifications
You must be signed in to change notification settings - Fork 122
SitecoreQueryAttribute
Mike Edwards edited this page Jan 24, 2019
·
1 revision
Allows the results of Sitecore queries to be mapped to a property. Sitecore query supports both single and multiple item return types.
The property must be one of the following return types:
- IEnumerable<> where the generic argument is the type of model to return.
- The type of the model to map the item to.
public class MyModel{
[SitecoreQuery("/*[@name='test']")]
public virtual MyOtherModel SingleQuery { get; set; }
[SitecoreQuery("/*[@name='test']")]
public virtual IEnumerable<MyOtherModel> MultiQuery { get; set; }
}
Name | Type | Description |
---|---|---|
EnforceTemplate | SitecoreEnforceTemplate | Used to enforce template checks when mapping Sitecore items. The template ID is either determined by the template ID defined on the attribute or the template ID of the target model type. |
TemplateId | string | The ID of the template to use for Template enforcement. |
Do you love Glass.Mapper.Sc and want to help make it the best Sitecore ORM?
Then head over to our Patreon page today and signup to support the project.
Your help will to support the continued development of the project.
We also provide Training Courses to get you up to speed quickly with the Glass.Mapper.Sc framework. The course will teach you everything you need to know to get started.