I'm currently working on an MVC 3 project which uses Fluent NHibernate. I utilise the System.DayOfWeek enum but when mapping this I received the following error -
Stack Trace:
[MappingException: Could not determine type for: DayOfWeek, for columns: NHibernate.Mapping.Column(WeekStart)]
NHibernate.Mapping.SimpleValue.get_Type() +456
NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping) +40
NHibernate.Mapping.PersistentClass.Validate(IMapping mapping) +123
NHibernate.Mapping.RootClass.Validate(IMapping mapping) +24
NHibernate.Cfg.Configuration.ValidateEntities() +280
NHibernate.Cfg.Configuration.BuildSessionFactory() +43
FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() +54
[FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory.
Check PotentialReasons collection, and InnerException for more detail.
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.0.30319.272
Example usage -
Map(x => x.WeekStart).CustomType(typeof(DayOfWeek));
I've seen this specific question asked on mailing lists and on stackoverflow but the nuances of it never seemed to be fully grasped and the person asking the question is referred to how to use a custom type mapping.
I am well aware of how to use the customtype functionality on fluent maps and frequently make use of it. However I don't understand why this enum in particular cannot be mapped. I presume it has something to do with the System namespace to which it belongs?
If anyone can shed any light on this I'd be most happy.
Thanks