Beispiel #1
0
        /// <summary>
        /// Performs the TypeMap single use test.
        /// </summary>
        private TimeSpan PerformTypeMapTimeTest()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            TestClass1 source      = new TestClass1();
            TestClass2 destination = new TestClass2();

            TypeMap.Map(source, destination);

            return(stopwatch.Elapsed);
        }
Beispiel #2
0
        /// <summary>
        /// Performs the Type Map load test.
        /// </summary>
        private TimeSpan PerformTypeMapLoadTest()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            for (int i = 0; i < LoopMax; i++)
            {
                TestClass1 source      = new TestClass1();
                TestClass2 destination = new TestClass2();

                TypeMap.Map(source, destination);
            }

            return(stopwatch.Elapsed);
        }
Beispiel #3
0
        /// <summary>
        /// Performs the regular copy use test.
        /// </summary>
        private TimeSpan PerformCopyTimeTest()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            TestClass1 source      = new TestClass1();
            TestClass2 destination = new TestClass2();

            destination.MappedInt     = source.MappedInt;
            destination.MappedBool    = source.MappedBool;
            destination.MappedChar    = source.MappedChar;
            destination.MappedString  = source.MappedString;
            destination.MappedDouble  = source.MappedDouble;
            destination.MappedFloat   = source.MappedFloat;
            destination.MappedDecimal = source.MappedDecimal;

            return(stopwatch.Elapsed);
        }
Beispiel #4
0
        /// <summary>
        /// Performs the AutoMapper single use test.
        /// </summary>
        private TimeSpan PerformAutoMapperTimeTest()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            TestClass1 source      = new TestClass1();
            TestClass2 destination = new TestClass2();

            AutoMapper.Mapper.Initialize(new AutoMapper.Configuration.MapperConfigurationExpression()
            {
                CreateMissingTypeMaps = true
            });
            AutoMapper.Mapper.Map(source, destination);

            TypeMap.Map(source, destination);

            return(stopwatch.Elapsed);
        }