Skip to content

SitecoreLinkedAttribute

Mike Edwards edited this page Jan 24, 2019 · 2 revisions

Controls how Sitecore Linked items are mapped to a property on a model.

Linked items are items that have a connection to another item via the Links table.

The proeprty return type must be of type IEnumerable<>. The generic argument specifies the return type Sitecore items will be mapped to.

public class MyModel{

    [SitecoreLinked(Option = SitecoreLinkedOptions.All)]
    public virtual IEnumerable<MyOtherModel> Items { get; set; }

}

Properties

Name Type Description
Option SitecoreLinkedOptions The type of linked item to return. Required
EnforceTemplate SitecoreEnforceTemplate Used to enforce template checks when mapping linked 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