When using Fluent NHinbernate How do I make a PK Read only I tried to make it internal on the setter but I get this:
—->
NHibernate.InvalidProxyTypeException :
The following types may not be used as
proxies: Domain.Address: method
set_AddressId should be
‘public/protected virtual’ or
‘protected internal virtual’
my mapping looks like:
Id(x => x.AddressId).GeneratedBy.Identity();
any Idea how to do this?
Your property AddressId should be made protected and virtual, eg: