Esempio n. 1
0
        public double ManualMappingPerformance()
        {
            CustomerDto dtoCustomer;

            PerformanceTimer timer = new PerformanceTimer();

            timer.Start();

            for (int i = 0; i < 1000000; i++)
            {
                dtoCustomer = customer.ToDto();
            }

            return(timer.Stop());
        }
Esempio n. 2
0
        public double ManualMappingPerformance()
        {
            CustomerDto dtoCustomer;

            PerformanceTimer timer = new PerformanceTimer();

            timer.Start();

            for (int i = 0; i < 1000000; i++)
            {
                dtoCustomer = customer.ToDto();
            }

            return timer.Stop();
        }
Esempio n. 3
0
        public double AutoMapperPerformance()
        {
            CustomerDto dtoCustomer;

            //define the NextMap mapping.
            AutoMapper.Mapper.CreateMap <Customer, CustomerDto>().ForMember(x => x.Years, y => y.MapFrom(z => z.Age));

            PerformanceTimer timer = new PerformanceTimer();

            timer.Start();

            for (int i = 0; i < 1000000; i++)
            {
                dtoCustomer = AutoMapper.Mapper.Map <Customer, CustomerDto>(customer);
            }

            return(timer.Stop());
        }
Esempio n. 4
0
        public double NextMapPerformance()
        {
            CustomerDto dtoCustomer;

            //define the NextMap mapping.
            NextMap.Mapper.CreateMap<Customer, CustomerDto>().ForMember(x => x.Years, y => y.MapFrom(z => z.Age));

            PerformanceTimer timer = new PerformanceTimer();

            timer.Start();

            for (int i = 0; i < 1000000; i++)
            {
                dtoCustomer = NextMap.Mapper.Map<Customer, CustomerDto>(customer);
            }

            return timer.Stop();
        }