Unfortunately this doesn't work because ICompositeUserType doesn't derive from IUserType and therefore the generic constraint on UserTypeConvention is not satisfied:
The type 'TestProject.Data.NHibernateMaps.MoneyUserType' cannot be used as type parameter 'TUserType' in the generic type or method 'FluentNHibernate.Conventions.UserTypeConvention<TUserType>'. There is no implicit reference conversion from 'TestProject.Data.NHibernateMaps.MoneyUserType' to 'NHibernate.UserTypes.IUserType'. On Mar 23, 11:28 pm, James Gregory <jagregory....@gmail.com> wrote: > Instead of IUserTypeConvention, try deriving from the base-class > UserTypeConvention, see if that makes any difference. > > You should be able to do what you've written as: > > public class MoneyTypeConvention > : UserTypeConvention<MoneyUserType> > {} > > On Mon, Mar 23, 2009 at 11:16 PM, James <james.freiwi...@gmail.com> wrote: > > > I'm having trouble mapping composite user types with the new style > > conventions. > > > I've done the following: > > > public class MoneyTypeConvention : IUserTypeConvention > > { > > public bool Accept(IProperty target) > > { > > return Accept(target.PropertyType); > > } > > > public void Apply(IProperty target) > > { > > target.CustomTypeIs(typeof (MoneyUserType)); > > } > > > public bool Accept(Type type) > > { > > return type == typeof (Money); > > } > > } > > > However I'm still getting: > > NHibernate.MappingException: Could not determine type for: > > TestProject.Core.Model.ValueTypes.Money, TestProject.Core, > > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, for columns: > > NHibernate.Mapping.Column(Price) > > > Not really sure where I'm going wrong. I'm setting up my mappings as > > follows: > > > AutoPersistenceModel mappings = AutoPersistenceModel > > .MapEntitiesFromAssemblyOf<TestModelClass> > > () > > .Where(GetAutoMappingFilter) > > > .ConventionDiscovery.AddFromAssemblyOf<AutoPersistenceModelGenerator> > > () > > .WithSetup(GetAutoMappingSetup) > > .UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator> > > (); > > > Any help would be much appreciated. > > Thanks, > > James. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---