-
Notifications
You must be signed in to change notification settings - Fork 227
ConnectionString
Simon Hughes edited this page Oct 12, 2022
·
2 revisions
Sometimes you don't have a local database and only use a cloud database and want to keep the connection string out of your code. In this case, I would recommend using an environment variable.
For example, here is one I set as aa
in the User variables:
Notice that you don't add quotes around the connection string in the environment variable.
And to pick that up in the <database>.tt
file, use:
Settings.ConnectionString = Environment.GetEnvironmentVariable("aa", EnvironmentVariableTarget.User);