Ejemplo n.º 1
0
        public static async Task Main()
        {
            var dbContext = new BulkInsertContext();

            var paymentRepositories = new List <IPaymentRepository>()
            {
                new EFDummyAddRepository(dbContext),
                new EFAddRepository(dbContext),
                new EFAddRangeRepository(dbContext),
                new SqlBulkCopyRepository(dbContext),
                new AutoDetectChangesDisabledPaymentRepositoryDecorator(new EFDummyAddRepository(dbContext)),
                new AutoDetectChangesDisabledPaymentRepositoryDecorator(new EFAddRepository(dbContext)),
                new AutoDetectChangesDisabledPaymentRepositoryDecorator(new EFAddRangeRepository(dbContext)),
                new AutoDetectChangesDisabledPaymentRepositoryDecorator(new SqlBulkCopyRepository(dbContext)),
                // new BulkInsertRepository(dbContext)
            };

            IPerformanceService performanceService = new PerformanceService();

            var result = await performanceService.CompareAsync(paymentRepositories);

            var serializedResult
                = JsonSerializer.Serialize(result, new JsonSerializerOptions {
                WriteIndented = true
            });

            Console.WriteLine(serializedResult);
            Console.Read();
        }