【AutoMapper簡介】

【簡介】git

項目地址:https://github.com/AutoMapper/AutoMappergithub

幫助文檔:https://github.com/AutoMapper/AutoMapper/wikiapp

新手入門:https://github.com/AutoMapper/AutoMapper/wiki/Getting-startedide

AutoMapper是一個.NET的對象映射工具,AutoMapper能夠將複雜的對象轉換爲DTO(Data Transfer Object),或者簡單的對象,以方便數據的序列化以及傳輸。工具

【支持的平臺】spa

  • .NET 4 and higher
  • Silverlight 4 and higher
  • Windows Phone 7.5 and higher
  • .NET for Windows Store apps (WinRT)

【爲何要使用AutoMapper?】code

Mapping code is boring. Testing mapping code is even more boring. AutoMapper provides simple configuration of types, as well as simple testing of mappings. The real question may be "why use object-object mapping?" Mapping can occur in many places in an application, but mostly in the boundaries between layers, such as between the UI/Domain layers, or Service/Domain layers. Concerns of one layer often conflict with concerns in another, so object-object mapping leads to segregated models, where concerns for each layer can affect only types in that layer.對象

層與層之間若是使用同一實體,可能會由於不一樣的需求而產生衝突;爲了不衝突,能夠在各個須要實體的層映射產生須要的實體。文檔

相關文章
相關標籤/搜索