Method SetAdvancedSettings
- Namespace
- YndigoBlue.Velocity.Data
- Assembly
- YndigoBlue.Velocity.dll
SetAdvancedSettings(DbConnectionStringBuilder)
Parses advanced database-specific settings from a connection string builder and applies them to the connection.
public void SetAdvancedSettings(DbConnectionStringBuilder csb)
Parameters
csbDbConnectionStringBuilderA
DbConnectionStringBuildercontaining database-specific connection string key-value pairs.
Remarks
Advanced settings are database-specific options passed through the connection string that are not represented by
named properties on this class (e.g., Pooling, ConnectTimeout). This method extracts all key-value pairs
from the connection string builder and stores them for later use by database-specific adaptors.
Reserved Settings: Some keys are reserved and handled by named properties (e.g., Server, UserID, Password).
Reserved settings are skipped and not stored as advanced settings.
This method is typically called internally when parsing connection strings. For most applications, setting named properties directly is preferred over using advanced settings.
var csb = new SqlConnectionStringBuilder("Server=localhost;Database=mydb;Application Name=MyApp;Encrypt=false");
var conn = new SqlServerDatasourceConnection();
conn.SetAdvancedSettings(csb); // Stores Application Name and Encrypt as advanced settings
SetAdvancedSettings(string)
Parses advanced database-specific settings from a connection string and applies them to the connection.
public void SetAdvancedSettings(string settings)
Parameters
settingsstringA connection string formatted as semicolon-separated key=value pairs (e.g., "Application Name=MyApp;Encrypt=false").
Remarks
This overload accepts a raw connection string in the standard format: key-value pairs separated by semicolons, with keys and values separated by equals signs. Each setting is parsed and stored as an advanced setting.
Format: "key1=value1;key2=value2;key3=value3"
Reserved Settings: Keys matching reserved setting names (e.g., Server, UserID, Password) are skipped.
Whitespace in keys (e.g., "Application Name") is normalized by removing spaces before matching against reserved settings. The original key format is preserved in storage.
var conn = new SqlServerDatasourceConnection();
conn.SetAdvancedSettings("Application Name=MyApp;Encrypt=false;Connection Timeout=30");