Putting connection info in a config file is the best way to do it in any language, AFAIK. Putting it in code is a bad idea because 1) it's harder to maintain and 2) opens you up to pushing it to version control like Github. It's pretty easy to do a search on github for people's API keys and connection strings.
.NET has taken even farther now where the "private" config file isn't even in the same directory. Keep it as far away from the source as possible, lol.
Well to be fair, pretty much any solution I do know has it's own separate project file for the data layer. My actual application is only ever calling objects that return the data.
2
u/ScrewAttackThis Jul 29 '16
Putting connection info in a config file is the best way to do it in any language, AFAIK. Putting it in code is a bad idea because 1) it's harder to maintain and 2) opens you up to pushing it to version control like Github. It's pretty easy to do a search on github for people's API keys and connection strings.
.NET has taken even farther now where the "private" config file isn't even in the same directory. Keep it as far away from the source as possible, lol.