1

I have a stored proc which is called through EF. Everything was working fine until the table result, returned by the proc was edited (a column was reduced).

I tried to update/refresh and even deleting and adding the proc model from the model browser. However I'm still getting the old field in the .edmx file.

This causes a runtime exception because the field isn't really there anymore. I'm out of ideas and still an EF noob.

Any insight on this, thanks in advance?

note that I've checked the connection strings and everything is as it should be

Jonny
  • 2,787
  • 10
  • 40
  • 62
  • I think more details are required here: mapping details, stored procedure code, ... – Gerrie Schenck Sep 23 '13 at 11:53
  • do you get any error or warning after the model updates? I had same issue, for me the EDMX was locking out for some reason and couldn't get the update. – johnny Sep 23 '13 at 11:57
  • hmm ... I'll try add and that but the proc is quite complex and it's building an sql statement dynamically and executing it using: sp_executesql. – Jonny Sep 23 '13 at 11:57
  • @Jaan Nope everything is fine. Only at runtime a get an exception – Jonny Sep 23 '13 at 11:58
  • @Jaan how did you solve the problem? – Jonny Sep 23 '13 at 11:59
  • I didn't do anything special I tried closing VS few times didn't help, then I had to delete the EDMX FILE and recreate it. after deleting it worked. When dealing with EDMX there are a lot of random issue but with different solution each time. I dont know deleting and recreating is an option for you but if possible give it a try. – johnny Sep 23 '13 at 12:07
  • what version of EF and VS are you using? check for the xml file of your model and trying deleting it too. – johnny Sep 23 '13 at 12:11
  • http://stackoverflow.com/questions/12780389/entity-framework-error-error-11009-property-is-not-mapped check here for more help. – johnny Sep 23 '13 at 12:12
  • I guess that your SP is mapped to a ComplexType object. If so, EF will only change the model in case of added column. Try to delete the correponding ComplexType in your EDMX, go to your Model Browser, edit the mapped SP and refresh the result. It should create a new ComplexType object with the right set of properties. – MaxSC Sep 23 '13 at 12:12
  • Have you tried deleting your .edmx file and creating it again? – Marciano.Andrade Sep 23 '13 at 12:24
  • @Marciano.Andrade unfortunately it is not an option for me – Jonny Sep 23 '13 at 12:25

1 Answers1

0

Quick and dirty solution : try to edit the edmx file with a text editor and remove manually the relevant column.

schglurps
  • 1,387
  • 1
  • 14
  • 26