I'm trying hard to find a solution to be able to override the automapping of my entity.
The flow of execution is that AutoMapping (using conventions) occurs first and then mapping overrides are executed.
My entity "Signature" is already mapped by automapper (do not confuse with Automapper library!) and I want to change the db type of some columns.
If I do something like this:
public class SignatureMap : IAutoMappingOverride<Signature>
{
public void Override(AutoMapping<Signature> mapping)
{
mapping.Map(x => x.SignType).CustomSqlType("character varying");
mapping.Map(x => x.Status).CustomSqlType("integer").Nullable();
}
}
I get NHibernate errors with NpgsqlParameterCollection
(index out of range) when trying to execute an insert to the table.
This probably occurs because the mapping.Map
function just adds another mapping to the collection instead of overriding one that already exists (I examined the FluentNHibernate source code).
What is the proper way to override the Sql type using IAutoMappingOverride
?