コード例 #1
0
        private void LoadClassList(Cursor dataTableCursor)
        {
            // Initialize the class list
            this.classesByName = new Dictionary<string, int>();

            // Load column IDs
            Columnid ldapDisplayNameCol = this.FindColumnId(CommonDirectoryAttributes.LDAPDisplayName);
            Columnid dntCol = this.FindColumnId(CommonDirectoryAttributes.DNTag);

            // Search for all classes
            dataTableCursor.CurrentIndex = this.FindIndexName(CommonDirectoryAttributes.ObjectClass);
            dataTableCursor.FindRecords(MatchCriteria.EqualTo, Key.Compose(CommonDirectoryClasses.ClassSchemaId));
            while (dataTableCursor.MoveNext())
            {
                // TODO: Load more data about classes
                int classId = dataTableCursor.RetrieveColumnAsDNTag(dntCol).Value;
                string className = dataTableCursor.RetrieveColumnAsString(ldapDisplayNameCol);
                classesByName.Add(className, classId);
            }
        }
コード例 #2
0
ファイル: DirectorySchema.cs プロジェクト: subTee/DSInternals
        private void LoadClassList(Cursor dataTableCursor)
        {
            // Initialize the class list
            this.classesByName = new Dictionary<string, int>();

            // Load column IDs. We are in an early stage of schema loading, which means that we cannot search for non-system attributes by name.
            Columnid dntCol = this.FindColumnId(CommonDirectoryAttributes.DNTag);
            Columnid governsIdCol = this.attributesByInternalId[CommonDirectoryAttributes.GovernsIdId].ColumnID;
            SchemaAttribute ldapDisplayNameAtt = this.attributesByInternalId[CommonDirectoryAttributes.LdapDisplayNameId];

            // Search for all classes using this heuristics: (&(ldapDisplayName=*)(governsId=*))
            dataTableCursor.CurrentIndex = ldapDisplayNameAtt.Index;
            while (dataTableCursor.MoveNext())
            {
                int? governsId = dataTableCursor.RetrieveColumnAsInt(governsIdCol);
                if(!governsId.HasValue)
                {
                    // This is an attribute and not a class, so we skip to the next object.
                    continue;
                }
                // TODO: Load more data about classes
                int classDNT = dataTableCursor.RetrieveColumnAsDNTag(dntCol).Value;
                string className = dataTableCursor.RetrieveColumnAsString(ldapDisplayNameAtt.ColumnID);
                classesByName.Add(className, classDNT);
            }
        }