Well, not really... I have one project with NHibernate 3.3.2 (from Nuget) where the problem does not occur, and another using trunk where it does. This also passes:
Debug.Assert(o is IProxy); Debug.Assert(o.Customer is IProxy); Debug.Assert(o.Customer == session.GetSessionImplementation().PersistenceContext.Unproxy(c)); and this fails: Debug.Assert(o.Customer is INHibernateProxy); It seems to me that session.Load<T> is now returning an unproxied instance. However, its type is CustomerProxy. Like I said, I'm not sure this is a bug or not... but it seems so, since there are two instances managed by NHibernate who point to the same record of the same entity. RP On Monday, February 11, 2013 6:17:10 PM UTC, Oskar Berggren wrote: > > I don't know anything specifically about this. Can you pinpoint the > exact revision where the behavior changed? > > /Oskar > > > 2013/2/10 Ricardo Peres <[email protected] <javascript:>>: > > Hi, Oskar! > > > > I just came across something weird with the latest trunk version: > > > > Customer c = session.Load<Customer>(1); //Customer is lazy, so a > proxy > > is returned > > Order o = session.Get<Order>(1); //Order is lazy, but > I'm > > loading it explicitly > > Debug.Assert(c is IProxy); //OK > > Debug.Assert(o is IProxy); //OK > > Debug.Assert(o.Customer is IProxy); //OK > > Debug.Assert(o.Customer == c); //failure > > > > In recent versions (3.x), there was no failure, I have just checked. All > > entities are lazy and the Customer property is mapped as NoProxy (which > is a > > proxy anyway). > > My question is: shouldn't the instance returned by Load<T> and the > Customer > > property be the same? > > I'm not sure this is an error, but it is a change from previous versions > - I > > had this Assert since always, and it never threw. > > > > Thanks! > > > > RP > > > > -- > > > > --- > > You received this message because you are subscribed to the Google > Groups > > "nhibernate-development" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected]<javascript:>. > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- --- You received this message because you are subscribed to the Google Groups "nhibernate-development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
