Nice write-up! Just note that the document type th...
# package-development
r
Nice write-up! Just note that the document type that is imported by your package might get updated by the user and those changes won't be reflected in the strongly typed model anymore, since your custom generator will return the one compiled into your package... There are multiple ways to avoid this (and the added complexity of replacing the built-in models generator) if you want to use models within your package: - Simply use
IPublishedContent
in your package and get property values by alias (works out of the box, but doesn't allow you to use strongly typed models) - Create custom model classes that inherit
PublishedContentWrapped
and expose the required values as properties (requires you to wrap the content before passing it to your package Razor views) - Create interfaces with the required properties and require users to extend their models with this type (allows you to use the interface for strongly typed model access and even allow users to update property names/types and 'map' them by changing the interface implementation) If you really wanted, you could use the last option and a custom models generator implementation that writes the partial classes that adds the interface (in addition to the default generated models)...