And by the way,
In NPerist, I use multiple Contexts in one application, targeting
different domains/databases (Context is the equivalant of NHibernate
Session).
I don't know if that's even possible in NHibernate, but in that case I
have to ask the entity to which session it belongs to, and not the
SessionFactory
.

On Sep 23, 8:20 pm, Harm Neervens <[email protected]> wrote:
> I want this because my entities are POCO, and bu that I mean real
> Persistance Ignorant.
> I have code in my entities that references ISessionFactory, I create a
> dependancy to the NHibernate framework, and that's not what I want.
> I'm building an abstraction layer between my domain model and the ORM.
> In that way we can change ORM framework whenever we want (just by
> adjusting some configuration settings).
> Some of our customers prefer NHibernate, other Entity Framework or
> NPersist.
>
> When I always have proxies, then in my base class I can use code like:
>
>             if (entity is INHibernateProxy)
>             {
>                 (entity as
> INHibernateProxy).HibernateLazyInitializer.Session.Load<T>..... etc
>             }
>
> and in case of NPersist:
>
>             if (entity is IInterceptable)
>             {
>                 (entity as
> IInterceptable).Context.GetObjectById<T>....etc
>             }
>
> Harm.
>
> Until now (I mean for almost 5 years) I used NPersist. This is an ORM
> developed by Mats Helander and Roger Alsing (www.puzzleframework.com).
> Because the development has stopped, and there's no active community,
> I started to look at NHibernate. Another reason is that more and more
> customers are asking for it.
> In Entity Framework 4, there will also be POCO support, so in the
> future my abstaction layer will also support EF.
> Maybe it's a bit clearer now to you why I always want proxies for my
> entities.
>
> On Sep 23, 5:39 pm, José F. Romaniello <[email protected]> wrote:
>
>
>
> > > When I have no proxy, I cannot cast my object to IInterceptor and so I
>
> > will never get to my session/context object within my entity.
>
> > Well.. I have to much questions. Why do you need to do that?
> > Is not a good way to get the current session by far.
>
> > Inject ISessionFactory and use GetCurrentSession().. is a normal approach.- 
> > Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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