I have an interface named IEntity which till now has one concrete class named Entity, this interface has a read only property. I’d rather to map the interface,but because an interface cant have a private field,i cant use option camelcase field with prefix option to map it,so what can I do?
public interface IEntity
{public readonly string Name{get;} }
public class Entity:IEntity
{public readonly string Name{get;}}
public class EntityMap:ClassMap<IEntityMap>
{
//how to map the readonly property
}
Try:
NHibernate Read Only Property Mapping
and if you use Fluent:
Mapping a read-only property with no setter using Fluent NHibernate
I think this can be useful too:
How to map an interface in nhibernate?
updated
I think a first step is correct your code. Then try to post your mapping file or fluent configuration. We cannot help you if it is not clear what you want to achieve.