if i have a convention for mapping ids that is how i generally map that uses the hilo generatior on an int Id property with an int Id column:
public class IdConvention : IIdConvention
{
private const int HiLoRange = short.MaxValue;
public void Apply(IIdentityInstance instance)
{
instance.Column(instance.EntityType.Name + "Id");
instance.GeneratedBy.HiLo(HiLoRange.ToString());
}
}
but i have a class i want to map differently, with an assigned string as the Id instead, i use an override:
public class SomeClassMapping : IAutoMappingOverride<SomeClass>
{
public void Override(AutoMapping<SomeClass> mapping)
{
mapping.Id(instance => instance.StringProperty).GeneratedBy.Assigned().Column("StringProperty");
}
}
this worked in older versions of FluentNHibernate/NHibernate, but when i update to 1.3.0.733/3.3.2.4000, i now fall victim to an unhandled exception:
System.InvalidOperationException: Identity type must be integral (int, long, uint, ulong)
this only happens if i’m trying to use a string (or some other non-integral property as the Id) should i expect that i’m no longer able to override a mapping and give a different generator and type, or is there something i can do differently to make the override hide that i want to do hilo in the general case?
looks like the order of execution changed. an easy fix would be to