Message
General information
Forum:
ASP.NET
Category:
Entity Framework
Environment versions
Environment:
C# 5.0
OS:
Windows 10
Network:
Windows Server 2012
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01646424
Message ID:
01646442
Views:
33
>I have a database in a production server with a rather simple structure that I use to generate Context and Model. I have a sandbox server in which I restore the database from a backup that I use for testing.
>
>I wonder what the best approach is to switch between the two servers, ideally they would use the same EF project and just have different connection strings. I just do not get how to make that work.
>
>Alternatively I could have 2 separate (identical) EF projects and instatiate the context that i need at runtime. I'm ,not too hot about this because in the future my database structure might change a lot, and I don't think regenerating 2 EF projects rather than one is such a good idea.
>
>Or am I just not using the right technology? :)

The connection strings are usually in the config file so just a question of using different configs for the two databases.
Find the EntityContainerName in Edmx properties and look for that in the configuration/connectionStrings section.
The actual connection string for the SQL server is contained in the connectionString property (provider connection string)
Previous
Next
Reply
Map
View