Beispiel #1
0
        static void Main(string[] args)
        {
            var uow = new DisconnectedUnitOfWork();

            uow.LoadEntities();
            var entity    = uow.WarehouseRepository.ReadOne(18);
            var entities  = uow.WarehouseRepository.ReadAll();
            var newEntity = new Warehouse()
            {
                City  = "Batman",
                State = "Bin Superman"
            };

            uow.WarehouseRepository.Create(newEntity);
            uow.SaveChanges();
        }
Beispiel #2
0
        private double RunDisconnectedRepositoryReadMethod(int readsCount)
        {
            using (var uow = new DisconnectedUnitOfWork())
            {
                var sw = new Stopwatch();

                uow.LoadEntities();
                sw.Start();

                for (var i = 0; i < readsCount; i++)
                {
                    var entity = uow.WarehouseRepository.ReadOne(1);
                }

                sw.Stop();

                var averageTime = (double)sw.ElapsedMilliseconds / ReadSampleSize;

                return(averageTime);
            }
        }
Beispiel #3
0
        private double RunDisconnectedRepositoryWriteMethod(List <Warehouse> warehousesToInsert)
        {
            using (var uow = new DisconnectedUnitOfWork())
            {
                var sw = new Stopwatch();

                uow.LoadEntities();
                sw.Start();

                foreach (var warehouse in warehousesToInsert)
                {
                    uow.WarehouseRepository.Create(warehouse);
                }

                sw.Stop();

                var averageTime = (double)sw.ElapsedMilliseconds / WriteSampleSize;

                return(averageTime);
            }
        }