我对AutoMapper有点新,我试图映射一个属性,其中来自ef db context的值。
我将如何做到这一点?
CreateMap<User, UserDto>()
.ForMember(dest => dest.Username, opt => opt.MapFrom(src => src.Username))
.ForMember(dest => dest.NetworkId, opt => opt.MapFrom(src => src.NetworkId))
.ForMember(dest => dest.Network, /*NEED TO TAKE NetworkId and PERFORM A lookup in DbContext AND SET Network property*/);