I'm using a specific convention for my Id tables and I'd like to override the way the ID of a specific entity is mapped. In this scenario, most of the entities should a key on the form Class+ID (ex.: EmployeeId, DepartmentId, etc), but I'd like to use a specific property for a couple of enties. So, I've added a default convention rule:
class MyPrimaryKeyConvention:IIdConvention{
public void Apply(IIdentityInstance instance) {
instance.Column(instance.EntityType.Name + "Id");
instance.GeneratedBy.Assigned();
}
}
And then, I thought I could override the mappings of the "special" EmployeeShortInfo class by doing something like this:
public class EmployeeShortInfoIdOverride: IAutoMappingOverride<Dtos.EmployeeShortInfo> {
public void Override(AutoMapping<Dtos.EmployeeShortInfo> mapping) {
mapping.Id(e => e.EmployeeId);
}
}
Unfortunately, fluent will try to use EmployeeShortInfoId instead of using the EmployeeId property. Shouldn't IAutoMappingOverride override the default convention of a class?
thanks.