-
Notifications
You must be signed in to change notification settings - Fork 46
Install And Configure
In order for the models builder to be used in a website, the Umbraco.ModelsBuilder NuGet package needs to be installed. Then, the following application settings (in the appSettings section of the web.config file) control what the models builder actually does:
-
Umbraco.ModelsBuilder.Enablecan betrueorfalse(default) and acts as a giant kill-switch: when false, the models builder behaves as if it were not installed at all, and all other settings are ignored. -
Umbraco.ModelsBuilder.ModelsModedetermines how the models builder generates models. Valid values are:-
Nothing(default): do not generate models -
PureLive: generate models in a dynamic in-memory assembly -
Dll: generate models in a Dll in~/bin(causes an application restart) whenever the user "clicks the button" -
LiveDll: generate models in a Dll in~/bin(causes an application restart) anytime a content type changes -
AppData: generate models in~/App_Data/Models(but do not compile them) whenever the user "clicks the button" -
LiveAppData: generate models in~/App_Data/Models(but do not compile them) anytime a content type changes
-
-
Umbraco.ModelsBuilder.EnableFactorycan betrue(default) orfalseand determines whether the models builder registers the built-inIPublishedContentFactory. When false, models could be generated, but would not be used by Umbraco. -
Umbraco.ModelsBuilder.ModelsNamespace(string, default isUmbraco.Web.PublishedContentModels) specifies the generated models namespace. -
Umbraco.ModelsBuilder.LanguageVersion(string, default isCSharp5) indicates the C# language version which is used when compiling the models in [Live]Dll. Can be set toCSharp6orExperimentalto try the new C# features. -
Umbraco.ModelsBuilder.FlagOutOfDateModelscan betrue(default) orfalseand indicates whether out-of-date models (ie after a content type or data type has been modified) should be flagged. -
Umbraco.ModelsBuilder.StaticMixinGetterscan betrue(default) orfalseand indicates whether static mixin getters should be generated. -
Umbraco.ModelsBuilder.StaticMixinGetterPattern(string, default isGet{0}) indicates the format of the static mixin getters.
When the Models Builder is installed, a new dashboard is added to the Developers section of Umbraco's backend. The dashboard does three things:
- Details how the Models Builder is configured
- Provides a way to generate models (in [Live]Dll and [Live]AppData modes only)
- Reports the last error (if any) that would have prevented models from being properly generated
In addition, in order for the models builder to provide the API needed by the Visual Studio extension (or the console tool), the Umbraco.ModelsBuilder.Api NuGet package needs to be installed, and the following application setting needs to be configured:
-
Umbraco.ModelsBuilder.EnableApican betrueorfalse(default) and controls whether the models builder provides the API.
WARNING The API is provided when the website runs in debug mode, exclusively. Which means that the debug attribute of web.config's <compilation> element must be set to true.