I am looking to map a entity named PortalUser to another entity named UserFacade, both of them have same fields except one because name of the field is different in both classes.
After a bit of googling I found out a way of mapping fields with different name to each other as stated here How to specify mapping rule when names of properties differ
The solution is to use ForMember function and explicitly define which field to map like stated in answer of question above.
My problem is that ForMember isn't working to way it is explained in almost every answer at stackoverflow
AutoMapper.Mapper.CreateMap(user.GetType(), typeof(UserFacade))
.ForMember(dest => dest.PortalRole, opt => opt.MapFrom(src => src.Role);
var userFacade = AutoMapper.Mapper.Map<UserFacade>(user);
The 2nd line at ForMember says that cannot convert lambda to string type. The ForMember function is used the same way in almost every answer at stackoverflow, but it doesn't seem to work here, kindly help.