Пример #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                // Do nothing
                return;
            }

            if (this.LinkResolver != null)
            {
                this.LinkResolver.Dispose();
                this.LinkResolver = null;
            }

            if (this.SecurityDescriptorRersolver != null)
            {
                this.SecurityDescriptorRersolver.Dispose();
                this.SecurityDescriptorRersolver = null;
            }

            if (this.DistinguishedNameResolver != null)
            {
                this.DistinguishedNameResolver.Dispose();
                this.DistinguishedNameResolver = null;
            }

            if (this.DomainController != null)
            {
                this.DomainController.Dispose();
                this.DomainController = null;
            }

            if (this.database != null)
            {
                this.database.Dispose();
                this.database = null;
            }

            if (this.session != null)
            {
                if (this.isDBAttached)
                {
                    this.session.DetachDatabase(this.DSADatabaseFile);
                    this.isDBAttached = false;
                }

                this.session.Dispose();
                this.session = null;
            }

            if (this.instance != null)
            {
                this.instance.Dispose();
                this.instance = null;
            }
        }
Пример #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing)
     {
         // Do nothing
         return;
     }
     if(this.LinkResolver != null)
     {
         this.LinkResolver.Dispose();
         this.LinkResolver = null;
     }
     if (this.SecurityDescriptorRersolver != null)
     {
         this.SecurityDescriptorRersolver.Dispose();
         this.SecurityDescriptorRersolver = null;
     }
     if (this.DistinguishedNameResolver != null)
     {
         this.DistinguishedNameResolver.Dispose();
         this.DistinguishedNameResolver = null;
     }
     if (this.DomainController != null)
     {
         this.DomainController.Dispose();
         this.DomainController = null;
     }
     if (this.database != null)
     {
         this.database.Dispose();
         this.database = null;
     }
     if (this.session != null)
     {
         if (this.attachedDatabasePath != null)
         {
             this.session.DetachDatabase(this.attachedDatabasePath);
             this.attachedDatabasePath = null;
         }
         this.session.Dispose();
         this.session = null;
     }
     if (this.instance != null)
     {
         this.instance.Dispose();
         this.instance = null;
     }
 }