I did this at first too -- basically using NH and Repository to pass
me data and ignoring UoW.

The reason I stopped was because I hated having to keep track of what
to update during request.

I want to say:

var order = repository.GetOrder(id);
order.SomeUpdate(message);

and be done, not having to track everything SomeUpdate touches (order
line items, customer, product, etc) in order to do explicit
session.update on them.  I just do commit / flush after I'm done and
the session does all my work for me.

I do ASP.NET MVC so a session per request (via structure map) and it
works okay for me.  I guess I could abstract session to some UoW but
I'm always going to use NH and session has what I need (I don't know
if this is bad pattern).

On Jul 8, 12:50 pm, "Dotan N." <[email protected]> wrote:
> i've considered all that have been said before asking, this is what i know:
>
> lazy loading - i found that in WCF / service like context, where everything
> is percall, and that i would like to minimize state as possible as i can, i
> want to be able to have fine granularity over lazy loading or no lazy
> loading at all. this is because i would like to know and decide where my
> objects are materialized and i want to constrain that to a certain layer.
>
> two repositories, or cross repository transaction - thats true, i agree the
> session should be exposed in order to wrap transaction over them
>
> why would repository know there is a concept of a session - maybe only the
> repository should know, and if someone wants to impl. a new one, he has the
> interface. so on the contrary - why should the *application* know that there
> is a concept of a session?
>
>
>
> On Wed, Jul 8, 2009 at 6:24 PM, epitka <[email protected]> wrote:
>
> > Ask yourself, why would your Repository even have to know that there
> > is a concept of session?
>
> > On Jul 8, 9:21 am, "Dotan N." <[email protected]> wrote:
> > > Hi all,
>
> > > I remember reading a post from Ayende that stated that if he sees code
> > where
> > > someone opened session inside each persister method, he doesn't know how
> > to
> > > use NH.
> > > So after implementing various method to manage Session myself, and i've
> > > steered clear of what Ayende recommended not to do, i've now exposed my
> > self
> > > to linq2sql and
> > > i couldn't see any special considerations to handle its form of session
> > > there.
>
> > > So what is wrong with opening session in repository?
--~--~---------~--~----~------------~-------~--~----~
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