FluentNHibernate: returning an enum from a derived property
Posted
by Zen-C
on Stack Overflow
See other posts from Stack Overflow
or by Zen-C
Published on 2010-04-13T14:35:41Z
Indexed on
2010/04/14
10:23 UTC
Read the original article
Hit count: 237
I'm using the automapping feature of FluentNHibernate and need a property that derives its return value. This property must return an Enum value, e.g.
public virtual MyEnum MyDerivedProperty
{
get
{
MyEnum retval;
// do some calculations
return retval;
}
}
Currently I get the following exception:
NHibernate.PropertyNotFoundException: Could not find a setter for property 'MyDerivedProperty' ...
If I add a setter then the database table involved requires the column to exist, even if that setter does nothing.
It works fine when the return type is an int.
Any ideas how I achieve this?
© Stack Overflow or respective owner