U4-61 - Create a wrapper/helper for HttpContext.Items

Created by Shannon Deminick 20 Jun 2012, 15:44:37 Updated by Claus Jensen 14 Apr 2016, 10:59:31

Subtask of: U4-806

There is a TON of reliance on HttpContext.Items in the codebase and using magic strings to get access to these elements. All of this functionality should be wrapped up in the UmbracoContext class which should expose these as properties. Then we replace all calls to the HttpContext.Items to use the UmbracoContext.

We should also have this using an IUmbracoContext so we can unit test everything! Having all reliance on UmbracoContext.Current would be just as bad as having reliance on HttpContext.Current.

Comments

Morten Christensen 20 Jun 2012, 17:16:36

I think this task relates to implementing IFileSystem right? As the HttpContext is used to MapPath in various classes.


Shannon Deminick 22 Jun 2012, 14:38:33

Well, HttpContext itself is another problem :)

The actual collection HttpContext.Items is used throughout the codebase and there's all sorts of special items that 'need' to be in there or else things will stop working. All of this is based on magic strings so it would be much better to have this collection of special items part of a real class with getters/setters. This class can then wrap HttpContext.Items internally if it wants.


Sebastiaan Janssen 10 Sep 2012, 12:49:09

@Shannon could you please update the status of this work item? If there's still a lot of work to be done to bring this to completion we should move it to the 6.0.0 release so it doesn't slow down actual development on 4.10. Thanks!


Shannon Deminick 10 Sep 2012, 20:54:05

This is not critical, its just a much nicer way to deal with the substantial amount of untyped calls to the HttpContext.Items with magic strings. The wrapper should be on the UmbracoContext but yes, we can wait till v6 for this or whenevs.


Priority: Task - Pri 1

Type: Task

State: Closed

Assignee:

Difficulty: Very Easy

Category: Architecture

Backwards Compatible: False

Fix Submitted:

Affected versions: 4.5.2

Due in version:

Sprint:

Story Points:

Cycle: