Public Access on a content node breaks binding to a ModelsBuilder generated model
Hi,
I am building a new site in Umbraco CMS 8.4.0 with ModelsBuilder generating my doctype models (I'm using AppData mode).
This site will have content that is visible only for members so I created a "MemberPage" doc type and a MemberPage.cshtml template and a MemberPage.generated.cs model. The doc type only has one property and it's using a Grid Layout data type.
I create some content in the content tree and fire up my site. If I put a breakpoint in the MemberPage.cshtml template it does get tripped if I load my content page in a browser.
While on the breakpoint I check the Locals pane in Visual Studio and it reports this.Model (System.Web.Mvc.WebViewPage) is of Type NRAPO.Web.PublishedModels.MemberPage.
I continue and then stop on a breakpoint I set in the ~/Views/Partials/Grid/Bootstrap3.cshtml file. Here again I check the Locals pane in VS and it reports this.Model (System.Web.Mvc.WebViewPage) is of Type object (Newtonsoft.Json.Linq.JObject). This is because this view is bound to:
@inherits UmbracoViewPage<dynamic>
So far so good.
Now, if I right-click on the content node in the CMS and select "Public Access" and select "Group Based Protection" and fix the settings appropriately I should now have a page that is visible only to authenticated members (who are in a particular Member Group).
I go back to my browser and try to load the page I should break on my MemberPage.cshtml breakpoint, right? Well, no, I don't. My breakpoint on the MemberPage.cshtml view never trips. But I do stop on the breakpoint in the Bootstrap3.cshtml view and now the Locals Pane reports that this.Model (System.Web.Mvc.WebViewPage) is of Type NRAPO.Web.PublishedModels.WebPage.
Yes, NRAPO.Web.PublishedModels.WebPage IS a valid generated model which represents a valid doc type. But it most certainly is not the doc type of this particular content node.
If I remove the Public Access settings from this node and then load the page in a browser all my breakpoints hit as I expect and I can see that the node is being bound to the correct generated model.
But it appears that when Public Access is active the content node is NOT being bound to the correct generated model.
Public Access on a content node breaks binding to a ModelsBuilder generated model
Hi,
I am building a new site in Umbraco CMS 8.4.0 with ModelsBuilder generating my doctype models (I'm using AppData mode).
This site will have content that is visible only for members so I created a "MemberPage" doc type and a MemberPage.cshtml template and a MemberPage.generated.cs model. The doc type only has one property and it's using a Grid Layout data type.
My template is bound to the model like this:
I create some content in the content tree and fire up my site. If I put a breakpoint in the MemberPage.cshtml template it does get tripped if I load my content page in a browser.
While on the breakpoint I check the Locals pane in Visual Studio and it reports this.Model (System.Web.Mvc.WebViewPage) is of Type NRAPO.Web.PublishedModels.MemberPage.
I continue and then stop on a breakpoint I set in the ~/Views/Partials/Grid/Bootstrap3.cshtml file. Here again I check the Locals pane in VS and it reports this.Model (System.Web.Mvc.WebViewPage) is of Type object (Newtonsoft.Json.Linq.JObject). This is because this view is bound to:
So far so good.
Now, if I right-click on the content node in the CMS and select "Public Access" and select "Group Based Protection" and fix the settings appropriately I should now have a page that is visible only to authenticated members (who are in a particular Member Group).
I go back to my browser and try to load the page I should break on my MemberPage.cshtml breakpoint, right? Well, no, I don't. My breakpoint on the MemberPage.cshtml view never trips. But I do stop on the breakpoint in the Bootstrap3.cshtml view and now the Locals Pane reports that this.Model (System.Web.Mvc.WebViewPage) is of Type NRAPO.Web.PublishedModels.WebPage.
Yes, NRAPO.Web.PublishedModels.WebPage IS a valid generated model which represents a valid doc type. But it most certainly is not the doc type of this particular content node.
If I remove the Public Access settings from this node and then load the page in a browser all my breakpoints hit as I expect and I can see that the node is being bound to the correct generated model.
But it appears that when Public Access is active the content node is NOT being bound to the correct generated model.
Has anyone else run into this?
is working on a reply...