I'm upgrading a site from 7 to 8. In my V8 site, I have finally got it to compile up to a point at least, but am struggling now with the templating.
Whereas on the v7 site I can access a property such as Model.Title directly, in V8 I can only get to it by Model.Value("title"). This is using the Embedded version of ModelsBuilder, compiling to App_Data:
@inherits Umbraco.Web.Mvc.UmbracoViewPage
@using Umbraco.Core.Models.PublishedContent;
@using ContentModels = Umbraco.Core.Models.PublishedContent;
@using Umbraco.Web.PublishedModels;
@using Umbraco.ModelsBuilder;
@{
Layout = "Master.cshtml";
var IsChristmas = Model.Value("IsChristmas"); // this works
var Is Christmas = Model.IsChristmas; // this doesn't work
Would it be better to install the full Models Builder and compile to dll?
Not sure if this is to do with the Embedded.ModelBuilder, or an issue with VS, but when I removed it and installed the full ModelsBuilder and ModelsBuilder.UI I am now able to add the Model to the UmbracoViewPage:
Models not allowing direct access to properties
I'm upgrading a site from 7 to 8. In my V8 site, I have finally got it to compile up to a point at least, but am struggling now with the templating.
Whereas on the v7 site I can access a property such as Model.Title directly, in V8 I can only get to it by Model.Value("title"). This is using the Embedded version of ModelsBuilder, compiling to App_Data:
Would it be better to install the full Models Builder and compile to dll?
To answer my own question.
Not sure if this is to do with the Embedded.ModelBuilder, or an issue with VS, but when I removed it and installed the full ModelsBuilder and ModelsBuilder.UI I am now able to add the Model to the UmbracoViewPage:
and can now reference model properties directly
is working on a reply...