Field Mapping

Controls how Sitecore field are mapped to a property.

Attribute

public class MyModel
{

    [SitecoreField]
    public virtual string MyField { get; set; }

}

Fluent


var sitecoreType = new SitecoreType<MyModel>();
sitecoreType.Field(x => x.MyField);


Properties

Name Type Description
FieldName string The name of the Sitecore field to import.
FieldId string The ID of the filed to import.If the field ID and name are specified then the field ID is used.
Setting SitecoreFieldSettings Used to control how field data is mapped.
MediaUrlOptions SitecoreMediaUrlOptions Controls how media URLs are generated when mapping Glass.Mapper.Sc.Fields.Image properties.
UrlOptions SitecoreUrlOptions ontrols how URLs are generated when mapping Glass.Mapper.Sc.Fields.Link properties.

Support .NET Types

The following types are support when mapping Sitecore fields:

  • Bool
  • DateTime
  • Decimal
  • Dictionary
  • Double
  • Enums
  • File
  • Float
  • Guid
  • Sitecore.Data.ID
  • Glass.Mapper.Sc.Fields.Image
  • Glass.Mapper.Sc.Fields.Link
  • Integer
  • Sitecore.Data.Items.Item
  • Long
  • NameValueCollection
  • Nullable Enums
  • Nullables
  • Sitecore.Rules.RulesList
  • System.Io.Stream (blobs)
  • String
  • Other Glass models.

Become a Glass Mapper Expert

The easiest way to become a Glass.Mapper.Sc EXPERT is by taking the V5 Training course!

The training course contains 64+ lectures which take you from the basics of Glass.Mapper.Sc to advanced features like template enforcement, type inferring and more.

Signup Up Today!