Application Name support in connection string#7
Application Name support in connection string#7potatoqualitee merged 4 commits intodataplat:masterfrom
Conversation
Added SqlConnectionStringBuilder and rewrote logic to create comparable ConnectionStrings to previous version. Added support for Application Name either as a parameter or determined from the calling script's name
|
Hi @alevyinroc! Thanks for this, awesome idea (both adding the application name, and building the connection string without silly string manipulation). I think it might make sense to submit this PR to the function in dbatools - still deciding what to do with this repo (e.g. push to it if invoke-sqlcmd2.ps1 changes in dbatools, leave it alone, etc.) cc @ctrlbold Cheers! |
|
I didn't even realize that it was in dbatools! Is there an easy way to migrate the PR there, or should I fork that repo, redo my changes and then submit? |
|
I'm guessing a patch would be difficult given that these are different repos with the file in a different spot - might be worth just redoing the PR over there? |
|
Forked & recommitted my changes, will have to review the contribution guidelines before I go for the PR. |
|
I like invoke-Sqlcmd2 being a sep. command because it does not require SMO. Though that's a moot point now. Hmmmm. But I just keep an eye on this and when changes are pushed, I copy it, nbd. @RamblingCookieMonster - mind if I accept PRs for this repo? |
|
Works for me, awesome! |
|
@alevyinroc - make sure you sync this one before adding back your other changes! |
These changes add support for a new optional parameter,
ApplicationName. If specified, this parameter's value will be added to theConnectionString'sApplication Nameparameter. If not supplied, an attempt to determine the parent script's filename is made.I've also changed the creation of the
ConnectionStringfrom basic string formatting to using the SqlConnectionStringBuilder class to reduce redundant code and make adding parameters into theConnectionStringon a conditional basis cleaner.