-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to have different discriminators for the same entity type? #11890
Comments
Can you elaborate what do you mean by different types? Because there is only 1 CLR type |
I meant from business side of things they are different but are made up of the same properties that's why I haven't created their own type. What I'm trying to achieve is something like this I guess:
|
How do you plan to interpret the correct type? Suppose you are given object of CLR type |
My RootAccount has an enum property AccountType which is also the discriminator:
I mean I can totally create their own types. Maybe that's the better choice in the long run anyways (usually turns out that way). I was just wondering if there is an option to do that or if I'm missing something here. |
Hello
I was wondering if it is possible to have different discriminators for the same entity type. What I mean by that is the following:
So I have the two entities (RootAccountBE and ChildAccountBE) which both derive from AccountBE. I have two different Root Account types which have the same properties but are of a different type. So I have specified it as outlined above. It seems though that the discriminator configured last wins.
So when I query an account:
db.Set<T>().FindAsync(id)
For Account Type Test1 I get null, for Account Type Test2 I get a result. If I switch the configuration around (put Type Test2 before Test1) the result is opposite. Is there any way to specify that in a different way or do I have to create an individual class per type?
Thanks,
Serge
The text was updated successfully, but these errors were encountered: