On Wed, Jul 15, 2015 at 3:22 PM, Michael Powell <mwpowell...@gmail.com> wrote:
> Hello,
>
> I am trying to map custom type, for which I've got a working IUserType
> implementation. The user type works fine in an "ordinary" mapping. Now
> I am using the same approach in a ComponentMap, yet I am experiencing
> the following exception:

Ah! Figured it out. I was confusing StatisticFlags with a language
level enum mapping. That fixed it.

> FluentNHibernate.Cfg.FluentConfigurationException occurred
>   HResult=-2146233088
>   Message=An invalid or incomplete configuration was used while
> creating a SessionFactory. Check PotentialReasons collection, and
> InnerException for more detail.
>
>   Source=FluentNHibernate
>   StackTrace:
>        at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
>        at 
> Football.Data.Repository.Hibernate.NHibernateSessionFactoryManagerBase.CreateFactory()
> in <path/>\NHibernateSessionFactoryManagerBase.cs:line 131
>   InnerException: NHibernate.MappingException
>        HResult=-2146232832
>        Message=Could not determine type for:
> Football.Models.Enumerations.StatisticFlags, Football,
> Version=1.1.0.25499, Culture=neutral, PublicKeyToken=null, for
> columns: NHibernate.Mapping.Column(Unit)
>        Source=NHibernate
>        StackTrace:
>             at NHibernate.Mapping.SimpleValue.get_Type()
>             at NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping)
>             at NHibernate.Mapping.Property.IsValid(IMapping mapping)
>             at NHibernate.Mapping.PersistentClass.Validate(IMapping mapping)
>             at NHibernate.Mapping.RootClass.Validate(IMapping mapping)
>             at NHibernate.Cfg.Configuration.ValidateEntities()
>             at NHibernate.Cfg.Configuration.Validate()
>             at NHibernate.Cfg.Configuration.BuildSessionFactory()
>             at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
>        InnerException:
>
> Could be falling over here:
>
>             Component(x => x.Criterion)
>                 .ColumnPrefix(@"Criterion");
>
> or here:
>
>             Component(x => x.Lower)
>                 .ColumnPrefix(@"Lower");
>
>             Component(x => x.Upper)
>                 .ColumnPrefix(@"Upper");
>
> Which, any of these is a "Quantity" ComponentMap:
>
>             Enumeration<StatisticFlags>(x => x.Unit)
>                 .CustomSqlType(@"ENUMERATIONFLAGS")
>                 .Not.Nullable();
>             Map(x => x.Value).Not.Nullable();
>
> Which ENUMERATIONFLAGS is a user defined data type: [VARBINARY](32).
>
> Finally. which Enumeration mapping routes through here, both for
> ComponentMap as for ClassMap:
>
> protected PropertyPart Enumeration<TEnumeration>(
>     Expression<Func<T, object>> memberExpression)
>     where TEnumeration : Enumeration<TEnumeration>
> {
>     return part = Map(memberExpression)
>         .CustomType<EnumerationUserType<TEnumeration>>();
> }
>
> I believe those are the relevant bits. The only thing I can figure is
> that somehow what I am trying to do isn't quite supported in a
> ComponentMap, but I could be wrong. I assure you, for ClassMap,
> EnumerationUserType is working just fine, but not, it seems, for
> ComponentMap.
>
> Best regards,
>
> Michael Powell

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fluent-nhibernate+unsubscr...@googlegroups.com.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
Visit this group at http://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.

Reply via email to