U4-8626 - Remove dynamic published content access support

Created by Shannon Deminick 22 Jun 2016, 09:21:50 Updated by Stephan 08 Jan 2018, 09:14:44

Relates to: U4-8625

Subtask of: U4-5419

We are removing support for dynamically accessing content in views in v8. All published content access in v8 will be done using IPublishedContent and strongly typed models.

Comments

David Dimmer 29 Jun 2016, 03:23:18

Can you give examples to verify if this will become an issue on existing projects? I want to be sure my understanding of dynamics is the same as what the core is removing.


Stephan 07 Jul 2016, 15:44:04

You are using dynamics whenever your view inherits from UmbracoTemplatePage and you use the CurrentPage property to access the current content, and do things such as CurrentPage.Title to access the property with alias "title" without using strongly typed models.

Making sense?


David Dimmer 07 Jul 2016, 15:47:38

Stephan, that was what I suspected. So what is the preferred way to do CurrentPage.Title in version 8? We'd like to get our codebase compatible before version 8 is released.


Stephan 07 Jul 2016, 16:45:20

The ideal way is to use Models Builder to generate strongly typed models for your content types. Then, views should inherit from UmbracoViewPage. CurrentPage is gone, but Model is the current content, and therefore CurrentPage.Title becomes Model.Title. Assuming MyModel has a property named Title.


David Dimmer 07 Jul 2016, 22:17:25

We just finished training in Boulder; it is too bad it was still taught using Dynamics. Is it possible to post a sample view just to see an entire page for reference? Also let us know what your DocType is called that is passed in the


Shannon Deminick 07 Jul 2016, 22:42:04

This is documented:

https://our.umbraco.org/documentation/Reference/Templating/Mvc/views https://our.umbraco.org/documentation/Reference/Templating/Mvc/examples https://our.umbraco.org/documentation/Reference/Querying https://our.umbraco.org/documentation/Reference/Querying/IPublishedContent

... obviously ignore the dynamic part of the documentation. These docs don't cover access with ModelsBuilder, but that's pretty simple. This is how it would map:

@Model.Content.GetPropertyValue("bodyContent")

would be:

@Model.Content.BodyContent

It is important to realize that Models Builder models ARE IPublishedContent, so all of the ways that you can work with IPublishedContent will continue to work normally.


Stephan 08 Jul 2016, 06:33:11

@dd@fyin.com also, what would be interesting.... can you share a couple of the "most complex" views from that training? I'd be happy to refactor them to "v8 style" and that could be part of some documentation.


Priority: Task - Pri 1

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: False

Fix Submitted:

Affected versions:

Due in version: 8.0.0

Sprint:

Story Points:

Cycle: