Add stored procedure to entity framework model (.edmx) without refreshing existing entities

c# entity-framework entity-framework-6


I have a stored procedure in development environment that I want to add to EF data model (.edmx) and call it in my code through a method wrapper that EF creates.

Our development environment is not 100% in sync with production one so when I try adding the stored procedure deployed to development environment using "Update Model From Database" menu option all existing entities in the model get refreshed and extra properties are added to some of them.

I am trying to find a way to add the stored procedure without refreshing existing entities in the model so I don't get development and production differences into it.

Any idea how to achieve this?

Update 1:

After looking around and trying different things I came to a conclusion that the easiest way to do this would be to update the model pointing at development environment and then pointing at production. If there are differences between them you would see errors in Visual Studio saying the property mapping is missing, all you have to do is to find those properties and remove them from the model.


You can do what @Jonathan Amend suggested which should work fine as well just a little bit more work.

10/24/2014 2:35:59 PM

Popular Answer

Why don't you update your edmx from the development database server? If that's not an option, you can create an intermediary between development and production to hold your new stored proc. For example, you could create a new database project based on the schema of your production database, add your new stored proc, then deploy the database project to a new database. Update your edmx from that new database.

10/22/2014 9:05:59 PM

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