Reputation: 23
I just upgraded my .net windows apps from nHibernate 1.2 to 3.3 but having an issue now. During runtime, it throws the following error:
A first chance exception of type 'NHibernate.InvalidProxyTypeException' occurred in NHibernate.dll NHibernate.InvalidProxyTypeException: The following types may not be used as proxies: CallType : method Equals should be 'public/protected virtual' or 'protected internal virtual' .....
Here's the class:
public class CallType : DomainObject<int>
{
public virtual String Description
{
get;
protected set;
}
public virtual String Name
{
get;
protected set;
}
public CallType()
{}
public override int GetHashCode()
{
return string.Format("{0}|{1}", Description, Name).GetHashCode();
}
}
Did I miss anything? All members are public virtual. Lazy loading is required in this application
Upvotes: 2
Views: 480
Reputation: 4120
You are inheriting from DomainObject. I suspect this class has a method Equals in it, and it is probably not set to virtual.
The constructor CallType does not need to be virtual as some people mention.
Upvotes: 4