Fluent NHibernate mapping for enum is inpropery generated
Posted: Fri 19 Apr 2013 07:19
When using Enum with NHibernate fluent mapping, there is inproper mapping generated. Cannot be compiled wuth NHibernate 3.X.
If enum is primary key:
should be:
if enum is normal field:
should be:
If enum is primary key:
Code: Select all
CompositeId()
.KeyProperty(x => x.Section, set => {
set.Type("ExportDefColumnSection"); // bad! Does not compile by NHibernate
Code: Select all
CompositeId()
.KeyProperty(x => x.Section, set => {
set.Type(typeof(Anete.Common.Data.Nh.Entities.ExportDefColumnSection)); // ok
Code: Select all
Map(x => x.ReaderDeviceType)
.Column("typ")
.CustomType("ReaderDeviceType")) // bad!
Code: Select all
Map(x => x.ReaderDeviceType)
.Column("typ")
.CustomType(typeof(Anete.Common.Data.Nh.Entities.ReaderDeviceType)) //ok