Scripting based on TEST/PROD DB Connection
Given that we have setup SC to use a TEST & PROD DB, any recommendations on how to control scripting tasks that perform scripted SqlConnection updates (to update batch comment, post dates, distribution accounts, etc.) that all all set to connect using a Default Connection (MSSQL Default Connections).
I know I can create a Global Variable IsTest or IsProduction… but was hoping to not have to remember to set this when copying production to test and rather leverage the database SmartConnect is connected to.
Thanks in advance for your time!
I know I can create a Global Variable IsTest or IsProduction… but was hoping to not have to remember to set this when copying production to test and rather leverage the database SmartConnect is connected to.
Thanks in advance for your time!
Answers
Only thing I can think of is to read the config file
You should be able to write code in your method to directly read the eOne.SmartConnect.Setup.Config file. Then just directly read that config setting.
And then since you know your live/test system names, you’d then set the default connection to one or the other
The only thing I’d note is that from the SC UI, that setting isn’t used. It is used by the SC service to know which section to use. On the UI, if there are both set up they both show in the list and the user picks.
You might just edit the config file to add your own setting there and set to something for “live” and “test” and read that setting.
You should be able to write code in your method to directly read the eOne.SmartConnect.Setup.Config file. Then just directly read that config setting.
And then since you know your live/test system names, you’d then set the default connection to one or the other
The only thing I’d note is that from the SC UI, that setting isn’t used. It is used by the SC service to know which section to use. On the UI, if there are both set up they both show in the list and the user picks.
You might just edit the config file to add your own setting there and set to something for “live” and “test” and read that setting.