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:

http://stackoverflow.com/questions/689355/metadataexception-unable-to-load-the-specified-metadata-resource

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.

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter
Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

One Response to “Duck -Day 3”

commenter

Hi Jose9,The only way to do this currently is to gteerane an EDMX and then have EF load that EDMX instead of building the model from code each time. You can gteerane the EDMX from a Code First model using the EdmxWriter class. I believe that the EF Power Tools can also do this. Once you have an EDMX you can add it to your VS project as an existing item and then you would reference it using a Database First -style EF connection string. Hopefully you can figure out the details. Let me know if you get stuck.The other thing to check is that it is the model building that is taking the time and not view generation. You might want to look into using pre-generated views if you haven’t already.Thanks,Arthur

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Content

Stay in contact!

Email Dave Riley
Dave Riley's Linkedin Profile
Dave Riley's Facebook Profile
Dave Riley's Twitter Profile
Dave Riley's Plaxo Profile