Пример #1
0
        static void Main(string[] args)
        {
            Init.InitHMapper();
            Init.InitAutomapper();
            Init.InitExpressMapper();

            var test = AutoMapper.Mapper.Map <PolymorphicSubClass, DTO.PolymorphicSubClass>(PolymorphicSubClass.Create(5));

            Run("Very simple class", VerySimpleClass.CreateMany(300000), x => new DTO.VerySimpleClass(x));
            Run("Simple class", SimpleClass.CreateMany(40000), x => new DTO.SimpleClass(x));
            Run("Simple set", SimpleSet.CreateMany(10000, 100), x => new DTO.SimpleSet(x));
            Run("Multiple set", MultipleSets.CreateMany(1000, 100), x => new DTO.MultipleSets(x));
            Run("Dictionary", DictionarySet.CreateMany(300, 100), x => new DTO.DictionarySet(x));

            Run("Simple generic class of int", SimpleGeneric <int> .CreateMany(Enumerable.Range(1, 300000).Select(i => i).ToArray()), x => new DTO.SimpleGeneric <int>(x));
            Run("Mapped object generic class", MappedObjectGeneric <VerySimpleClass> .CreateMany(VerySimpleClass.CreateMany(200000)), x => new DTO.MappedObjectGeneric <DTO.VerySimpleClass>(x));
            Run("Multiple generic class", MultipleGenerics <int, string> .CreateMany(Enumerable.Range(1, 200000).Select(i => Tuple.Create(i, Guid.NewGuid().ToString())).ToArray()), x => new DTO.MultipleGenerics <string, int>(x));
            Run("Polymorphic class", PolymorphicSubSubClass.CreateMany(300000), x => new DTO.PolymorphicSubClass(x));
            Run("Set of polymorphic class", SetOfPolymorphic.CreateMany(150000), x => new DTO.SetOfPolymorphic(x));
            Run("Generic of polymorphic class", MappedObjectGeneric <PolymorphicBaseClass> .CreateMany(PolymorphicBaseClass.CreateMany(200000)), x => new DTO.MappedObjectGeneric <DTO.PolymorphicBaseClass>(x));
            Run("Set of generic polymorphic classes", SetOfGenericPolymorph.CreateMany(50000), x => new DTO.SetOfGenericPolymorph(x));
        }