Method SetContextSettings
- Namespace
- YndigoBlue.Velocity.Data
- Assembly
- YndigoBlue.Velocity.dll
SetContextSettings(string)
Parses context settings and applies them to named connection properties.
public void SetContextSettings(string settings)
Parameters
settingsstringA connection string formatted as semicolon-separated key=value pairs (e.g., "DefaultSrid=3857;CommandTimeout=60").
Remarks
Context settings control the behavior of Velocity framework properties such as DefaultSrid, ImportTimeout, ImportBatchSize, ImportTransaction, and CommandTimeout. These settings override the default property values defined in this class.
Format: "key1=value1;key2=value2;key3=value3"
Supported Context Settings:
DefaultSrid(int) — Spatial Reference System Identifier (default: 4326)ImportTimeout(int) — Timeout in seconds for import operations (default: 120)ImportBatchSize(int) — Number of rows per batch during import (default: 10000)ImportTransaction(bool) — Whether to wrap imports in transactions (default: true)CommandTimeout(int) — Timeout in seconds for database commands (default: 30)
SSL and authentication settings (SslMode, SslCaPath, SslCertificatePath, SslKeyPath,
UseIntegratedSecurity) control database driver behaviour and must be passed via SetAdvancedSettings(string).
Value Parsing: Integer values are parsed as base-10 integers. Boolean values accept "true"/"false" (case-insensitive)
and are parsed using bool.TryParse(). Invalid values fall back to the default for that setting.
This method is typically called when loading configuration from external sources (XML, JSON, configuration files) that define Velocity-specific settings separate from raw database connection strings.
var conn = new SqlServerDatasourceConnection
{
Hostname = "server.example.com",
Database = "mydb",
Username = "user",
Password = "password"
};
// Override framework defaults from configuration
conn.SetContextSettings("DefaultSrid=3857;ImportBatchSize=50000;CommandTimeout=60");