public void ExpressMapperLibraryDataCount10000() { IMapper Mapper = new ExpressMapperLibrary.Mapper(); Mapper.Map <List <Customer>, List <CustomerDto> >(MockData.Customer10000); }
static void Main(string[] args) { new MockData().CreateMockData(); // AgileMapperLibrary Console.WriteLine(string.Format("...: # AgileMapper Begin # :...")); IMapper AgileMapper = new AgileMapperLibrary.Mapper(); var resultAgileMapper = AgileMapper.Map <List <Customer>, List <CustomerDto> >(MockData.Customer10); foreach (var item in resultAgileMapper) { Console.WriteLine(string.Format("Customer ID : {0} - Name : {1} {2} - City : {3}", item.Id, item.Name, item.Surname, item.Address?.City)); } Console.WriteLine(string.Format("...: # AgileMapper End # :...")); Console.WriteLine(); // AutoMapperLibrary Console.WriteLine(string.Format("...: # AutoMapper Begin # :...")); IMapper AutoMapper = new AutoMapperLibrary.Mapper(); var resultAutoMapper = AutoMapper.Map <List <Customer>, List <CustomerDto> >(MockData.Customer10); foreach (var item in resultAutoMapper) { Console.WriteLine(string.Format("Customer ID : {0} - Name : {1} {2} - City : {3}", item.Id, item.Name, item.Surname, item.Address?.City)); } Console.WriteLine(string.Format("...: # AutoMapper End # :...")); Console.WriteLine(); // ExpressMapperLibrary Console.WriteLine(string.Format("...: # ExpressMapper Begin # :...")); IMapper ExpressMapper = new ExpressMapperLibrary.Mapper(); var resultExpressMapper = ExpressMapper.Map <List <Customer>, List <CustomerDto> >(MockData.Customer10); foreach (var item in resultExpressMapper) { Console.WriteLine(string.Format("Customer ID : {0} - Name : {1} {2} - City : {3}", item.Id, item.Name, item.Surname, item.Address?.City)); } Console.WriteLine(string.Format("...: # ExpressMapper End # :...")); Console.WriteLine(); // MapsterLibrary Console.WriteLine(string.Format("...: # Mapster Begin # :...")); IMapper Mapster = new MapsterLibrary.Mapper(); var resultMapster = Mapster.Map <List <Customer>, List <CustomerDto> >(MockData.Customer10); foreach (var item in resultMapster) { Console.WriteLine(string.Format("Customer ID : {0} - Name : {1} {2} - City : {3}", item.Id, item.Name, item.Surname, item.Address?.City)); } Console.WriteLine(string.Format("...: # Mapster End # :...")); Console.WriteLine(); // TinyMapperLibrary Console.WriteLine(string.Format("...: # TinyMapper Begin # :...")); IMapper TinyMapper = new TinyMapperLibrary.Mapper(); var resultTinyMapper = TinyMapper.Map <List <Customer>, List <CustomerDto> >(MockData.Customer10); foreach (var item in resultTinyMapper) { Console.WriteLine(string.Format("Customer ID : {0} - Name : {1} {2} - City : {3}", item.Id, item.Name, item.Surname, item.Address?.City)); } Console.WriteLine(string.Format("...: # TinyMapper End # :...")); Console.WriteLine(); List <CustomerDto> customerDtos = new List <CustomerDto>(); foreach (var item in MockData.Customer10000) { customerDtos.Add(new CustomerDto { Age = item.Age, Gender = item.Gender, Id = item.Id, IdentityNumber = item.IdentityNumber, IsStudent = item.IsStudent, Name = item.Name, Surname = item.Surname, Address = new AddressDto { ApartmentNumber = item.Address.ApartmentNumber, City = item.Address.City, Country = item.Address.Country, IsResidentialArea = item.Address.IsResidentialArea, ZipCode = item.Address.ZipCode } }); } List <CustomerDto> customerDtos1 = new List <CustomerDto>(); foreach (var item in MockData.Customer10000) { customerDtos1.Add(new CustomerDto { Age = item.Age, Gender = item.Gender, Id = item.Id, IdentityNumber = item.IdentityNumber, IsStudent = item.IsStudent, Name = item.Name, Surname = item.Surname, Address = new AddressDto { ApartmentNumber = item.Address.ApartmentNumber, City = item.Address.City, Country = item.Address.Country, IsResidentialArea = item.Address.IsResidentialArea, ZipCode = item.Address.ZipCode } }); } List <CustomerDto> customerDtos2 = new List <CustomerDto>(); customerDtos2.AddRange(MockData.Customer10000.Select(item => new CustomerDto { Age = item.Age, Gender = item.Gender, Id = item.Id, IdentityNumber = item.IdentityNumber, IsStudent = item.IsStudent, Name = item.Name, Surname = item.Surname, Address = new AddressDto { ApartmentNumber = item.Address.ApartmentNumber, City = item.Address.City, Country = item.Address.Country, IsResidentialArea = item.Address.IsResidentialArea, ZipCode = item.Address.ZipCode } })); BenchmarkRunner.Run <TestCustomer1>(); }