我有一个类,我需要t映射到多个类,例如.
这是我从(查看模型)映射的源:
public class UserBM { public int UserId { get; set; } public string Address { get; set; } public string Address2 { get; set; } public string Address3 { get; set; } public string State { get; set; } public int CountryId { get; set; } public string Country { get; set; } }
这是目的地类是(域模型):
public abstract class User { public int UserId { get; set; } public virtual Location Location { get; set; } public virtual int? LocationId { get; set; } } public class Location { public int LocationId { get; set; } public string Address { get; set; } public string Address2 { get; set; } public string Address3 { get; set; } public string State { get; set; } public virtual int CountryId { get; set; } public virtual Country Country { get; set; } }
这是我的automapper创建地图当前的样子:
Mapper.CreateMap<UserBM,User>();
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。