I'm just getting up to speed with NHibernate 3.2 and its "mapping by code" feature, and migrating our Fluent mapping over to it. Is there an equivalent of the fluent "ReadOnly();" function, to make the entire mapping read only? Thanks in advance.
Use Mutable(false) in the mapping.
Read this post for corresponding hbm file mapping from where I could infer this.
http://davybrion.com/blog/2007/08/read-only-data-in-nhibernate/
Use PropertyMapper action to define access style:
public class EntityMapping : ClassMapping<Entity>
{
public EntityMapping()
{
Id(m => m.Id, map => map.Generator(Generators.HighLow));
Property(m => m.Name, map => map.Access(Accessor.ReadOnly));
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With