コード例 #1
0
        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;
            }
        }
コード例 #2
0
        public UnitOfWork(string connString)
        {
            DbContext     = new CheckListDbContext(connString);
            _repositories = new Dictionary <string, BaseRepository>();

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