【发布时间】:2014-03-12 18:48:45
【问题描述】:
我有这样的事情:
Mapper.CreateMap<UserProfile, UserDTO>()
.ForMember(t => t.UserImage, s => s.MapFrom(x => x.Picture(32)))
.ForMember(t => t.Permalink, s => s.MapFrom(x => x.Permalink()));
我尝试这样的事情:
unit.UserProfiles.GetAll().Project().To<UserDTO>().First();
我得到类似的东西:
LINQ to Entities does not recognize the method 'System.String Picture(xx.xxx.UserProfile, Int32)' method, and this method cannot be translated into a store expression.
我想告诉 automapper 映射除这两个之外的所有属性,并且在查询完成后以正常方式映射这两个,是否可行?
【问题讨论】:
标签: c# entity-framework orm automapper projection