This article is a mirror article of machine translation, please click here to jump to the original article.

View: 26326|Reply: 0

[Source] . .NET's fastest OOM object mapping component, Tiny Mapper, in project practice

[Copy link]
Posted on 5/31/2018 1:08:02 PM | | |
Step 1:Understanding the Library Method: TinyMapper has two main functions:



Step 2:Initialize the Mapping settings

Note: There are only two modes for similar mapping settings: code static object initialization mode and xml configuration mode.

Note: In the above mapping mapping, for the code of the original author, the mapping relationship by PersonDto=》Person is added.

T GetMapObject<T>(object obj) where the role of T:class will be reflected in the code below. A simple method, the power is not to be underestimated~~

Step 3:DtoModel -》Model

Mapping from the database model to the domain model:



Step 4:Model-》DtoModel

From domain model to database model:



Step 5:List<Model>=>List<DtoModel> or List<DtoModel>=>List<Model>


Special note: For objects that get a list type, you don't need to add an additional IList type to the static initialization map. TinyMapper will automatically help you get the data you want dynamically according to the "mapped base type".

Reference links:

. .NET platform open source project quick look (14) The fastest object mapping component, Tiny Mapperhttp://www.cnblogs.com/asxinyu/p ... ect_TinyMapper.html
EmitMapper and TinyMapper are a simple comparisonhttps://blog.csdn.net/umke888/article/details/54880670





Previous:Newtonsoft.Json ignores the DataContract feature
Next:The difference between ManualResetEvent and AutoResetEvent learned by C# threads
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com