Hi Graham, I'm a little new to NHibernate but I just stumbled across this wiki entry that may have your IsProxy method: (entity is INHibernateProxy) link: http://nhforge.org/wikis/howtonh/finding-dirty-properties-in-nhibernate.aspx
Brian On Mar 9, 3:07 pm, Graham Bunce <[email protected]> wrote: > 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.
