Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
I have noticed this as well. And it's no longer possible to delete properties that are removed in code from the admin UI as far as I can see.
This is also not working in the latest version of CMS 11
I read in another thread that if anyone changes the sort order of a single property on a content type, it will not sync anymore with the code until the "revert to default" button is clicked on each property.
This code was linked in that thread (that i cant find again for some reason), I have not tested this code, so use at your own risk:
var contentTypeRepository = ServiceLocator.Current.GetInstance<IContentTypeRepository>();
var propertyDefinitionRepository = ServiceLocator.Current.GetInstance<IPropertyDefinitionRepository>();
var myPages = contentTypeRepository.List();
foreach (var myPageType in myPages) {
foreach (var prop in myPageType.PropertyDefinitions) {
var writable = prop.CreateWritableClone();
writable.ResetPropertyDefinition();
propertyDefinitionRepository.Save(writable);
}
}
Edit: I made a modification for myself to just reset the sort indexes using some reflection, as the resetpropertydefinition call will reset everything, including custom property settings and such, the below only resets the sort index:
var contentTypeRepository = ServiceLocator.Current.GetInstance<IContentTypeRepository>();
var propertyDefinitionRepository = ServiceLocator.Current.GetInstance<IPropertyDefinitionRepository>();
var myPages = contentTypeRepository.List();
foreach (var myPageType in myPages) {
foreach (var prop in myPageType.PropertyDefinitions) {
var writable = prop.CreateWritableClone();
writable.GetType().GetProperty("NullableFieldOrder", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
.SetValue(writable, null, null);
propertyDefinitionRepository.Save(writable);
}
}
It it just me, or are sort orders for content type properties no longer being updated during model synchronization?
I'm on the latest version, but changes to the Order property of a Display attribute isn't reflected in the database.
Notice how the sort order in the database is still 0, despite having been changed to 200 in code:
(This is with latest package versions at time of writing, EPiServer.Framework 12.4.0)