I'm using EF 3.5 SP1.
I have 3 tables:
- Pendants
- PendantAccessories
- PartsData
Basically #1 and 2 are used for product selection, so #1 has a "Number of Buttons" property and other options. #2 has fields like "Cable Type" etc.
The third table contains property information for all of our parts, such as what plant it's manufactured in, it's weight etc.
What I'm trying to do is set up an association between #1 and #3 and also between #2 and #3. The PK in all 3 tables is 开发者_高级运维the PartNumber.
I set it up between #2 and 3 by going into Mapping Details and adding a Maps to PartsData and mapping the columns. Everything worked good.
I then tried the same thing between #1 and 3.
However, now when I compile I get "Error 3033: Problem in Mapping Fragment starting at line 713: EntitySets 'pendants' and 'pendantAccessories' are both mapped to the table 'PartsData'. Their Primary Keys may collide."
Does anyone know what I'm doing wrong here?
Not sure what I did wrong, but I found a work around, which is actually what I probably should have done in the first place.
I thought I had defined FKs in the DB, but, at least for these 3 tables, I didn't. So I defined them, removed my model and re-created it (since Update from Database doesn't seem to work.)
Now it's all up and running.
精彩评论