예제 #1
0
        static void Test(Customer item, int iterations)
        {
            Console.WriteLine();

            Console.WriteLine("Iterations : {0}", iterations);

            //TestCustomerNative(item, iterations);

            TypeAdapterConfig.GlobalSettings.Compiler = defaultCompiler;                     //switch compiler
            TypeAdapterConfig.GlobalSettings.Compile(typeof(Customer), typeof(CustomerDTO)); //recompile
            item.Adapt <Customer, CustomerDTO>();                                            //exercise
            TestMapsterAdapter <Customer, CustomerDTO>(item, iterations, ref sMP);

            //TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileFast();    //switch compiler
            //TypeAdapterConfig.GlobalSettings.Compile(typeof(Customer), typeof(CustomerDTO));    //recompile
            //item.Adapt<Customer, CustomerDTO>();    //exercise
            //TestMapsterAdapter<Customer, CustomerDTO>(item, iterations, ref sMF);
            TestCodeGen(item, iterations, ref sMF);

            ExpressMapper.Mapper.Map <Customer, CustomerDTO>(item);  //exercise
            TestExpressMapper <Customer, CustomerDTO>(item, iterations, ref sEM);

            Mapper.Map <Customer, CustomerDTO>(item);    //exercise
            TestAutoMapper <Customer, CustomerDTO>(item, iterations, ref sAM);
        }
예제 #2
0
 public static void ConfigureMapster(Customer customerInstance, MapsterCompilerType type)
 {
     SetupCompiler(type);
     TypeAdapterConfig.GlobalSettings.Compile(typeof(Customer), typeof(CustomerDTO)); //recompile
     customerInstance.Adapt <Customer, CustomerDTO>();                                //exercise
 }