Beispiel #1
0
 protected virtual void Dispose(bool isDisposing)
 {
     if (!_disposed)
     {
         if (isDisposing)
         {
             //在这里释放托管资源
             if (this._dataContext != null)
             {
                 this._dataContext.Dispose();
                 this._dataContext = null;
             }
             _disposed = true;
         }
         //在这里释放非托管资源
     }
     //disposed = true;
 }
Beispiel #2
0
 public Repository(IDbContextProvider dbContextProvider)
 {
     _ServiceDbContext = dbContextProvider.GetDbContext();
     _dbset            = _ServiceDbContext.Set <E>();
 }
Beispiel #3
0
 public ServiceDbContext GetDbContext()
 {
     return(_dataContext ?? (_dataContext = new ServiceDbContext(new DbContextOptionsBuilder().UseMySql(_configuration.ConnectionString).Options)));
 }