/// <summary> /// 销毁资源。 /// </summary> /// <param name="disposing">如果为 true,则同时释放托管资源和非托管资源;如果为 false,则仅释放非托管资源。</param> protected void Dispose(bool disposing) { if (!isDisposed) { if (context != null) { if (isBeginTransaction) { context.Database.RollbackTransaction(); } context.Dispose(); } isDisposed = true; } }
/// <summary> /// Disposes the context. The underlying <see cref="ObjectContext" /> is also disposed if it was created /// is by this context or ownership was passed to this context when this context was created. /// The connection to the database (<see cref="DbConnection" /> object) is also disposed if it was created /// is by this context or ownership was passed to this context when this context was created. /// </summary> /// <param name="disposing"> /// <c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources. /// </param> protected virtual void Dispose(bool disposing) { _internalContext.Dispose(); }