ah... and the trick is the abstraction of UoW because you can implements UoW
including using pure ADO.NET (if you are using NH the UoW is the nh-session
itself).
I don't know if it can help you but...
http://fabiomaulo.blogspot.com/2009/01/aspect-conversation-per.html


2009/3/17 Fabio Maulo <[email protected]>

> Probably the definition of the pattern will help you"A Unit of Work keeps
> track of everything you do during a business transaction that can affect
> the database." http://martinfowler.com/eaaCatalog/unitOfWork.html
>
> Note : business transaction
>
> 2009/3/17 gavin.schultz <[email protected]>
>
>
>> I've read an awful lot about unit-of-work and sessions and so on, and
>> watched Ayende's excellent webcast about App Architecture, but I'm
>> still getting confused. There seem to be conflicting pieces of advice.
>> For instance it is said (paraphrasing here):
>>
>> * NHibernate allows you to design your business entities & services so
>> that they have no knowledge of NHibernate or sessions; in other words,
>> they are not coupled at all with the way in which the data is
>> persisted.
>>
>> That sounds just wonderful, but then I read:
>>
>> * DO NOT open a new session for each of your repositories, or for each
>> of the calls within the repository. Instead use a context-based
>> session outside the repository. Such as the Unit Of Work e.g. the one
>> in Rhino Commons.
>>
>> And that sounds perfectly fine too, because hey, ideally I'd like to
>> work on my objects without opening new sessions all the time, and give
>> the ability to do transactions across different repositories, and so
>> on.
>>
>> But hang on, doesn't that mean that we're putting the Unit Of Work
>> classes up in the business entities and services? And doesn't that
>> mean that we're coupling the business layer to the persistence layer
>> in the end? In particular aren't we coupling the business layer to
>> NHibernate (since it seems everywhere we talk about Unit Of Work, we
>> really mean an NHibernate session wrapper)? Or do we not consider the
>> Unit Of Work to be part of that layer, do we think of it as some kind
>> of business abstraction?
>>
>> We all seem very strict about setting the boundaries between what the
>> different layers can access, but I'm unclear about where the Unit Of
>> Work fits into those layers - does it basically cross-cut everything?
>>
>> Sincerely confused and grateful for any advice,
>>
>> Gavin
>>
>> >>
>>
>
>
> --
> Fabio Maulo
>



-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to