Loading

摘要: 在上篇中我们通过创建一个类并继承autoMapper的Profile类 public class Mappings : Profile { public Mappings() { CreateMap<UserDto, TbUser>(); } } 这样做有一种弊端,就是当传输对象很多的时候,还需要手 阅读全文
posted @ 2019-12-03 23:07 tenghao510 阅读(1293) 评论(0) 推荐(1) 编辑
摘要: 一、什么是AutoMapper? AutoMapper是一个简单的对象映射框架(OOM),将一个对象映射到另一个对象。 二、AutoMapper的好处 以前的时候我们将DTO对象转换为Model对象时,我们必须将每一个属性都手动映射 实体类 /// <summary> /// 用户表 /// </s 阅读全文
posted @ 2019-12-03 23:04 tenghao510 阅读(930) 评论(0) 推荐(2) 编辑
摘要: Autofac自动注入是通过名称约定来实现依赖注入 ps:本demo接口层都以“I”开头,以“Service”结尾。服务层实现都以“Service”结尾。 为什么要实现自动注入 大多时候,我们都是 以下方式进行依赖注入 public IServiceProvider ConfigureService 阅读全文
posted @ 2019-12-03 22:26 tenghao510 阅读(1341) 评论(0) 推荐(0) 编辑