Where to Implement Unit of Work pattern?

  • Thread starter Thread starter steven
  • Start date Start date
S

steven

I'm considering implementing the Unit of Work pattern that is in
Fowler's PoEAA book.

First, two assumptions:

1. It's per session thus must be a singleton.
2. I will store it in session.

Now, where is the best place to initialize this unit of work? I'm
thinking in an http module and placing it on a running thread using
CallContext. Then it should be available to my middle-tier.

Can anyone verify I'm on the right track or offer suggestions? Thank
you.
 
steven said:
I'm considering implementing the Unit of Work pattern that is in
Fowler's PoEAA book.

First, two assumptions:

1. It's per session thus must be a singleton.
2. I will store it in session.
[...]

I wouldn't put in the session -- this tightly couples your BLL/DAL with your
Web UI layer, which is a no-no. You couldn't even run a simple NUnit test
for your Unit of Work.

Why not follow Fowler's suggestion and use a thread-local Registry? Or is
your middle layer only accessible through remoting?

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top