This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I was working on libraries that are used by both web appilcations and forms applications. I wanted to stash a 'Current' Unit of Work in either the current HttpContext or the CallContext so that it could be referred to in either case: if(HttpContext.Current!=null){ This type of pattern has worked out for me in the past (for the most part). 1. I'm wondering, If I do this I assume I would not need to deal with the PerRequest/PerThread UnitOfWorkScope classes, and I can work directly with the UnitOfWork class. 2. Any suggestions for dealing with this in a better manner would be appreciated. Thanks
|
|
|
Correct, in this case you would not want to use the existing scope classes. You are effectively providing your own scope class, which smartly adapts to whichever environment it finds itself in, and this custom scope class would work directly with the UnitOfWork class, creating, storing, retrieving and disposing the UOW as required. You might want to consider deriving your scope class from UnitOfWorkScopeBase, as this will help handle lifecycle considerations (disposal and finalisation), but it's probably not a big deal either way. |
|