Ejemplo n.º 1
0
 public void CreateMappings()
 {
     Mapper.CreateMap <Item, ArticleDto>()
     .ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.DisplayName))
     .ForMember(dest => dest.Text, opt => opt.MapFrom(src => src.Fields["Text"].ToString()))
     .ForMember(dest => dest.Type, opt => opt.MapFrom(src => RestUtil.GetComponentCodeName(src)))
     .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.ID.ToGuid()))
     .ForMember(dest => dest.Summary, opt => opt.MapFrom(src => "Summary - " + src.DisplayName))
     .ForMember(dest => dest.Author, opt => opt.MapFrom(src => src.Fields["Author"].ToString()))
     .ForMember(dest => dest.Tags, opt => opt.UseValue(new List <string>()))
     .ForMember(dest => dest.Icon, opt => opt.MapFrom(src => RestUtil.ResolveSitecoreIcon(src.Template.Icon)));
 }