示例#1
0
        public void Test()
        {
            var person = new Person
            {
                Id          = 1,
                Name        = "zhangsan",
                Addr        = "地球",
                IdentityNo  = "111111",
                Sex         = EnumSex.FeMale,
                Birth       = DateTime.Now.AddYears(-10),
                Description = "哈哈",
                Age         = 20,
                Nick        = "aaa",
                QQ          = "123",
                Email       = "*****@*****.**",
                Phone       = "13845614789",
                WeiXin      = "14563298785",
                Picture     = "http://asdasd.jpg",
                Intro       = "bb",
                Score       = 21.00,
                Books       = new List <string> {
                    "斗罗大陆"
                },
                CreateDate = DateTime.Now,
                UpdateDate = DateTime.Now
            };
            var personDto = MapperExtension.GetMapper <Person, PersonDto>(person);

            System.Diagnostics.Debug.WriteLine(JsonConvert.SerializeObject(personDto));
        }
 public static IMapper GetMapper() => MapperExtension.GetMapper();