public static void ByMerge(int count)
        {
            DatabaseOps.ClearPrimaryTable();
            DatabaseOps.CreateTempTable();

            Insert.BySqlBulkCopy(count, false);

            using (var context = new EntityDataModel())
            {
                var entities = context.Orders.ToList();

                entities.ForEach(entity => entity.Date = DateTime.Now.AddYears(100));

                var stopwatch = new Stopwatch();
                stopwatch.Start();

                Insert.BulkCopy(entities, "Order_TEMP");

                DatabaseOps.Merge();

                stopwatch.Stop();

                Console.WriteLine("MERGE({0}) = {1} s", count, stopwatch.Elapsed.TotalSeconds);
            }

            DatabaseOps.DropTempTable();
        }
        public static void ByAddWithNoDetect(int count)
        {
            DatabaseOps.ClearPrimaryTable();

            var entities = EntityGenerator.Generate(count);

            using (var context = new EntityDataModel())
            {
                var stopwatch = new Stopwatch();

                stopwatch.Start();

                context.Configuration.AutoDetectChangesEnabled = false;

                entities.ForEach(entity => context.Orders.Add(entity));

                context.Configuration.AutoDetectChangesEnabled = true;

                context.SaveChanges();

                stopwatch.Stop();

                Console.WriteLine("NoDetect({0}) = {1} s", count, stopwatch.Elapsed.TotalSeconds);
            }
        }
        public static void BySqlBulkCopy(int count, bool output = true)
        {
            DatabaseOps.ClearPrimaryTable();

            var entities = EntityGenerator.Generate(count);

            var stopwatch = new Stopwatch();

            stopwatch.Start();

            BulkCopy(entities, "Order");

            stopwatch.Stop();

            if (output)
            {
                Console.WriteLine("BulkCopy({0}) = {1} s", entities.Count, stopwatch.Elapsed.TotalSeconds);
            }
        }
        public static void ByRange(int count)
        {
            DatabaseOps.ClearPrimaryTable();

            var entities = EntityGenerator.Generate(count);

            using (var context = new EntityDataModel())
            {
                var stopwatch = new Stopwatch();

                stopwatch.Start();

                context.Orders.AddRange(entities);
                context.SaveChanges();

                stopwatch.Stop();

                Console.WriteLine("Range({0}) = {1} s", count, stopwatch.Elapsed.TotalSeconds);
            }
        }
        public static void BySaveChanges(int count)
        {
            DatabaseOps.ClearPrimaryTable();
            Insert.BySqlBulkCopy(count, false);

            using (var context = new EntityDataModel())
            {
                var entities = context.Orders.ToList();

                entities.ForEach(entity => entity.Date = DateTime.Now.AddYears(666));

                var stopwatch = new Stopwatch();
                stopwatch.Start();

                context.SaveChanges();

                stopwatch.Stop();

                Console.WriteLine("SaveChanges({0}) = {1} s", count, stopwatch.Elapsed.TotalSeconds);
            }
        }
        public static void ByAdd(int count)
        {
            DatabaseOps.ClearPrimaryTable();

            //Создаем нужное количество объектов для добавления в контекст
            var entities = EntityGenerator.Generate(count);

            using (var context = new EntityDataModel())
            {
                var stopwatch = new Stopwatch();

                stopwatch.Start();

                entities.ForEach(entity => context.Orders.Add(entity));

                context.SaveChanges();

                stopwatch.Stop();

                Console.WriteLine("Add({0}) = {1} s", count, stopwatch.Elapsed.TotalSeconds);
            }
        }