Hi,
I don't think NHibernate can do that unless you use the standard access="property" for the identifier. Otherwise NHibernate isn't aware of the accessor (int Number {get;}).
If you change the access to 'property' (the default), then the problem should go away. If you're worried about giving clients access to the mutator (the setter), then the mutator can be marked as protected.
Code:
<id name="Number" column="number_">
Code:
private int _number;
virtual public int Number
{
get { return _number; }
protected set { _number = value; }
}
Regards,
Richard