Given:
- When using the Unit Of Work pattern with an ORM in ASP.NET, the UnitOfWork object holds a reference to HttpContext.
Question:
- But what if I need to perform some data access in Application_Start (especially in IIS7)?
- Is the Unit Of Work pattern still viable?
Why is your unit of work holding a reference to HttpContext? To get at session state? If this is the case, have it hold onto something more abstract (i.e. an interface), which in Application_Start will represent a concrete class that does not need HttpContext, and everywhere else will be another (that uses HttpContext internally)