Duck -Day 3
You can’t get too complacent in this game, I had a terrible day today, I have created 1 entity model Entities.edmx generated from the SQL db and that had been fine all day.
Suddenly it stops working and I’m getting the error:
MetadataException: Unable to load the specified metadata resource
I tried deleting and recreating the edmx file, no change. Renaming it then changing the code, still nothing. I checked the connection string, it was creating and it looked fine:
connectionString=”metadata=res://*/Entities.csdl|res://*/Entities.ssdl|res://*/Entities.msl;provider=System.Data.SqlClient;provider connection string="data source=xxxx;initial catalog=ctl;multipleactiveresultsets=True;application name=EntityFramework"” providerName=”System.Data.EntityClient”
It wasn’t looking good, so off to Google and Stackoverflow et al. I eventually came across this:
The answer that worked for me was to simply enter the assemblyname to replace the * in the connection string I then deleted and regenerated the same name edmx file in the wizard and ignored the generated connection string, but I suspect it would of worked as is and was probably just superstitious at the time.
Not sure how the problem happened, it might of been when I was regenerating the entity model.
I used to delete the model and regenerate it after a significant amount of stored procedure changes have occurred, but from now on I will only do a refresh for table changes and remove and re-add stored procedures to get the latest ones. My previous method messed up TFS anyway.
Good to see the code working again… good night.