Click here to Skip to main content
15,304,276 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am not sure if there is a way to update edmx file automatically when database is changed.

current DbName = TestSolutionDB  with 4 tables (Country,State,Address,User)
Change DbName = ProjectDB with 4 tables(User,Project,Status,Activity)

When i replace the Connection string like 
data source=.;initial catalog ="TestSolution" To 
data source=.;initial catalog ="ProjectDB "

I need to update .edmx file (Country,State,Address,User) TO (User,Project,Status,Activity) Design, and tt.file 

These All Items can happened by pragmatically, Can give solution?


What I have tried:

Yet i don't have any idea about this, i am newbie for this
Updated 23-Jul-17 21:06pm
David_Wimbley 22-Jul-17 0:52am
I would strongly caution against this. Why would you need to do this? It seems to me this is an issue of you not keeping your DB server environments in sync and this is trying to automate that.

What happens if DB server 1 is correct and DB Server 2 is not. You change your connection string to DB Server 2 and just removed columns that breaks whatever environment DB server 1 is connected to. Or vice versa. Now if someone deploys the app but not your entities, you've just introduced a bug.

I think a proper deployment process of your DB schema is the better fix here. That along with having some DB server be the source schema where any changes from the source schema get propagated out to your other environments accordingly.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900