|Number of votes:||4|
Default property values on content in EPiServer are set by overriding SetDefaultValues. In an attempt to make my model classes a bit tidier, by not having to do the override in lots of places, I wrote a little piece of code which enables the use of the DefaultValue attribute (found in System.Component), like so:
Below is the code that is needed in order to make this work. In this particular case, SitePageData is the base class for all my page types.
Now, as long as my page types inherits SitePageData, the attribute can be utilized. Example: