7得票1回答
在运行时告诉automapper忽略映射,这是否可能?

我将使用Entity Framework 6和Automapper来映射实体到DTO。 以下是我的数据模型: public class PersonDto { public int Id { get; set; } public string Name { get; set...

42得票6回答
如何在类库项目中配置AutoMapper?

我第一次使用自动映射。 我正在开发C#应用程序,想要使用Auto Mapper。 (我只是想知道如何使用它,因此我没有ASP.NET应用程序,也没有MVC应用程序。) 我有三个类库项目。 我想在服务项目中编写转换过程。 因此,我想知道在哪里以及如何配置Auto Mapper?

7得票2回答
Automapper,将单个目标属性映射为多个源属性的连接

我有这样一种情况,需要根据一些条件将单个属性映射为多个源属性的组合。 目标: public class Email { public Email() { EmailRecipient = new List<EmailRecipient>(); }...

21得票3回答
AutoMapper.Mapper.CreateMap<TSource, TDestination>()已过时。

我有两个类似的类。class A { public int id {get; set;} } class B { public C c {get; set;} } class C { public int id {get; set;} public string Name {get...

38得票5回答
Automapper 3.0 - 此类型不支持此平台IMapperRegistry。

我将我的项目升级到使用Automapper 3.0.0,现在我的TFS构建未成功。错误如下: "...System.PlatformNotSupportedException: System.PlatformNotSupportedException: This type is not su...

8得票1回答
如何在Automapper中将列表中的条件对象展平

我有一个包含Product列表的Item,使用AutoMapper将其映射到相应的ViewModel对象中。 在我的MVC项目中,我有一个操作方法,用于显示一个带有选择的Product的Item。为此,我有一个名为ItemDetailsViewModel的ViewModel,其中包含平整的I...

7得票2回答
如何在构造函数中使用AutoMapper映射到“this”

我有一个源类型,它具有属性和一个目标类型,该目标类型具有完全相同的属性。 在我像下面这样为AutoMapper配置一个简单映射之后: Mapper.CreateMap&lt;MySourceType, MyDestinationType&gt;(); 我希望有一个MyDestinati...

12得票4回答
为什么AutoMapper v3不能工作,因为它正在寻找v2.2.1.0?

我刚刚通过nuGet在一个新项目上安装了AutoMapper,但是当我运行代码时,出现了以下错误: 无法加载文件或程序集“AutoMapper, Version=2.2.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005”或其依赖...

10得票2回答
AutoMapper和在复杂对象中映射列表/嵌套映射

我正在努力将旧的映射标准转换为Automapper,但遇到了困难。 以下是我的类:// Models public class BaseModel { public Int64 Id { get; set; } public Guid UniqueId { get; set;...

7得票4回答
AutoMapper使用相同属性名称进行双向映射

考虑这两个对象: public class UserModel { public string Name {get;set;} public IList&lt;RoleModel&gt; Roles {get;set;} } public class UserViewMod...