U4-5253 - PublishedContentModelFactory case-sensitive dictionary

Created by Lee Kelleher 21 Jul 2014, 14:25:39 Updated by Stephan 25 Jul 2014, 07:20:36

The current implementation of PublishedContentModelFactory uses a generic dictionary to store the DocType alias with it's model constructor. The DocType alias is converted to lowercase before being entered into the dictionary, then for the lookup, the key is also converted to lowercase (in order to match it).

This code is fine and works. The alternative is to create the dictionary lookup to be case-insensitive by default, then we don't need to manually make the key/alias to be lowercase before performing the lookup.

e.g. var constructors = new Dictionary<string, Func<IPublishedContent, IPublishedContent>>(StringComparer.InvariantCultureIgnoreCase);

There is no performance gain with this amend, it's purely semantic ... but I wanted to create an issue/ticket to reference before submitting a pull-request ;-)

Comments

Lee Kelleher 21 Jul 2014, 14:33:45

PR submitted: https://github.com/umbraco/Umbraco-CMS/pull/429


Stephan 21 Jul 2014, 14:46:03

Have merged the PR.


Shannon Deminick 24 Jul 2014, 22:09:23

So @zpqrtbnk can this be set to fixed then ?


Stephan 25 Jul 2014, 07:20:33

Er, sure.


Priority: Minor

Type: Cosmetics

State: Fixed

Assignee:

Difficulty: Easy

Category:

Backwards Compatible: False

Fix Submitted: Pull request

Affected versions: 7.1.4

Due in version: 7.1.5

Sprint:

Story Points:

Cycle: