I think in the past I've bubbled up a call to GetType() from a virtual method on my entity. That way it will return the unproxied type even when called on a proxy. I'm fairly sure that still works though I'd need to test it.
On Tue, May 15, 2012 at 2:09 PM, David Corbin <[email protected]>wrote: > I typically use IsAssignableFrom(...) as it provides the widest coverage. > > > On Tue, May 15, 2012 at 8:55 AM, Joseph Lam <[email protected]> wrote: > >> In .Net there are several ways to perform type checking: >> - the 'is' keyword >> - Type.IsAssignableFrom() >> - Type.IsInstanceOfType() >> >> What confuses me is the proxying in NH which affects things such as >> myEntity.GetType() (which returns you a proxy type instead of the actual >> entity type), and depending the lazy loading and proxying configuration, >> one will see different behaviors in different scenarios. We use the 'is' >> keyword a lot and it has been working fine with NH 3.0/3.1, but starts to >> fail in some cases with NH3.2/3.3. It is really frustrating and make >> upgrades very difficult. >> >> Is there any good documentation around polymorphic behaviors and type >> checking for NH (especially 3.3)? Or how do people usually do it? >> >> Regards, >> Joseph >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/nhusers/-/1B29IwTfMjMJ. >> 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. >> > > -- > 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. > -- 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.
