Automapping control of values in discriminator column
When using Automapping, the full class name, including the namespace, is used as the default value in the discriminator column. I know this can be overridden individually with either fluent mappings or hbm mappings, but I'd like to know if there is a way to configure the Automapper to generate these values differently. I'd like it to use the unqualified class name (without the namespace). Is there currently a way to do this?
Support Staff 2 Posted by James Gregory on 19 May, 2010 02:04 AM
That should be easy. If you haven't already, have a read up on our conventions; specifically, have a read of writing your own conventions.
What you need in this case is an
ISubclassConvention
, which will allow you to control the discriminator value for subclasses.Here's the convention you'll need:
Here's how you hook it up to your automapping:
There are other methods available on the
Conventions
property, if you've got more than one you need to add.