❔ How to make categories correctly?
I need to make a category in such a way that each can be inherited. I have this model:
Unfortunately, I'm having a big problem making an efficient query in EF Core. Did I do the model right?
2 Replies
why is there two IDs?
generally, the best way to model details is to have every field of every of type of detail be sparse and nullable and in a single table (denormalized). look up some stuff on inheritance performance in efcore, it's related to this problem, they describe the different ways of storing these things
making each category be in a separate table (like you did it) is the worst way performance wise
albeit the most normalized and logical from the standpoint of relational database theory
also, even if you do it your way, you don't need the id of the category detail, you can make it use the id of the category as its own, since there's gonna be a one to one relationship
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.