public Repository(HCContext context, IUnitOfWorkAsync unitOfWork) { _context = context; _unitOfWork = unitOfWork; if (_context != null) { _dbSet = _context.Set <TEntity>(); } }
public virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { // free other managed objects that implement // IDisposable only try { if (_objectContext != null && _objectContext.Connection.State == ConnectionState.Open) { _objectContext.Connection.Close(); } } catch (ObjectDisposedException) { // do nothing, the objectContext has already been disposed } if (_dataContext != null) { _dataContext.Dispose(); _dataContext = null; } } // release any unmanaged objects // set the object references to null _disposed = true; }
public virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { // free other managed objects that implement // IDisposable only if (_dataContext != null) { _dataContext.Dispose(); _dataContext = null; } } // release any unmanaged objects // set the object references to null _disposed = true; }
public UnitOfWork() { _dataContext = new HCContext(); _repositories = new Dictionary <string, dynamic>(); }