Prevent mapping all public members of a class in Fluent NHibernate

Posted by alimbada on Stack Overflow See other posts from Stack Overflow or by alimbada
Published on 2010-04-29T17:10:02Z Indexed on 2010/04/30 8:37 UTC
Read the original article Hit count: 212

Filed under:
|
|
|

I have a class generated from a WSDL that has a bunch of public properties and a public event. I'm extending this class with my own and adding some properties to it. All of my own properties are declared virtual, but the base class properties are not virtual.

I'm using Fluent NHibernate's ClassMap to map only the properties from my extended class. How do I prevent (Fluent)NHibernate from trying to persist all the base class's public members?

At the moment, I get the following exception when creating the ISessionFactory:

NHibernate.InvalidProxyTypeException: The following types may not be used as proxies:

Type: method get_<BaseClassProperty> should be 'public/protected virtual' or 'protected internal virtual'

Type: method set_<BaseClassProperty> should be 'public/protected virtual' or 'protected internal virtual'

...

Type: method add_<BaseClassEvent> should be 'public/protected virtual' or 'protected internal virtual'

Type: method remove_<BaseClassEvent> should be 'public/protected virtual' or 'protected internal virtual'

© Stack Overflow or respective owner

Related posts about fluent-nhibernate

Related posts about nhibernate