c# - Change configuration file when using Linq to SQL -
i've read few links in relation when deploying or i've missed trick in middle dont understand hence asking below question......
i have live, test , local environment (all have own individual connection strings). create solution 2 projects (for example) 1 asp .net website , other class library. within class library add linq sql , add connection it. connection string stored in app.config file.
what able switch between environments connection string updated reflect environment using without having manually type in connection string. i've seen done not sure how myself? im using vs2010. advise or point me in right direction?
thanks
you potentially use #if debug
, have 2 connections strings in app.config - 1 called test
1 called live
- suspect debugging indicate in test environment , on release live.
please refer link http://msdn.microsoft.com/en-us/library/4y6tbswk.aspx
another option have input @ point indicate environment application running on - checkbox or radio button or through appsettings
in app.config
specifying connectionmode
, setting 1
or 2
if setting reads 1
, use test connection string, if reads 2 live
connection string.
Comments
Post a Comment