Ejemplo n.º 1
0
        public void Run()
        {
            var     config = new MapperConfiguration(cfg => cfg.AddMaps(typeof(Test11).Assembly));
            IMapper mapper = config.CreateMapper();

            UserEntity userEntity = new UserEntity("测试", "123", 25);

            UserDto dto = mapper.Map <UserEntity, UserDto>(userEntity);

            Console.WriteLine(dto.AsFormatJsonStr());
        }
Ejemplo n.º 2
0
        public void Run()
        {
            var     config = new MapperConfiguration(cfg => cfg.AddProfile <UserProfile>());
            IMapper mapper = config.CreateMapper();

            UserEntity userEntity = new UserEntity("测试", "123", 25);

            UserDto dto = mapper.Map <UserDto>(userEntity);

            Console.WriteLine(dto.AsFormatJsonStr());
        }