Exemplo n.º 1
0
        protected virtual ContentType.ContentTypeProperty AddContentTypeProperty(ContentType contentType, PropertyInfo propertyInfo)
        {
            //TODO: Différencier les Strong Relation des Relation (weak)... Ex. AddAggregationProperty (avec un attribut?)
            if (propertyInfo.PropertyType.IsContentTranslationVersion())
            {
                return(contentType.AddRelationProperty(GetContentTypePropertyNameFromPropertyInfo(propertyInfo),
                                                       GetContentTypePropertyIsCultureInvariantFromPropertyInfo(propertyInfo)));
            }

            if (propertyInfo.PropertyType.IsGenericList() && propertyInfo.PropertyType.GenericTypeArguments[0].IsContentTranslationVersion())
            {
                return(contentType.AddRelationsProperty(GetContentTypePropertyNameFromPropertyInfo(propertyInfo),
                                                        GetContentTypePropertyIsCultureInvariantFromPropertyInfo(propertyInfo)));
            }

            return(contentType.AddProperty(GetContentTypePropertyNameFromPropertyInfo(propertyInfo),
                                           GetContentTypePropertyDefaultValueFromPropertyInfo(propertyInfo),
                                           GetContentTypePropertyIsCultureInvariantFromPropertyInfo(propertyInfo)));
        }