0

I have the following DB tables: Operation Parameter OperationToParameter (has 2 foreign keys to previous tables, both foreign keys are declared as PK as well)

I updated my EF model from DB . It created me Operation and Parameter entities, the OperationToParameter it created as association between the 2 tables with many to many relation as i need. The thing is when i am trying to do SaveChanges (my changed object is ParameterDefinition which has navigation to Operation and Parameter entities ) it throws exception- Unable to update the EntitySet '[Table Name]' because it has a DefiningQuery and no element exists in the .

how can i solve this?

user1616144
  • 43
  • 1
  • 1
  • 7
  • Sounds like you've done it correctly. You may want to check this out anyway just to be sure: http://stackoverflow.com/a/7583791/1099260 – Quinton Bernhardt Sep 07 '12 at 13:20
  • It doesn't help. I tried to add InsertFunction to ModificationFunctionMapping section in the edmx file. but still the same error – user1616144 Sep 07 '12 at 14:07
  • It sounds like the primary keys haven't been defined correctly in the .edmx. Have you tried removed all entities from the .edmx and update model and add tables again...If that doesn't work include an image of the model perhaps. – Quinton Bernhardt Sep 07 '12 at 14:40
  • well, the InsertFunction wasn't properly defined. i fixed it and now it works. now need to write the Delete function – user1616144 Sep 07 '12 at 15:16

1 Answers1

0

This might happen because your table doesn't have primary key

Boies Ioan
  • 892
  • 8
  • 12