In short if will replace the first example template with the second.
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@Model.Content.GetPropertyValue(“myProperty”)
@(Umbraco.Media(CurrentPage.myImage).umbracoFile)
@Model.Content.GetPropertyValue(“myProperty”, true, “Missing”)
@Umbraco.Field("myProperty ", recursive: true, altFieldAlias: "defaultProperty")
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<DocumentType>
@Model.Content.MyProperty
@(((Image)Model.Content).MyImage.UmbracoFile
@Model.Content.GetPropertyValue(s => s.MyProperty, true, “Missing”)
@Model.Content.GetPropertyValue(s => s.MyProperty, true, Model.Content.DefaultProperty)
This article describes the following approach: Generating C# models in the live Umbraco Instance and then pulling them down into the generated models down into the source Visual Studio Project and pre-compiles them there in the main application DLL. This has some major benefits over other approaches including:
- All code is pre-compiled and no generation or compilation is happening when the website is actually running or starting up.
- Models generation isn’t dependent on IIS Express and you don’t have to do desin work there or start up slow projects to manually create models.
- Models are generated the same place you edit the document types and generated automatically.
- Models are partial class’s that can be extended and can implement custom interfaces as needed.
- There is no need for any special visual studio plugins or deployment rules to make this work. All parts described will work on any Visual Studio Editions.