2

I'm trying to convert from fluent nhibernate to the build in mapping by code (Loquacious) in 3.2 now using 3.3 of nhibernate.

The problem I have is conditional mapping of the Id column depending on type.

I'm now using something similar to this which assumes the entity id is of type guid.

var mapper = new ConventionModelMapper ( );
mapper.BeforeMapClass += ( modelInspector, type, map ) =>
{
    map.Id ( k =>
    {
       k.Generator ( Generators.GuidComb );
       k.Column ( type.Name + "Id" );
    } );
};

How can I configure/setup for when an entity is using a string (default as assigned)?

Do I have to override with custom mappings for all entities not using guid as an id?

0 Answers0