/// <summary>
        
        /// </summary>
        /// <param name="directoryEntry"></param>
        
        public LDAPObject CreateObject(DirectoryEntry directoryEntry)
        {
            if (directoryEntry == null)
                throw new ArgumentNullException("directoryEntry");

            LDAPObject result = null;

            string schemaClassName = null;

            try
            {
                schemaClassName = directoryEntry.SchemaClassName;
            }
            catch (Exception e)
            {
                _log.ErrorFormat("Can't get directoryEntry.SchemaClassName property. {0}", e);
            }
            finally 
            { 
                
            }

            switch (schemaClassName)
            {
                case Constants.ObjectClassKnowedValues.Domain:
                case Constants.ObjectClassKnowedValues.DomainDNS:
                    result = new LDAPDomain(directoryEntry);
                    break;
                case Constants.ObjectClassKnowedValues.User:
                    result = new LDAPUser(directoryEntry);
                    break;
                case Constants.ObjectClassKnowedValues.Computer:
                    result = new LDAPComputer(directoryEntry);
                    break;
                case Constants.ObjectClassKnowedValues.Group:
                    result = new LDAPGroup(directoryEntry);
                    break;
                case Constants.ObjectClassKnowedValues.Container:
                    result = new LDAPContainer(directoryEntry);
                    break;
                case Constants.ObjectClassKnowedValues.RpcContainer:
                    result = new LDAPRpcContainer(directoryEntry);
                    break;
                case Constants.ObjectClassKnowedValues.BuildInDomain:
                    result = new LDAPBuildInDomain(directoryEntry);
                    break;
                case Constants.ObjectClassKnowedValues.OrganizationalUnit:
                    result = new LDAPOrganizationalUnit(directoryEntry);
                    break;


                default:
                    result = new LDAPOtherObject(directoryEntry);
                    break;
            }


            return result;
        }
Пример #2
0
        /// <summary>

        /// </summary>
        /// <param name="directoryEntry"></param>

        public LDAPObject CreateObject(DirectoryEntry directoryEntry)
        {
            if (directoryEntry == null)
            {
                throw new ArgumentNullException("directoryEntry");
            }

            LDAPObject result = null;

            string schemaClassName = null;

            try
            {
                schemaClassName = directoryEntry.SchemaClassName;
            }
            catch (Exception e)
            {
                _log.ErrorFormat("Can't get directoryEntry.SchemaClassName property. {0}", e);
            }
            finally
            {
            }

            switch (schemaClassName)
            {
            case Constants.ObjectClassKnowedValues.Domain:
            case Constants.ObjectClassKnowedValues.DomainDNS:
                result = new LDAPDomain(directoryEntry);
                break;

            case Constants.ObjectClassKnowedValues.User:
                result = new LDAPUser(directoryEntry);
                break;

            case Constants.ObjectClassKnowedValues.Computer:
                result = new LDAPComputer(directoryEntry);
                break;

            case Constants.ObjectClassKnowedValues.Group:
                result = new LDAPGroup(directoryEntry);
                break;

            case Constants.ObjectClassKnowedValues.Container:
                result = new LDAPContainer(directoryEntry);
                break;

            case Constants.ObjectClassKnowedValues.RpcContainer:
                result = new LDAPRpcContainer(directoryEntry);
                break;

            case Constants.ObjectClassKnowedValues.BuildInDomain:
                result = new LDAPBuildInDomain(directoryEntry);
                break;

            case Constants.ObjectClassKnowedValues.OrganizationalUnit:
                result = new LDAPOrganizationalUnit(directoryEntry);
                break;


            default:
                result = new LDAPOtherObject(directoryEntry);
                break;
            }


            return(result);
        }