Is there a more efficient approach to update Entity Models (*.edmx files)?

entity-framework entity-model project-management visual-studio


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.

10/2/2009 10:39:19 PM

Accepted Answer

As far as I can tell EdmGen will only work for WPF apps. Since you are looking to update a .EDMX file you will not have access to the xml files which the EdmGen tries to validate.

I would suggest checking the The ADO.NET blog:

They have an explination of how to update an EDMX file but it is pretty involved. Hopefully VS10 will have a better solution for this.

10/5/2009 9:22:40 PM

Popular Answer

Check out the EDM Generator

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.

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow