扩展类:AutoMapExtention using System; using System.Collections.Generic; using System.Linq.Expressions; namespace AutoMapper.Extention { public static class AutoMapExtention { /// <summary> /// 类型映射 /// </summary> /// <typeparam name="F&qu…
// 摘要: // Converts an object to another using AutoMapper library. Creates a new object // of TDestination. There must be a mapping between objects before calling this // method. // **利用AutoMapper将一个实体转换为另一个实…
回到目录 AutoMapper在之前我曾经介绍过,今天主要是把它作一下扩展,因为它的调用太麻烦了,呵呵,扩展之后,用着还可以,感觉.net3.5之后,有了扩展方法这个东西,在程序开发速度及表现力上都有了明显的提升,呵呵. 当扩展方法开发完之后的效果如下 实体对实体的映射(赋值) var user = new User { ID = , Name = "zzl", CreateDate = DateTime.Now, }; UserModel model = user.MapTo<…