我正在try 设置AutoMapper,将实体转换为DTO.我知道我应该使用Mapper.CreateMap<Entity, DTO>()
之后的.ForMember()
来设置自定义映射,但这似乎不是一个可用的方法.
编辑以澄清: 我不是在寻找我已经读过的文档的链接,也不是基本语法的解释.我使用的语法正确,如答案和文档中所述,例如:
Mapper.CreateMap<EFAddress, Address>()
.ForMember(dest => dest.Code, opt => opt.MapFrom(src => src.Name));
If I have an invalid type name within CreateMap<> I can see "ForMember" as a valid method, mousing over shows the method signature as I would normally expect. But as soon as I give it two valid types, ForMember says it cannot resolve the symbol, as if the method is not available.
我没有遇到的泛型类是否有某种约束?
谢谢