EF DB is the first card mess

I have a frustrating situation due to this little EF quirk. Here is a simple demonstration of behavior. First DB schema:

enter image description here

As you can see, RestrictedProductthis is a special case of the product, which I intend to make a subclass Productwith some special code.

Now I import into the EF data model:

enter image description here

Oops! EF saw that it RestrictedProducthad only 2 fields, both FK, so he compared it as a one-to-many relationship between Productand Restriction. So I go back to the database and add a field Dummyto RestrictedProduct, and now my EF model looks much better:

enter image description here

But this field is Dummystupid and pointless. Maybe I can remove it? I delete the field from the database table and entity model, then update the model from the database ...

enter image description here

, ! Product-Restriction (RestrictedProduct1)! , :

3034: , (x, y): . , AssociationSet .

, Dummy RestrictedProduct?

+5
2

, RestrictedProduct RestrictedProduct.RestrictionId , EF . , " " . , .

+2

.

, , - .

, , .. 1 , , ! - , .

EF 1- : 1. 0 1 . 2. - , .

.

+1

All Articles