Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi , for some reason I need to change my connection string dynamically from code. I do not want to put the connection value in config file. Suggest me if there is any other solution except config file.
I've never tried it, but in theory you can use:
ApplicationContext.Current.DatabaseContext.ConfigureDatabaseConnection(connString)
to set the database connection.
I'd imagine you'd need to do this in the Application Startup events (not sure which one - but as early as possible, I'd guess). See below:
https://our.umbraco.com/Documentation/Reference/Events/Application-Startup
Again, not sure if it will work, but seems your best bet.
Thanks Dan, for the reply.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Umbraco Connection String
Hi , for some reason I need to change my connection string dynamically from code. I do not want to put the connection value in config file. Suggest me if there is any other solution except config file.
I've never tried it, but in theory you can use:
to set the database connection.
I'd imagine you'd need to do this in the Application Startup events (not sure which one - but as early as possible, I'd guess). See below:
https://our.umbraco.com/Documentation/Reference/Events/Application-Startup
Again, not sure if it will work, but seems your best bet.
Thanks Dan, for the reply.
is working on a reply...