private void BuildPropertySets(DataTable table, Dictionary <int, PropertySetType> propertySetTypes)
{
List <NodeTypeInfo> ntiList = new List <NodeTypeInfo>();
foreach (DataRow row in table.Rows)
{
int id = TypeConverter.ToInt32(row["PropertySetID"]);
int parentID = row["ParentID"] is DBNull ? 0 : TypeConverter.ToInt32(row["ParentID"]);
string name = TypeConverter.ToString(row["Name"]);
string className = row["ClassName"] is DBNull ? null : TypeConverter.ToString(row["ClassName"]);
PropertySetType propertySetType = propertySetTypes[TypeConverter.ToInt32(row["PropertySetTypeID"])];
switch (propertySetType)
{
case PropertySetType.NodeType:
ntiList.Add(new NodeTypeInfo(id, parentID, name, className));
break;
case PropertySetType.ContentListType:
CreateContentListType(id, name);
break;
default:
throw new InvalidSchemaException(String.Concat(SR.Exceptions.Schema.Msg_UnknownPropertySetType, propertySetType));
}
}
while (ntiList.Count > 0)
{
for (int i = ntiList.Count - 1; i >= 0; i--)
{
NodeTypeInfo nti = ntiList[i];
NodeType parent = null;
if (nti.ParentId == 0 || ((parent = _nodeTypes.GetItemById(nti.ParentId)) != null))
{
CreateNodeType(nti.Id, _nodeTypes.GetItemById(nti.ParentId), nti.Name, nti.ClassName);
ntiList.Remove(nti);
}
}
}
}