Example #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;
 }
Example #2
0
 public VerificationDbContext GetDbContext()
 {
     return(_dataContext ?? (_dataContext = new VerificationDbContext(new DbContextOptionsBuilder().UseMySql(_configuration.ConnectionString).Options)));
 }
Example #3
0
 public Repository(IDbContextProvider dbContextProvider)
 {
     _verificationDbContext = dbContextProvider.GetDbContext();
     _dbset = _verificationDbContext.Set <E>();
 }