Пример #1
0
        static void Main()
        {
            Console.WriteLine("PrepareTestData...");
            var testData = GetTestData();

            RunTest("Automapper 7.0.1", testData,
                    data =>
            {
                AutoMapper.Mapper.Initialize(new MapperConfigurationExpression());
                var result = AutoMapper.Mapper.Map <PersonIn[], PersonOut[]>(data);
            });

            RunTest("Moon.FastAutoMapper", testData,
                    data =>
            {
                var result = FastAutoMapper.Mapper.Map <PersonIn[], PersonOut[]>(data);
            });

            RunTest("CustomWithFor", testData,
                    data =>
            {
                var result = CustomMapper.Map(data);
            });

            RunTest("CustomWithLinq", testData,
                    data =>
            {
                var result = CustomMapper.MapWithLinq(data);
            });
            Console.ReadLine();
        }
Пример #2
0
        static void Main()
        {
            Console.WriteLine("PrepareTestData...");
            var testData = GetTestData();

            RunTest("Automapper 8.1.1", testData,
                    data =>
            {
                var configuration = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <AddressIn, AddressOut>();
                    cfg.CreateMap <PersonIn, PersonOut>();
                });
                CheckAutomapperConfiguration(configuration);
                var result = configuration.CreateMapper().Map <PersonIn[], PersonOut[]>(data);
            });

            RunTest("Moon.FastAutoMapper", testData,
                    data =>
            {
                var result = FastAutoMapper.Mapper.Map <PersonIn[], PersonOut[]>(data);
            });

            RunTest("CustomWithFor", testData,
                    data =>
            {
                var result = CustomMapper.Map(data);
            });

            RunTest("CustomWithLinq", testData,
                    data =>
            {
                var result = CustomMapper.MapWithLinq(data);
            });
            Console.ReadLine();
        }