EmitMapper的总结

EmitMapper简介

前言:

参考官网: http://emitmapper.codeplex.com/

Project Description
Powerful customisable tool for mapping entities to each other. Entities can be plain objects, DataReaders, SQL commands and anything you need. The tool uses run-time code
generation via the Emit library. It is usefull for dealing with DTO objects, data access layers an so on. 官方原文翻译:
项目描述
用于将实体映射到彼此的强大的可定制工具。实体可以是纯对象,DataReaders,SQL命令以及任何您需要的。该工具通过Emit库生成运行时代码。处理DTO对象,数据访问层等都是有用的。

优点:

我们看看官方怎么说???我想官方给了四点足以让你在相应的项目中使用它

  1. Extremely fast. It effectively uses the Emit library to generate mappers at run-time direct in IL as though these mappers are written by hand. Most other mappers use the Reflection library for mapping (or source code generation). Also EmitMapper minimizes boxing-unboxing operations and additional calls during mapping. For example it performs type conversion for value-types without boxing-unboxing and converts nested members without recursion (one-pass algorithm) when it is possible.
  2. Easy to use. Emit Mapper produces mappers at run time and there is no need for special complex build process unlike some other libraries which perform source code generation. Emit Mapper API is as simple as possible. You don't need to create any tedious XML document, or scatter strange attributes on your objects. Mapper can be created by one method call. But if you need fine-grained mapping configuration, you can easily reach it.
  3. Flexible. Emit Mapper doesn't have any hardcoded mapping strategy (special mapping attributes, XML documents or whatever) unlike most other mapping libraries. Instead, Emit Mapper has extremely flexible API and you can define any mapping yourself. For example you can define automatic mapping for DataReader to your business-objects. In general, Emit Mapper can be used as high performance tool for dynamic access to object properties and fields.
  4. Multi-Platform. The Emit Mapper can be run on Microsoft .NET Framework, Silverlight and Mono

官方给出四个优点

  1. 非常快 它有效地使用Emit库在IL中直接在运行时生成映射器,就好像这些映射器是用手写的。大多数其他映射器使用Reflection库进行映射(或源代码生成)。此外,EmitMapper还可以最大限度地减少打击拆箱操作和映射期间的其他调用。例如,对于没有打包装箱的值类型,它执行类型转换,并在可能时转换嵌套成员而不进行递归(一次通过算法)。
  2. 使用方便。Emit Mapper在运行时生成映射器,与执行源代码生成的其他库不同,不需要特殊的复杂构建过程。Emit Mapper API尽可能简单。您不需要创建任何繁琐的XML文档,或在对象上散布奇怪的属性。Mapper可以通过一种方法调用创建。但是,如果您需要细粒度的映射配置,您可以轻松实现。
  3. 灵活。与大多数其他映射库不同,Emit Mapper没有任何硬编码映射策略(特殊映射属性,XML文档或其他任何内容)。相反,Emit Mapper具有非常灵活的API,您可以自己定义任何映射。例如,您可以为DataReader定义自动映射到业务对象。通常,Emit Mapper可以用作动态访问对象属性和字段的高性能工具。
  4. 多平台。Emit Mapper可以在Microsoft .NET Framework,Silverlight和Mono上运行。

类型转换:

Emit Mapper can automatic convert the following types:
  1. Anything to string using the ToString() method.
  2. Primitive types using System.Convert class.
  3. Nullable types to value types and vice-versa.
  4. Enum to its underlying type and vice-versa.
  5. Enum to string and vice-versa.
  6. Collections of different types to each other (arrays, ArrayList, List<>, IEnumerable)
  7. classes to structures and vice-versa.
  8. Complex types with complex nested members using recursive mapping with shallow or deep copieng.
Emit Mapper可以自动转换以下类型:
  1. 任何使用ToString()方法进行字符串处理。
  2. 使用System.Convert类的基本类型。
  3. Nullable类型对值类型,反之亦然。
  4. 枚举为其底层类型,反之亦然。
  5. 枚举到字符串,反之亦然。
  6. 不同类型的集合(数组,ArrayList,List <>,IEnumerable)
  7. 类到结构,反之亦然。
  8. 具有复杂嵌套成员的复杂类型使用具有浅或深对应的递归映射。

总结:官方的描述,也可以在面试过程中进行简述,加分项。。。。。

  • 博主是利用读书、参考、引用、抄袭、复制和粘贴等多种方式打造成自己的纯镀 24k 文章,请原谅博主成为一个无耻的文档搬运工!
  • 小弟刚迈入博客编写,文中如有不对,欢迎用板砖扶正,希望给你有所帮助。

