In this tutorial, you will learn how to create strongly-typed models to use with your document types. (If you need a little more information why this is a good design approach, then I suggest you read this first).

Prerequisites For Generating Models

First, you will need to install the ModelsBuilder.API package into your solution.  You can install using the below command in your package console:

Next, you will need a model builder visual studio extension to call the API's and generate the classes.  The visual studio extension is available from here Umbraco Models Builder Custom Tool.  Or you can install it within Visual Studio -> Tools -> Extensions and features -> Online.

Configuring Your Solution

In your web.config you will need the following app settings:

Next, we need to configure the ModelBuilder custom tool.  Within Visual Studio, go to Tools -> Options -> Umbraco

On this screen, you will need to add in the details that will allow the tool to access your Umbraco website, which is your local website URL and your Umbraco username and password.

Generating Your Models

First, create an empty class library in your solution.  In there create an empty class and call it 'builder.cs'.  Right-click on it and select 'properties'

In the custom, tool field set it to 'UmbracoModelsBuilder'

Models should be automagically created, if they don't, you can right-click on the builder class and click 'run custom tool'.  This should generate the models for you.  Compile your solution and you should be good to go... enjoy!

NOTE:  If you struggle to find where the files are generated, expand the builder.  All the generated classes get created as children of it!