Preventing NHibernate foreign key creation for <any> mapping
-
01-10-2019 - |
Question
Is there a way from preventing SchemaExport from generating a foreign key constraint on mapping type? I saw a similar question about mapping, but unfortunately that wont do for . I couldn't find answer to this in NHibernate reference, but maybe someone knows a trick? I'd like to avoid removing constraint afterwards.
Solution
Could you post your mappings? <any>
definitely does not create foreign keys.
Example:
<any id-type="Guid" meta-type="Int32" name="FooBarOrBaz">
<meta-value value="1" class="Foo" />
<meta-value value="2" class="Bar" />
<meta-value value="3" class="Baz" />
<column name="FooBarOrBazId" />
<column name="FooBarOrBazType" />
</any>
This will just create two columns (FooBarOrBazId and FooBarOrBazType), with no FKs
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow