NHibernate Inheritance - Discriminator Value

Is it possible to have a discriminator that works like this with NHibernate?

If the value is String.Empty → Class1 Else → Class2

I already have a string column for CultureName, and I would like to use it as a discriminator. I do not want to add an additional logical column. If CultureName is String.Empty, then I would like to use one class and the other -.

If this is not possible, could you please help me find a way to do this.

I use xml mappings (not Fluent NHibernate).

What I'm looking for is a bit of a wildcard for the else (default) case, so I can do the following:

<subclass name="Class1" discriminator-value="">
<subclass name="Class2" discriminator-value="*">
+3
source share
2 answers

forumla

< = ", ID = '', 1 else 2 end" / >

< name= "Class1" -value = "1" >

< name= "Class2" -value = "2" >

+7

-, , , .

0

Source: https://habr.com/ru/post/1721753/


All Articles