I have a project of intern website for my company. I use MVC5 with Entity Framework 6 on a Code First project.
It's an Intranet for my company so I want two database. 1 in production (release). 1 in dev (Debug).
I've edited the Web.config, Web.Debug.config and Web.Release.config files like that :
Web.Config
<connectionStrings>
<add name="Connexion" connectionString="Data Source=[MYSQLSERVER];Initial Catalog=Intranet;Persist Security Info=True;User ID=[MYUSER];Password=[MYPASS]" providerName="System.Data.SqlClient"/>
</connectionStrings>
Web.Debug.Config
<connectionStrings>
<add name="Connexion" connectionString="Data Source=[MYSQLSERVER];Initial Catalog=Intranet;Persist Security Info=True;User ID=[MYUSER];Password=[MYPASS]" providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
Web.Release.config
<connectionStrings>
<add name="Connexion" connectionString="Data Source=[MYSQLSERVER];Initial Catalog=IntranetRelease;Persist Security Info=True;User ID=[MYUSER];Password=[MYPASS]" providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
When I deploy my project using Web Deploy in release mod, all the job is done and the final Web.Config have good value IntranetRelease
for the catalog.
My problem is that my site don't work cause the database IntranetRelease
isn't updated from Intranet
database.
I have made a perfect copy of Intranet
and create manually IntranetRelease
. It work but I can't do that when peoples will use the website cause all the data will be on IntranetRelease
database.
I've tried in my project to do an Add-Migration xxx
in release mode but it doesn't change anything.
The goal is this :
When the release intranet is in work, I work on the dev database. When all my changes are good for make a release, I want to deploy a new version with Web Deploy and do something
to update the IntranetRelease
database with my changes without lost any data on it.
Thanks for help and sorry for my poor english.