Skip to content

Commit

Permalink
Add Additional Parameters multiline textbox to append custom values t…
Browse files Browse the repository at this point in the history
…o the connection string similar to SSMS feature. (#152)
  • Loading branch information
RyanGrattoni authored Feb 24, 2024
1 parent 5f8b40d commit a56991d
Show file tree
Hide file tree
Showing 4 changed files with 613 additions and 600 deletions.
14 changes: 13 additions & 1 deletion src/SQLQueryStress/ConnectionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public class ConnectionInfo : ICloneable
[DataMember]
public int MaxPoolSize { get; set; }

[DataMember]
public string AdditionalParameters { get; set; }

public bool RequiresPassword
{
get
Expand All @@ -61,6 +64,7 @@ public ConnectionInfo()
MaxPoolSize = 0;
EnablePooling = true;
EncryptOption = SqlConnectionEncryptOption.Optional;
AdditionalParameters = String.Empty;
}

public ConnectionInfo(int connectTimeout, bool enablePooling, int maxPoolSize) : this()
Expand Down Expand Up @@ -108,7 +112,14 @@ public string ConnectionString
build.Pooling = EnablePooling;
build.Encrypt = EncryptOption;

return build.ConnectionString;
string connString = build.ConnectionString;

if (!string.IsNullOrEmpty(AdditionalParameters))
{
connString = $"{connString};{AdditionalParameters}";
}

return connString;
}
}

Expand Down Expand Up @@ -139,6 +150,7 @@ public void CopyTo(ConnectionInfo to)
to.Database = Database;
to.ApplicationIntent = ApplicationIntent;
to.EncryptOption = EncryptOption;
to.AdditionalParameters = AdditionalParameters;
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types")]
Expand Down
Loading

0 comments on commit a56991d

Please sign in to comment.