Nhibernate 3.2 no-proxy Specified method is not supported

94 views
Skip to first unread message

sianabanana

unread,
Jul 30, 2012, 5:26:02 AM7/30/12
to nhu...@googlegroups.com
Hi
 
In a previous project i have used nhibernate 3.1 and used the no-proxy function to stop child references being loaded as a proxy type.
 
The proxy type is a pain when using inheritance and discriminator columns as you cant do a "is Class..." query on them.
 
In a new project i am doing, i have added inheritance and needed to do this query so added the no proxy mapping.
 (im using fluent nhibernate and use .LazyLoad(Laziness.NoProxy) method in my mapping).
 
As soon as this is added this method to the mapping i get a horrible "System.NotSupportedException: Specified method is not supported." exception.
 
Im using the Castle proxy provider if that makes a difference.  I tried removing this from my configuration but i still get the same error.
 
Has something changed in 3.2 that i need to configure differently? 

Ricardo Peres

unread,
Jul 30, 2012, 7:19:36 AM7/30/12
to nhu...@googlegroups.com
NHibernate 3.2 no longer uses the {Castle,Spring,LinFu} proxy providers, instead, it uses it's own internal proxy provider. That explains why removing it from your configuration does not change anything.
All methods and providers of your class must be now virtual, are you aware of this change? Otherwise, you can set the following property on the Configuration object:

cfg.SetProperty(NHibernate.Cfg.Environment.UseProxyValidator, Boolean.FalseString);

RP
Reply all
Reply to author
Forward
0 new messages