// -------------------------------------------------------------------------------- ToRepositorySchemaData public RepositorySchemaData ToRepositorySchemaData() { return(new RepositorySchemaData { PropertyTypes = _propertyTypes.Select(p => new PropertyTypeData { Id = p.Id, Name = p.Name, DataType = p.DataType, Mapping = p.Mapping, IsContentListProperty = p.IsContentListProperty }).ToList(), NodeTypes = _nodeTypes.Select(n => new NodeTypeData { Id = n.Id, Name = n.Name, ParentName = n.Parent?.Name, ClassName = n.ClassName, Properties = n.DeclaredPropertyTypes.Select(p => p.Name).ToList() }).ToList(), ContentListTypes = _contentListTypes.Select(c => new ContentListTypeData { Id = c.Id, Name = c.Name, Properties = c.PropertyTypes.Select(p => p.Name).ToList() }).ToList(), }); }
private void BuildPropertyTypeAssignments(DataTable table) { foreach (DataRow row in table.Rows) { int propertyTypeId = TypeConverter.ToInt32(row["PropertyTypeId"]); int propertySetId = TypeConverter.ToInt32(row["PropertySetID"]); bool isDeclared = TypeConverter.ToBoolean(row["IsDeclared"]); PropertyType propertyType = _propertyTypes.GetItemById(propertyTypeId); if (propertyType == null) { throw new InvalidSchemaException(String.Concat(SR.Exceptions.Schema.Msg_PropertyTypeDoesNotExist, ": id=", propertyTypeId)); } PropertySet propertySet = null; if (propertyType.IsContentListProperty) { propertySet = _contentListTypes.GetItemById(propertySetId); } else { propertySet = _nodeTypes.GetItemById(propertySetId); } try { if (isDeclared) { AddPropertyTypeToPropertySet(propertyType, propertySet); } } catch (ArgumentNullException ex) { SnLog.WriteWarning("Unknown property set: " + propertySetId, properties: new Dictionary <string, object> { { "PropertyTypeId", propertyType.Id }, { "Content list types: ", string.Join(", ", _contentListTypes.Select(cl => cl.Id)) }, { "Node types: ", string.Join(", ", _nodeTypes.Select(nt => string.Format("{0} ({1})", nt.Name, nt.Id))) }, }); throw new InvalidSchemaException("Unknown property set: " + propertySetId, ex); } } }