Esempio n. 1
0
 internal ActiveDirectorySchemaClass(DirectoryContext context, string ldapDisplayName, DirectoryEntry classEntry, DirectoryEntry schemaEntry)
 {
     this.type              = SchemaClassType.Structural;
     this.context           = context;
     this.ldapDisplayName   = ldapDisplayName;
     this.classEntry        = classEntry;
     this.schemaEntry       = schemaEntry;
     this.isDefunctOnServer = false;
     this.isDefunct         = this.isDefunctOnServer;
     try
     {
         this.abstractClassEntry = DirectoryEntryManager.GetDirectoryEntryInternal(context, "LDAP://" + context.GetServerName() + "/schema/" + ldapDisplayName);
         this.iadsClass          = (NativeComInterfaces.IAdsClass) this.abstractClassEntry.NativeObject;
     }
     catch (COMException exception)
     {
         if (exception.ErrorCode == -2147463168)
         {
             throw new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySchemaClass), ldapDisplayName);
         }
         throw ExceptionHelper.GetExceptionFromCOMException(context, exception);
     }
     catch (InvalidCastException)
     {
         throw new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySchemaClass), ldapDisplayName);
     }
     catch (ActiveDirectoryObjectNotFoundException)
     {
         throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", new object[] { context.Name }));
     }
     this.isBound = true;
 }
        // Internal constructor
        internal ActiveDirectorySchemaClass(DirectoryContext context, string ldapDisplayName, DirectoryEntry classEntry, DirectoryEntry schemaEntry)
        {
            _context = context;
            _ldapDisplayName = ldapDisplayName;
            _classEntry = classEntry;
            _schemaEntry = schemaEntry;

            // this constructor is only called for non-defunct classes
            _isDefunctOnServer = false;
            _isDefunct = _isDefunctOnServer;

            // initialize the directory entry for the abstract schema class
            try
            {
                _abstractClassEntry = DirectoryEntryManager.GetDirectoryEntryInternal(context, "LDAP://" + context.GetServerName() + "/schema/" + ldapDisplayName);
                _iadsClass = (NativeComInterfaces.IAdsClass)_abstractClassEntry.NativeObject;
            }
            catch (COMException e)
            {
                if (e.ErrorCode == unchecked((int)0x80005000))
                {
                    throw new ActiveDirectoryObjectNotFoundException(Res.GetString(Res.DSNotFound), typeof(ActiveDirectorySchemaClass), ldapDisplayName);
                }
                else
                {
                    throw ExceptionHelper.GetExceptionFromCOMException(context, e);
                }
            }
            catch (InvalidCastException)
            {
                // this means that we found an object but it is not a schema class
                throw new ActiveDirectoryObjectNotFoundException(Res.GetString(Res.DSNotFound), typeof(ActiveDirectorySchemaClass), ldapDisplayName);
            }
            catch (ActiveDirectoryObjectNotFoundException)
            {
                // this is the case where the context is a config set and we could not find an ADAM instance in that config set
                throw new ActiveDirectoryOperationException(Res.GetString(Res.ADAMInstanceNotFoundInConfigSet, context.Name));
            }

            // set the bind flag
            this.isBound = true;
        }
 internal ActiveDirectorySchemaClass(DirectoryContext context, string ldapDisplayName, DirectoryEntry classEntry, DirectoryEntry schemaEntry)
 {
     this.type = SchemaClassType.Structural;
     this.context = context;
     this.ldapDisplayName = ldapDisplayName;
     this.classEntry = classEntry;
     this.schemaEntry = schemaEntry;
     this.isDefunctOnServer = false;
     this.isDefunct = this.isDefunctOnServer;
     try
     {
         this.abstractClassEntry = DirectoryEntryManager.GetDirectoryEntryInternal(context, "LDAP://" + context.GetServerName() + "/schema/" + ldapDisplayName);
         this.iadsClass = (NativeComInterfaces.IAdsClass) this.abstractClassEntry.NativeObject;
     }
     catch (COMException exception)
     {
         if (exception.ErrorCode == -2147463168)
         {
             throw new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySchemaClass), ldapDisplayName);
         }
         throw ExceptionHelper.GetExceptionFromCOMException(context, exception);
     }
     catch (InvalidCastException)
     {
         throw new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySchemaClass), ldapDisplayName);
     }
     catch (ActiveDirectoryObjectNotFoundException)
     {
         throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", new object[] { context.Name }));
     }
     this.isBound = true;
 }