I guess I need to clarify what I said, or better said correct it.

In my opinion, your repository should not be opening or closing
sessions, and your concrete implementation of the repository should
have access to "session" object. Here is what I do:

1. In my domain I define IRepository per aggregate root
2. In my  "DAL" layer I have I have generic repository as base class
that has only Get, Save, Delete
3. For each defined interface in domain I have concrete implementation
that is aware of the session.
4. I have HttpModule that handles opening and closing of the session
per request, or per conversation.


On Jul 8, 12:17 pm, Oskar Berggren <[email protected]> wrote:
> 2009/7/8 Dotan N. <[email protected]>:
>
> > 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.
>
> With this I agree - my nhibernate-specific implementations of my
> repository interfaces always deal with the ISession. Either some sort
> of contextual session (GetCurrentSession()) or by injecting a session
> when the repository is instantiated.
>
> > so on the contrary - why should the *application* know that there
> > is a concept of a session?
>
> My application knows about its various use cases and UnitOfWorks - an
> individual repository does not. In this case I take application to
> mean that which takes your various parts (e.g. persistance, domain
> model, business rules, infrastructure) and actually causes the parts
> to move together to actually do something useful. It could be the
> Application class in ASP.Net. For example it could be a web service
> interface or some other service style interface, where each method
> correspond to a UnitOfWork.
>
> /Oskar
--~--~---------~--~----~------------~-------~--~----~
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