Applying Unit Of Work pattern
Asked Answered
W

1

6

I have read in Patterns of Enterprise Application Architecture that a Unit Of Work should only be used in a single Session. So each session should have its only Unit Of Work. Can anybody tell me why I could not use one Unit Of Work for the whole application (in my case ASP.NET).

Wachtel answered 23/10, 2008 at 13:2 Comment(0)
R
7

Half of the unit of work pattern is to keep track of changes in a transaction and you could certainly track that for an entire application (this seems to be pretty common) but the other half is the resolution of concurrency problems which becomes meaningless if you are applying the pattern to the entire application rather than on a per session level.
Also, at some point you have to decide "Hey this is a unit...time to commit" and that might be difficult when taking the whole application into account with different users doing different things at the same time.

Roil answered 23/10, 2008 at 13:38 Comment(1)
Well, for now this answer is satisfying, but maybe I'll post another question and explain a little bit my problem. Thx.Wachtel

© 2022 - 2024 — McMap. All rights reserved.