DbConnectionProviderDetector
Namespace: MJCZone.DapperMatic.AspNetCore.Factories
Assembly: MJCZone.DapperMatic.AspNetCore
Summary
Utility class for detecting and creating database connections based on connection string characteristics.
static public
Contents
Methods (7)
Methods
| Method | Summary |
|---|---|
| DetectSqlServerProvider | Detects the appropriate SQL Server provider (Microsoft.Data.SqlClient vs System.Data.SqlClient) usin... |
| DetectMySqlProvider | Detects the appropriate MySQL provider (MySqlConnector vs MySql.Data) based on explicit Provider=...... |
| DetectSqliteProvider | Removes the "Provider=..." keyword from the connection string. |
| GetType | |
| ToString | |
| Equals | |
| GetHashCode |
DetectSqlServerProvider
Detects the appropriate SQL Server provider (Microsoft.Data.SqlClient vs System.Data.SqlClient) using explicit Provider=..., heuristics, and finally connection string builder parsing.
DbConnection DetectSqlServerProvider(string connectionString)Parameters
- connectionString (string) - The SQL Server connection string.
Returns
Type: DbConnection
An open DbConnection instance.
DetectMySqlProvider
Detects the appropriate MySQL provider (MySqlConnector vs MySql.Data) based on explicit Provider=..., lightweight heuristics, and finally by attempting to parse with each provider's connection-string builder.
DbConnection DetectMySqlProvider(string connectionString)Parameters
- connectionString (string) - The MySQL connection string.
Returns
Type: DbConnection
An open DbConnection instance.
DetectSqliteProvider
Removes the "Provider=..." keyword from the connection string.
DbConnection DetectSqliteProvider(string connectionString)Parameters
- connectionString (string) - The original connection string.
Returns
Type: DbConnection
The cleaned connection string without the provider keyword.
GetType
GetType()ToString
ToString()Equals
Equals()GetHashCode
GetHashCode()