U4-7751 - The template markup generated can be incorrect - based on casing which causes YSOD

Created by Shannon Deminick 15 Jan 2016, 15:53:39 Updated by Stephan 20 Jan 2016, 14:27:20

Tags: ModelsBuilder

Relates to: U4-7747

Example, create a doc type:

TEst

the markup generated is:

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage

which is wrong, the class name is 'TEst'

Comments

Stephan 15 Jan 2016, 16:07:40

The models builder gets the class name as:

ClrName = contentType.Alias.ToCleanString(CleanStringType.ConvertCase | CleanStringType.PascalCase)

BUT then it is possible to change that name via attributes. So although the alias is "foo", the class name could be "Bar". The ''only'' proper way to know the class name associated to an alias is by querying the published content model factory.


Stephan 15 Jan 2016, 16:35:38

The right way to do it is to modify the IPublishedContentModelFactory interface to add the

Type GetModelType(string contentTypeAlias);

method - because only the factory knows about the type. If we don't want to change that interface ''now'' for compatibility reasons, there is an ugly way to do it that would work with the built-in factory - but probably not with any other factory. And Ditto has its own factory.


Claus Jensen 18 Jan 2016, 14:25:40

Shannon has a task that is basically a duplicate of this, talk to him


Stephan 20 Jan 2016, 14:27:15

Fixed by U4-7747


Priority: Task - Pri 1

Type: Task

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.4.0

Due in version: 7.4.0

Sprint: Sprint 7

Story Points:

Cycle: