To extend this slightly, is there an NHibernate IsProxy method? I've looked at the NHibernateProxyHelper but nothing in there. The above almost gave me what I needed but in some edge cases I may have an initialised proxy that will pass an NHibernateUtil.IsInitialized check but still not cast to a concrete type.
I've simulated an IsProxy (I think) by comparing a current type to the NHibernateProxyHelper.GetClassWithoutInitializingProxy method : entity.GetType() != NHibernateProxyHelper.GetClassWithoutInitializingProxy(entity); but I'm a little concerned that it may fail with some edge cases to with subclasses etc. Basically, all I need to know know is "Is the current entity a proxy", regardless of whether its initalised or not. I can then use the code Diego gave me to sort out what I need to afterwards. Thanks -- 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.
