Set default values for required properties that are null

PLACE FOR BLOG

Set default values for required properties that are null

Set default values for required properties that are null

marija

Ever added a new property with a default value and were annoyed that it's null for already created pages?

This is an Episerver feature, not a bug. However, most of the time, I would need to update the existing pages with this default value as much as the new ones, and this happens quite often during development. This can be also useful during deploy, prior to shipping a potentially erronious code that might throw a NullReferenceException.

I have updated the republish all content solution with another checkbox called: "Set default values of required properties that are empty (and have a default value defined)".

If this checkbox is checked, all properties that are null (on content of types that are not skipped) and have a default value defined are set to this default value.

Github code is now updated with this functionality.

LEAVE A COMMENT