Is there a better way to refresh Entity Models (*.edmx files)

Jeremiah picture Jeremiah · Oct 3, 2009 · Viewed 7.5k times · Source

I need to refresh a bunch of EDMX files in my solution. We have disected our tables into groups and each model represents one component or process. However, there are some overlapping tables, which means sometimes I need to refresh/update multiple Entity Models.

Refreshing a group of different entity models in VS 2008 is slow and dangerous. If I miss an out-of-date model, my application won't work

I need to verify that all of the models in my solution are up to date with my development database.

Ultimate solution: How can I script this? Is there an API to Visual Studio for refreshing an EDMX file? I do the exact same thing every time. Can't I program this?

Ok Solution: Can I set something up in Visual Studio to inform me when an Entity Model doesn't match a DB? What is the recommended way to test the model against a DB?

Thanks in advance.

Answer

willbt picture willbt · Oct 3, 2009

Check out the EDM Generator http://msdn.microsoft.com/en-us/library/bb387165.aspx

You could put in a pre-build event to regenerate the model. It's also wise to pre-generate the Views which increases performance substantially.

Hope this helps.