private bool DoesPropertyTypeAliasExist(GenericProperty gpData) { bool hasAlias = _contentType.getPropertyType(Casing.SafeAliasWithForcingCheck(gpData.Alias.Trim())) != null; ContentType ct = _contentType; while (ct.MasterContentType > 0) { ct = new ContentType(ct.MasterContentType); hasAlias = ct.getPropertyType(Casing.SafeAliasWithForcingCheck(gpData.Alias.Trim())) != null; } return !hasAlias; }
private static void SynchronizeProperty(ContentType documentType, KeyValuePair<PropertyInfo, DocumentTypePropertyAttribute> property) { if (documentType == null) return; var propertyAlias = Utility.FormatPropertyAlias(property.Key.Name); var propertyType = documentType.getPropertyType(propertyAlias); var propertyAttribute = property.Value; if (propertyType == null) propertyType = CreateAndAddPropertyTypeToDocumentType(propertyAlias, documentType, propertyAttribute); else UpdateExistingProperty(propertyType, propertyAttribute, documentType); propertyType.Save(); }