΢ Ͷ ^ ھ

江苏队cba赛程 :.NET COREʹAutoMapperMЌӳķ

cba㶫 www.axwwg.com  •rg2019-06-25 03:01:38   ߣ   ҪuՓ(0)




AutoMapper uses a fluent configuration API to define an object-object mapping strategy. AutoMapper uses a convention-based matching algorit


AutoMapper uses a fluent configuration API to define an object-object mapping strategy. AutoMapper uses a convention-based matching algorithm to match up source to destination values. AutoMapper is geared towards model projection scenarios to flatten complex object models to DTOs and other simple objects, whose design is better suited for serialization, communication, messaging, or simply an anti-corruption layer between the domain and application layer.

پW//automapper.org/

ęnhttps://automapper.readthedocs.io/en/latest/index.html

GitHubhttps://github.com/AutoMapper/AutoMapper/blob/master/docs/index.rst

ƽ_֧֣

  • .NET 4.6.1+
  • .NET Standard 2.0+ https://docs.microsoft.com/en-us/dotnet/standard/net-standard

ʹ

Nugetb

AutoMapper  
AutoMapper.Extensions.Microsoft.DependencyInjection //هעAutoMapperҪdԓ

StartupAutoMapper

public void ConfigureServices(IServiceCollection services)
{
 services.AddMvc();
 //ӌAutoMapper֧
 services.AddAutoMapper();
}

AutoMapperӳҎt

public class AutoMapperConfigs:Profile
{
 //ČwӳPϵ.
 public AutoMapperConfigs()
 {
  CreateMap<DBPoundSheet, PoundSheetViewModel>();
  CreateMap<PoundSheetViewModel, DBPoundSheet>();
 }
}

ژ캯עIMapper

IMapper _mapper;

public PoundListController(IMapper mapper)
{
 _mapper = mapper;
}

΂DQ

//typeof(model)="PoundSheetViewModel"
DBPoundSheet dBPoundSheet = _mapper.Map<DBPoundSheet>(model);

όDQ

Y

Ͼ@ƪµȫϣĵă݌ҵČW߹һąWrֵxxҌ_֮ҵ֧

ܸdȤ:

  • 岽OOMAutoMapperʹ
  • .NET CoreهעAutoMapperķʾ
  • Ԕc# AutoMapper ʹ÷ʽ
  • AutomapperFԄӳČa

P

  • .NET COREʹAutoMapperMЌӳķ

    .NET COREʹAutoMapperMЌӳķ

    AutoMapper uses a fluent configuration API to define an object-object mapping strategy. AutoMapper uses a convention-based matching algorit
    2019-06-25
  • VS2019xbDĽ̳

    VS2019xbDĽ̳

    ԔB VS2019 xbPE_ld C++_l.NET _lPĹؓdMFC xM鿴 ؓd(Workload
    2019-06-25
  • Ԕ.net coreӛӛ

    Ԕ.net coreӛӛ

    ASP.NET Core ЃõlogMzǿ΢ܛٷęnòƟoֱӌ־ļ򔵓ֻԼFõ־M žNloglog4ne
    2019-06-25
  • Ԕlog4netʹ

    Ԕlog4netʹ

    ֻҪlog4net.dllļ õ log4net.Config.XmlConfigurator.Configure(); ϴa CSMain BS
    2019-06-25
  • dockerAsp.net coreõE

    dockerAsp.net coreõE

    1 ʹDockerǰ҂Ҫ˽һĸMSDNһ̓MCČȈDܺõչʾ̓MCą^eʾ̓MC
    2019-06-25
  • .NET Core DappermysqlČF

    .NET Core DappermysqlČF

    ǰ FORMʢѽFNͬORMײ҂ՄEFҲRRff Dapper.NET CoreʹDapperMysql
    2019-06-25
  • asp.net core ϵ֮l_ͻ

    asp.net core ϵ֮l_ͻ

    ĽB̎Ñlͬһ wͬrrFě_ͻ  ҪǃɷNһNzԲl_ͻʹ [ConcurrencyCheck] ;һNzyеIJ
    2019-06-25
  • Ԕ.Net Core CcڙࣨAuthorizeFilterActionFilterAttribute

    Ԕ.Net Core CcڙࣨAuthorizeFilterActionFilterAttribute

    .Net Core ʹAuthorizeFilterActionFilterAttribute팍F䛙Cڙ һAuthorizeFilter ½ڙAllowAnonymous^AuthorizeFilt
    2019-06-25
  • \.Net CoreJsonõԄӸ

    \.Net CoreJsonõԄӸ

    Pre ڿ Jesse Asp.net CoreT n̵ĕr˽⵽Asp .net core,ӵJsonñ,֧Ԅdõ,һ
    2019-06-25
  • .NET_lˆTPML.NETTW

    .NET_lˆTPML.NETTW

    ML.NETһֱ΢ܛоTĹ@ЩѽԼĮaƷWindows DefenderMicrosoft OfficePowerpointOӋExcelD]AzureC
    2019-06-25