2

I'm using VS 2010, Entity Framework 4.3 and MySql.Data.Entity v6.3.5 to work with a MySQL DB with a couple dozen tables. I use the ADO.NET DbContext Generator.

Everything works well enough other than two tables don't get Entities created for them. Both have a similar structure in that they have a composite key composed of foreign keys to other tables. So, one is a region_flavor table that maps the (ice cream) flavors assigned to a particular sales region. It looks like so

region_flavor
-------------
RegionId INT(10) PK NN
Flavor VARCHAR(64) PK NN

RegionId is a FK to the regions table and Flavor is a FK to the ice_cream table.

There's another table with essentially the same situation.

When I do an "Update from Database", I see that there is, in the Model Browser, the table region_flavor listed under my IceCreamModel.Store\Tables / Views folder. But under my IceCreamModel\Entity Types folder there's no Entity Type.

I don't receive any .edmx errors when I do the update from the DB.

Perhaps I'm missing something here. Ideas?

I can post more info if that's helpful.

itsmatt
  • 31,265
  • 10
  • 100
  • 164
  • 1
    Perhaps this is related? http://stackoverflow.com/questions/5862352/entity-framework-compound-key-many-to-many-relationship-with-a-payload – kenrogers Feb 21 '12 at 16:34

1 Answers1

0

It is normal behavior. This is junction table used to model many-to-many relation in database. If it doesn't contain any additional column EF doesn't need to map it to entity because many-to-many relation is modeled directly and translated to table rows internally by EF.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
  • OK, thanks. I understand why this is the case now. Appreciate your clearing this up for me. – itsmatt Feb 23 '12 at 13:55
  • Interesting, checking this theory out now. Wasn't the case apparently in earlier versions of MySQL EF, in my expereince. – sobelito Dec 24 '15 at 02:56