public void Cleanup()
        {
            if (_transaction != null)
            {
                _transaction.Rollback();
            }
            _transaction = null;

            if (DbContext != null)
            {
                DbContext.Dispose();
                DbContext = null;
            }

            if (_dbConnection != null)
            {
                if (_dbConnection.State == System.Data.ConnectionState.Open)
                {
                    _dbConnection.Close();
                }

                _dbConnection.Dispose();
                _dbConnection = null;
            }
        }
        public UnitOfWork(string connString)
        {
            DbContext     = new CheckListDbContext(connString);
            _repositories = new Dictionary <string, BaseRepository>();

            _unitOfWorkId = (new Random()).Next(1, 50000);
        }
Beispiel #3
0
 public Repository(CheckListDbContext dbContext)
 {
     DbContext = dbContext;
 }