Beispiel #1
0
        //
        // Public Methods
        //
        public void Dispose()
        {
            if (!_disposed)
            {
                GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalContext", "Dispose: disposing");

                // Note that we may end up calling Dispose multiple times on the same
                // StoreCtx (since, for example, it might be that userCtx == groupCtx).
                // This is okay, since StoreCtxs allow multiple Dispose() calls, and ignore
                // all but the first call.

                if (_userCtx != null)
                    _userCtx.Dispose();

                if (_groupCtx != null)
                    _groupCtx.Dispose();

                if (_computerCtx != null)
                    _computerCtx.Dispose();

                if (_queryCtx != null)
                    _queryCtx.Dispose();

                _disposed = true;
                GC.SuppressFinalize(this);
            }
        }