Two database in one model
Posted: Mon 16 Jun 2014 05:58
Hi Everybody,
I have a large project in which i separate the developing and runtime databases from each other. I solved this by creating Linq model to the developing database and when programming, I set the Connection string as follows:
#if DEBUG
ConnectionString = GetConnectionString("DeveloperConnectionString");
#else
ConnectionString = GetConnectionString("ReleaseConnectionString");
#endif
Of course, both ConnectionString is included in my app.config file.
By this, the connection string is set whether I interprete my projects in Debug mode, or in something else.
At time of interpretation, Connection string gets its proper value.
But the program always gets the value from the developing database, and never from the runtime database.
Finally, I got to the point why it is so: The connection determines only the fact, by which database I sign in to the SQL server, but if I modify or query another database from there, that is valid, and most likely it is determined in the model this way.
How could I change things so that I couldn't make separate models for runtime and for developing versions?
Best regards,
Imre
I have a large project in which i separate the developing and runtime databases from each other. I solved this by creating Linq model to the developing database and when programming, I set the Connection string as follows:
#if DEBUG
ConnectionString = GetConnectionString("DeveloperConnectionString");
#else
ConnectionString = GetConnectionString("ReleaseConnectionString");
#endif
Of course, both ConnectionString is included in my app.config file.
By this, the connection string is set whether I interprete my projects in Debug mode, or in something else.
At time of interpretation, Connection string gets its proper value.
But the program always gets the value from the developing database, and never from the runtime database.
Finally, I got to the point why it is so: The connection determines only the fact, by which database I sign in to the SQL server, but if I modify or query another database from there, that is valid, and most likely it is determined in the model this way.
How could I change things so that I couldn't make separate models for runtime and for developing versions?
Best regards,
Imre