Need clarifiction on models builder modes.
# help-with-umbraco
m
Reading over https://docs.umbraco.com/umbraco-cms/reference/templating/modelsbuilder/configuration I am confused on something. The document says "InMemoryAuto(default): Generate models in a dynamic in-memory assembly." So the default behavor in any environment is InMemoryAuto but the document later says "It is recommended to generate models in your development environment only and change the ModelsMode to Nothing for your staging and production environments." So if "nothing" is the recommended mode why is InMemoryAuto the default? Also. In Umbraco Cloud if I set "nothing" for the build in proudction, make updates to a doc type and template does the new model get pushed up to production when I use Umbraco Deploy to move the changes?
j
The default is InMemoryAuto which basically means models are stored in the memory for the site - this means you can't use them in your views, etc as they are generated at runtime and the compiler can't find them. This is probably the defualt because it "just works" without having to consider anything else. Most people then switch to a setup where they set the modelsbuilder to fx SourceCodeManual on their local environments and then Nothing for all others. This is because if it is set to SourceCodeManual you have to actually push a button in the backoffice to generate them, and they are then added as a csharp files which on build adds them to your dlls. This means you can reference these strongly typed models from your code and views instead of the generic IPublishedContent type. However, what if you then change fx an alias on a property? Then your code that uses that model with that property will suddenly not be able to compile after you generate your models again. This is why you only allow it on the local environments and set the modelsbuilder mode to Nothing on all hosted environments, which means forces developers to have to do the changes locally as otherwise the models are not up to date. You would never want to make a change to doctypes/templates on live, if this is needed you make it locally and push to live directly
m
I have SourceCodeAuto on my local dev. If I make doctype/template changes local and use Umbarco deploy to push the changes does the new model go with it and like a soft-reboot or something happen so the live environment uses the new model or do I ahve to reboot the live environmet to make the changes acivte (assume I use strongly typed properies in the template code)?
13 Views