コード例 #1
0
ファイル: Mappings.cs プロジェクト: vandsh/disconnected
 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)));
 }