using System; namespace Neo.Afx.Services.Integration { /// /// A data store for 's. /// public abstract partial class IntegrationStore : IDisposable { bool _disposed; ///////////////////////////////////////////////////////////////////////////// // IDisposable methods ///////////////////////////////////////////////////////////////////////////// #region Dispose /// /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// public void Dispose() { Dispose(true); // This object will be cleaned up by the Dispose method. // Therefore, you should call GC.SupressFinalize to // take this object off the finalization queue // and prevent finalization code for this object // from executing a second time. GC.SuppressFinalize(this); } // Dispose(bool disposing) executes in two distinct scenarios. // If disposing equals true, the method has been called directly // or indirectly by a user's code. Managed and unmanaged resources // can be disposed. // If disposing equals false, the method has been called by the // runtime from inside the finalizer and you should not reference // other objects. Only unmanaged resources can be disposed. void Dispose(bool disposing) { // Check to see if Dispose has already been called. if(!_disposed) { // If disposing equals true, dispose all managed // and unmanaged resources. if(disposing) { // Dispose managed resources here. Close(); } // Dispose unmanaged resources here. _disposed = true; } } #endregion #region Destructor /// /// Releases unmanaged resources and performs other cleanup operations before the /// is reclaimed by garbage collection. /// ~IntegrationStore() { // Do not re-create Dispose clean-up code here. // Calling Dispose(false) is optimal in terms of // readability and maintainability. Dispose(false); } #endregion } }