csharp automapper_2.cs

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp automapper_2.cs相关的知识,希望对你有一定的参考价值。

var domainTeam = new Team() { Name = "Team 1", Description = "..." };

public class TeamRepository
{
  public void Create(Team team)
  {
    // Don't forget to do your Mapper.Map<> in your bootstrap code in Global.asax or something or you'll get an unknown map error
    var entityFrameworkTeam = Mapper.Map<Entities.Team>(team);
    
    // db.add
    // db.savechanges
  }
}

以上是关于csharp automapper_2.cs的主要内容,如果未能解决你的问题,请参考以下文章

csharp AutoMappers

csharp automapper配置

csharp automapper formember

csharp 在LINQ查询中使用AutoMapper

csharp 通过Automapper创建/更新

csharp AutoMapper 6.0演示