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