I have some misunderstanding how my objects should be represented in a relational db structure.
For example if I have a simple tables structure that looks like that:
And if I generate an Entity Framework model based on that, it would be look like:
As you can see it's many-to-many association. (Any Dish contains many Ingredients, any Ingredient can be used in many Dishes)
Now, what if I need some additional parameters, like quantity of the Ingredient in a Dish? (Of course it usually would be distinct number for each ingredient in any different Dish).
If I add some additional columns directly to Dish_FooIngridient
table, it breaks nicety of automatic model generation, and then I have to fix associations manually in EF model designer and later use some cumbersome queries to operate with objects. Because it will be generated into something like this:
As you can see, now there are other redundant properties, which I don't need. Is there any better way to manage that? Maybe using complex properties or inherited entity, or something else?