Andrew Stopford's Weblog

poobah

Sponsors

News

Articles

Family

Old Blogs

IContext, good or bad

One of the comments in Phil's post on using the MVP patten is mapping the Context object to a type that is based on a IContext pattern. For an example of what this does take a look at the interface here and its creation here (CreateContext method). It feels wrong me to though as your adding the request and response data to a collection and getting at the data that way and it seems to go from one object layout to another. I guess that for unit test purposes (mocking the data that this contains for example) this would be useful, am I right in my thinking here.

Posted: Aug 23 2006, 11:52 AM by astopford | with 3 comment(s)
Filed under: ,

Comments

Haacked said:

It's a love/hate thing man.  If you are only running your code in one context (ASP.NET), what's the point of abstracting your context to another class that is simply a passthrough?

Problem is, I do run my code in 2 contexts.  ASP.NET and MbUnit (what! what!).

I wouldn't even consider this IContext if Microsoft had done so with ASP.NET.  Or if they had at least not sealed HttpContext.  Because it is sealed, I can't use RhinoMocks to mock it.  Grrr!

That leaves me this monstrosity that handles 80% of my cases.

http://haacked.com/archive/2005/06/11/4617.aspx

But is complicated and hard to maintain.

Phil

# August 23, 2006 11:44 AM

Jesse Ezell Blog said:

Andrew Stopford asks:One of the comments in Phil's post on using the MVP patten ismappingthe Context

# August 23, 2006 1:06 PM

Community Blogs said:

Rob has been busy, creating two SonicCasts :) MVC and using SubSonic MVC templates . Rails from a ASP

# July 31, 2007 4:58 AM