Skip to content

SitecoreSelfAttribute

Mike Edwards edited this page Jan 24, 2019 · 1 revision

Maps the current item being mapped to a property on the model.

The return type for the property must be another Glass model or a Sitecore item.

public class MyModel{

    [SitecoreSelf]
    public virtual MyOtherModel Self { get; set; }

}

Properties

Name Type Description
EnforceTemplate SitecoreEnforceTemplate Used to enforce template checks when mapping the parent 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.

Clone this wiki locally