sitecore Glass Mapper The easiest way to map Sitecore data to code.


Example

Glass.Mapper.Sc allows you to move your data from Sitecore and into your code seamlessly using strongly typed objects.

The framework allows you to map data on to c# classes and interfaces without any additional mark-up. As the data is mapped to your target objects it is converted to the target type. Take a look at this simple example:

public class Demo
    {
        public virtual Guid Id { get; set; }

        public virtual string Title { get; set; }

        public virtual DateTime Date { get; set; }

        public virtual string Url { get; set; }
    }


    public void DoWork(
            ISitecoreContext sitecoreContext)
    {
        var model = 
            sitecoreContext.GetCurrentItem<Demo>();

        var url = model.Url;
    }