public BenchmarkInsertMultiple()
        {
            _dbContext = new NorthwindEntities();

            EntityFrameworkRawRepository    = new EntityFrameworkRepository(_dbContext);
            DapperRawSqlRepository          = new DapperRepository(_connStr);
            RawSqlRepository                = new RawSqlRepository(_connStr);
            RawSqlStoredProcedureRepository = new StoredProcedureRepository(_connStr);

            //IMPORTANT STEP: BEFORE STARTING THE BENCHMARK - MAKE SURE THE TABLES ARE EMPTY FOR CONSISTENT RESULTS!!!
            new DatabaseCleanup(_connStr).ClearInsertTables();

            efList   = new List <InsertTable>();
            dtoList1 = new List <InsertTableDto>();
            dtoList2 = new List <InsertTableDto>();
            dtoList3 = new List <InsertTableDto>();

            for (int i = 0; i < OBJECT_COUNT; i++)
            {
                efList.Add(InsertTableGenerator.NewEF(textLength));
                dtoList1.Add(InsertTableGenerator.NewDTO(textLength));
                dtoList2.Add(InsertTableGenerator.NewDTO(textLength));
                dtoList3.Add(InsertTableGenerator.NewDTO(textLength));
            }
        }
        public BenchmarkSelect()
        {
            _dbContext = new NorthwindEntities();

            EntityFrameworkRawRepository  = new EntityFrameworkRepository(_dbContext);
            EntityFrameworkViewRepository = new ViewEntityFrameworkRepository(_dbContext);
            DapperRawSqlRepository        = new DapperRepository(_connStr);
            RawSqlRepository = new RawSqlRepository(_connStr);
            RawSqlStoredProcedureRepository = new StoredProcedureRepository(_connStr);
        }
        public void RawSql()
        {
            //arrange
            IRepository <InvoiceDto, InsertTableDto> repo = new RawSqlRepository(_connStr);

            //act
            var results = repo.GetAll();

            //assert
            Assert.AreEqual(EXPECTED_COUNT, results.Count());
        }
        public void RawSql_Multiple()
        {
            //arrange
            var repo = new RawSqlRepository(_connStr);

            //act
            int rows = repo.InsertRows(dtos);

            //assert
            Assert.AreEqual(dtos.Count(), rows);
        }
        public void RawSql_Single()
        {
            //arrange
            var repo = new RawSqlRepository(_connStr);

            //act
            int rows = repo.InsertRows(new List <InsertTableDto> {
                single
            });

            //assert
            Assert.AreEqual(1, rows);
        }
Beispiel #6
0
 public ServiceRawSql()
 {
     _rawSqlRepository = new RawSqlRepository();
 }
 public int Insert_ADO_NET() => RawSqlRepository.InsertRows(dtoList1);
Beispiel #8
0
 public RawSqlServices()
 {
     _rawSqlRepository = new RawSqlRepository();
 }
 public List <InvoiceDto> Select_ADO_NET()
 {
     return(RawSqlRepository.GetAll().ToList());
 }