EmitMapper系列之一:EmitMapper入门的更多相关文章

  1. 分布式学习系列【dubbo入门实践】

    分布式学习系列[dubbo入门实践] dubbo架构 组成部分:provider,consumer,registry,monitor: provider,consumer注册,订阅类似于消息队列的注册 ...

  2. 「译」JUnit 5 系列:基础入门

    原文地址:http://blog.codefx.org/libraries/junit-5-basics/ 原文日期:25, Feb, 2016 译文首发:Linesh 的博客:JUnit 5 系列: ...

  3. SpringBoot系列: RestTemplate 快速入门

    ====================================相关的文章====================================SpringBoot系列: 与Spring R ...

  4. Go基础系列:channel入门

    Go channel系列: channel入门 为select设置超时时间 nil channel用法示例 双层channel用法示例 指定goroutine的执行顺序 channel基础 chann ...

  5. elk系列1之入门安装与基本操作【转】

    preface 我们每天都要查看服务器的日志,一方面是为了开发的同事翻找日志,另一方面是巡检服务器查看日志,而随着服务器数量以及越来越多的业务上线,日志越来越多,人肉运维相当痛苦了,此时,参考现在非常 ...

  6. Velocity魔法堂系列一:入门示例(转)

    Velocity魔法堂系列一:入门示例 一.前言 Velocity作为历史悠久的模板引擎不单单可以替代JSP作为Java Web的服务端网页模板引擎,而且可以作为普通文本的模板引擎来增强服务端程序文本 ...

  7. 学习笔记之盘一盘 Python 系列 1 & 2 - 入门篇

    盘一盘 Python 系列 1 & 2 - 入门篇 https://mp.weixin.qq.com/s?__biz=MzIzMjY0MjE1MA==&mid=2247486473&a ...

  8. Flask开发系列之快速入门

    Flask开发系列之快速入门 文档 一个最小的应用 调试模式 路由 变量规则 构造 URL HTTP 方法 静态文件 模板渲染 访问请求数据 环境局部变量 请求对象 文件上传 Cookies 重定向和 ...

  9. SpringBoot系列之从入门到精通系列教程

    对应SpringBoot系列博客专栏,例子代码,本博客不定时更新 Spring框架:作为JavaEE框架领域的一款重要的开源框架,在企业应用开发中有着很重要的作用,同时Spring框架及其子框架很多, ...

随机推荐

  1. Spark简单集群搭建

    1. 上传spark-2.2.0-bin-hadoop2.7.tgz安装包到/home/dtouding目录下 2. 解压安装包到/bigdata/目录下,tar –zxvf spark-2.2.0- ...

  2. Aspose 直接插入SQL Server DataTalbe

    原文链接:http://www.cnblogs.com/hellohongfu/p/7362830.html 下面的代码可以根据excel文件,生成创建表的SQL,以及测试InsertSQL .方法将 ...

  3. Hihocoder #1098 : 最小生成树二·Kruskal算法 ( *【模板】 )

    #1098 : 最小生成树二·Kruscal算法 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 随着小Hi拥有城市数目的增加,在之间所使用的Prim算法已经无法继续使用 ...

  4. WinDbg 在64位系统下转储32位进程

    在64位系统下,首先要判断进程是32位,还是64位 在Win8之前,进程名后带星号(*)则是32位进程.但Win8.1后,则不显示星号.需要选出“平台”列,来确认32位,还是64位. 在64位系统下的 ...

  5. Android 代码设置RelativeLayout元素居中

    RelativeLayout relativeLayout= new RelativeLayout(this); RelativeLayout.LayoutParams rlp=new Relativ ...

  6. Servlet分页查询

    分页查询: 1.逻辑分页查询:用户第一次访问时就把全部数据访问出来,添加到一个大集合中,然后放到session中,进行转发.通过页码等的计算,把要显示的内容添加到一个小集合中,转发.遍历小集合以显示当 ...

  7. nodejs开发游戏服务器遇到的性能问题

    问题描述: 使用nodejs开发了一个游戏服务器,为了尽可能提高服务器的性能,服务器采用多进程的架构,前面处理玩家socket连接的是多个nodejs进程,使用 child_process 模块,服务 ...

  8. CodeForces 712B Memory and Trident (水题,暴力)

    题意:给定一个序列表示飞机要向哪个方向飞一个单位,让你改最少的方向,使得回到原点. 析:一个很简单的题,把最后的位置记录一下,然后要改的就是横坐标和纵坐标绝对值之和的一半. 代码如下: #pragma ...

  9. 洛谷 - P1217 - 回文质数 - 枚举

    https://www.luogu.org/problemnew/show/P1217 考虑暴力生成所有的回文数然后再判断是不是质数.注意个位的选择实际上只有4种.所以是 $4*10^3*10^3=4 ...

  10. PhpStorm之服务器篇

    打开编辑器,依次点击 Tools->Deloyment->Configuration,进入连接服务器的配置页面 2.点击左上角的 + ,配置一个新的服务器 3.填写添加之后服务器的名称,并 ...