DubUrl.Extensions.DependencyInjection
0.1.216
See the version list below for details.
dotnet add package DubUrl.Extensions.DependencyInjection --version 0.1.216
NuGet\Install-Package DubUrl.Extensions.DependencyInjection -Version 0.1.216
<PackageReference Include="DubUrl.Extensions.DependencyInjection" Version="0.1.216" />
paket add DubUrl.Extensions.DependencyInjection --version 0.1.216
#r "nuget: DubUrl.Extensions.DependencyInjection, 0.1.216"
// Install DubUrl.Extensions.DependencyInjection as a Cake Addin #addin nuget:?package=DubUrl.Extensions.DependencyInjection&version=0.1.216 // Install DubUrl.Extensions.DependencyInjection as a Cake Tool #tool nuget:?package=DubUrl.Extensions.DependencyInjection&version=0.1.216
DubUrl
DubUrl provides a standard, URL style mechanism for parsing database connection strings and opening DbConnections for .NET. With DubUrl, you can parse and open URLs for popular databases such as Microsoft SQL Server, PostgreSQL, MySQL, SQLite3, Oracle Database and most of the other SQL databases. This project is inspired from the package dburl available in the GoLang ecosystem and is trying to match the aliases for portocols.
About | Overview | Quickstart | Examples | Schemes | Installing | Using
About
Continuous integration builds:
Database Connection URL Overview
Supported database connection URLs are of the form:
driver:alias://user:pass@host/dbname?opt1=a&opt2=b
Where:
Component | Description |
---|---|
alias | database type (see below) |
driver | driver/provider name (only for odbc/oleodbc) |
user | username |
pass | password |
host | host |
dbname<sup>*</sup> | database, instance, or service name/ID to connect to |
?opt1=... | additional database driver options (see respective SQL driver for available options) |
<i><sup><b>*</b></sup> for Microsoft SQL Server, /dbname
can be
/instance/dbname
, where /instance
is optional. For Oracle Database,
/dbname
is of the form /service/dbname
where /service
is the service name
or SID, and /dbname
is optional. Please see below for examples.</i>
Quickstart
Database connection URLs in the above format can be parsed to a standard connection string with the [Parse
] as such:
string connectionUrl = "mssql://{server}/{database_name}";
string connectionString = new ConnectionUrl(connectionUrl).Parse();
Additionally, a simple helper, [Open
], is provided that will parse, open, and return a standard DbConnection
.
string connectionUrl = "mssql://{server}/{database_name}";
IDbConnection connection = new ConnectionUrl(connectionUrl).Open();
If you don't want to open the connection but only return it and manage its state by yourself, use the function [Connect
]
string connectionUrl = "mssql://{server}/{database_name}";
IDbConnection connection = new ConnectionUrl(connectionUrl).Connect();
Example URLs
The following are example database connection URLs that can be handled by
[Parse
], [Connect
] and [Open
]:
mssql://user:pass@remote-host.com/instance/dbname?keepAlive=10
oledb+mssql://user:pass@localhost/dbname
postgres://user:pass@localhost/dbname
odbc+postgres://user:pass@localhost:port/dbname?option1=
mysql://user:pass@localhost/dbname
oracle://user:pass@somehost.com/sid
db2://user:pass@localhost/dbname
Protocol Schemes and Aliases
ADO.Net data providers
The following databases and their associated schemes are supported out of the box:
Database | Aliases | Provider Invariant Name |
---|---|---|
mssql, ms, sqlserver | Microsoft.Data.SqlClient | |
mysql, my | MySqlConnector | |
pg, pgsql, postgres, postgresql | Npgsql | |
db2 | IBM.Data.Db2 | |
maria, mariadb | MySqlConnector | |
oracle, or, ora | Oracle.ManagedDataAccess | |
duck, duckdb | DuckDB.NET.Data | |
fb, firebird | FirebirdSql.Data.FirebirdClient | |
sq, sqlite | Microsoft.Data.Sqlite | |
cr, cockroach, cockroachdb, crdb, cdb | Npgsql | |
sf, snowflake | Snowflake.Data | |
td, teradata, tera | Teradata.Client | |
tr, trino | NReco.PrestoAdo | |
quest, questdb | Npgsql | |
ts, timescale | Npgsql |
ODBC driver locators
The following databases and their associated schemes are supported out of the box:
Database | Aliases | Name Pattern |
---|---|---|
mssql, ms, sqlserver | ^\bODBC Driver\s([0-9]{1,2}(?:.[0-9]{1,2}){0,2})\s\bfor SQL Server$ | |
mysql, my | ^\bMySQL ODBC\s([0-9]{1,2}(?:.[0-9]{1,2}){0,2})\s(ANSI|Unicode)\s\bDriver$ | |
pg, pgsql, postgres, postgresql | ^\bPostgreSQL\s(ANSI|Unicode)((x64))?$ | |
maria, mariadb | ^\bMariaDB ODBC\s([0-9]{1,2}(?:.[0-9]{1,2}){0,2})\s\bDriver$ | |
duck, duckdb | ^\bDuckDB\s\bDriver$ | |
drill | ^\bMapR Drill ODBC Driver$ | |
tr, trino | ^(Simba)\s\bTrino ODBC Driver$ | |
xls, xlsx, xlsb, xlsm | ^\bMicrosoft Excel Driver\s(*.xls, *.xlsx, *.xlsm, *.xlsb)$ | |
txt, csv, tsv | ^\bMicrosoft Access Text Driver\s(*.txt, *.csv)$ | |
quest, questdb | ^\bPostgreSQL\s(ANSI|Unicode)((x64))?$ | |
ts, timescale | ^\bPostgreSQL\s(ANSI|Unicode)((x64))?$ |
OLEDB provider locators
The following databases and their associated schemes are supported out of the box:
Database | Aliases | Name Pattern |
---|---|---|
mssql, ms, sqlserver | ^\bMSOLEDBSQL$ | |
mysql, my | ^\bMySQL Provider$ | |
xls | ^\bMicrosoft.ACE.OLEDB.([0-9]{1,2}(?:.[0-9]{1,2}){0,2})$ | |
xlsx | ^\bMicrosoft.ACE.OLEDB.([0-9]{1,2}(?:.[0-9]{1,2}){0,2})$ | |
xlsm | ^\bMicrosoft.ACE.OLEDB.([0-9]{1,2}(?:.[0-9]{1,2}){0,2})$ | |
xlsb | ^\bMicrosoft.ACE.OLEDB.([0-9]{1,2}(?:.[0-9]{1,2}){0,2})$ |
Installing
Install in the usual .NET fashion:
Install-Package DubUrl
Using
Check the first steps guide on the website.
Please note that DubUrl
does not install actual drivers, and only provides a standard way to [Parse
] respective database connection URLs then [Connect
] or [Open
] connections.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- DubUrl (>= 0.1.216)
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.Logging (>= 7.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
- Microsoft.Extensions.Options (>= 7.0.1)
-
net7.0
- DubUrl (>= 0.1.216)
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.Logging (>= 7.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
- Microsoft.Extensions.Options (>= 7.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
0.4.14 | 280 | 11/16/2023 | |
0.4.6 | 124 | 11/16/2023 | |
0.4.5 | 118 | 11/13/2023 | |
0.4.4 | 130 | 11/13/2023 | |
0.4.3 | 119 | 11/12/2023 | |
0.4.2 | 125 | 11/12/2023 | |
0.4.1 | 124 | 11/7/2023 | |
0.4.0 | 118 | 11/6/2023 | |
0.3.3 | 118 | 11/6/2023 | |
0.3.2 | 107 | 11/6/2023 | |
0.3.1 | 120 | 11/6/2023 | |
0.3.0 | 138 | 10/30/2023 | |
0.2.13 | 124 | 10/30/2023 | |
0.2.12 | 126 | 10/30/2023 | |
0.2.11 | 122 | 10/30/2023 | |
0.2.10 | 127 | 10/23/2023 | |
0.2.9 | 132 | 10/23/2023 | |
0.2.8 | 137 | 10/16/2023 | |
0.2.7 | 141 | 10/16/2023 | |
0.2.6 | 153 | 10/9/2023 | |
0.2.5 | 128 | 10/9/2023 | |
0.2.4 | 143 | 10/9/2023 | |
0.2.3 | 143 | 10/2/2023 | |
0.2.0 | 186 | 9/30/2023 | |
0.1.233 | 190 | 9/21/2023 | |
0.1.231 | 156 | 9/19/2023 | |
0.1.230 | 130 | 9/18/2023 | |
0.1.228 | 122 | 9/18/2023 | |
0.1.227 | 163 | 9/15/2023 | |
0.1.226 | 137 | 9/14/2023 | |
0.1.225 | 145 | 9/12/2023 | |
0.1.224 | 155 | 9/10/2023 | |
0.1.223 | 145 | 9/10/2023 | |
0.1.222 | 144 | 9/9/2023 | |
0.1.219 | 150 | 9/8/2023 | |
0.1.218 | 148 | 9/7/2023 | |
0.1.217 | 149 | 9/6/2023 | |
0.1.216 | 170 | 8/28/2023 | |
0.1.215 | 157 | 8/28/2023 | |
0.1.214 | 151 | 8/23/2023 | |
0.1.213 | 144 | 8/23/2023 | |
0.1.212 | 147 | 8/15/2023 | |
0.1.211 | 126 | 8/14/2023 | |
0.1.210 | 133 | 8/12/2023 | |
0.1.209 | 188 | 8/8/2023 | |
0.1.208 | 161 | 8/1/2023 | |
0.1.207 | 165 | 7/31/2023 | |
0.1.206 | 142 | 7/31/2023 | |
0.1.205 | 145 | 7/31/2023 | |
0.1.204 | 152 | 7/30/2023 | |
0.1.203 | 149 | 7/30/2023 | |
0.1.202 | 141 | 7/30/2023 | |
0.1.201 | 152 | 7/29/2023 | |
0.1.200 | 148 | 7/11/2023 | |
0.1.199 | 140 | 7/3/2023 | |
0.1.198 | 137 | 7/1/2023 | |
0.1.197 | 137 | 6/30/2023 | |
0.1.196 | 214 | 6/29/2023 | |
0.1.195 | 138 | 6/26/2023 | |
0.1.194 | 191 | 6/23/2023 | |
0.1.193 | 138 | 6/23/2023 | |
0.1.192 | 131 | 6/21/2023 | |
0.1.191 | 141 | 6/19/2023 | |
0.1.190 | 136 | 6/18/2023 | |
0.1.188 | 140 | 6/18/2023 | |
0.1.187 | 139 | 6/17/2023 | |
0.1.186 | 148 | 6/16/2023 | |
0.1.184 | 161 | 6/11/2023 | |
0.1.183 | 140 | 6/8/2023 | |
0.1.182 | 139 | 5/31/2023 | |
0.1.180 | 138 | 5/30/2023 | |
0.1.179 | 135 | 5/30/2023 | |
0.1.178 | 140 | 5/29/2023 | |
0.1.177 | 140 | 5/28/2023 | |
0.1.176 | 138 | 5/27/2023 | |
0.1.175 | 136 | 5/23/2023 | |
0.1.174 | 140 | 5/22/2023 | |
0.1.173 | 143 | 5/21/2023 | |
0.1.172 | 145 | 5/20/2023 | |
0.1.171 | 141 | 5/20/2023 | |
0.1.170 | 136 | 5/15/2023 | |
0.1.169 | 149 | 5/14/2023 | |
0.1.168 | 145 | 5/13/2023 | |
0.1.167 | 146 | 5/11/2023 | |
0.1.166 | 141 | 5/11/2023 | |
0.1.165 | 146 | 5/3/2023 | |
0.1.164 | 175 | 4/27/2023 | |
0.1.163 | 163 | 4/22/2023 | |
0.1.162 | 164 | 4/18/2023 | |
0.1.161 | 177 | 4/17/2023 | |
0.1.160 | 191 | 4/17/2023 | |
0.1.159 | 173 | 4/17/2023 | |
0.1.158 | 178 | 4/17/2023 | |
0.1.157 | 157 | 4/13/2023 | |
0.1.156 | 184 | 4/10/2023 | |
0.1.155 | 196 | 4/10/2023 | |
0.1.154 | 185 | 4/10/2023 | |
0.1.153 | 187 | 4/10/2023 | |
0.1.152 | 198 | 4/4/2023 | |
0.1.151 | 190 | 4/3/2023 | |
0.1.150 | 206 | 3/28/2023 | |
0.1.149 | 215 | 3/20/2023 | |
0.1.148 | 214 | 3/14/2023 | |
0.1.147 | 217 | 3/6/2023 | |
0.1.146 | 225 | 3/5/2023 | |
0.1.145 | 220 | 3/5/2023 | |
0.1.144 | 285 | 3/1/2023 | |
0.1.143 | 273 | 1/31/2023 | |
0.1.142 | 278 | 1/31/2023 | |
0.1.141 | 276 | 1/25/2023 | |
0.1.140 | 275 | 1/23/2023 | |
0.1.139 | 287 | 1/20/2023 | |
0.1.138 | 300 | 1/3/2023 | |
0.1.136 | 287 | 1/3/2023 | |
0.1.133 | 301 | 12/26/2022 | |
0.1.132 | 291 | 12/20/2022 | |
0.1.131 | 295 | 12/20/2022 | |
0.1.130 | 305 | 12/14/2022 | |
0.1.129 | 317 | 11/28/2022 | |
0.1.128 | 318 | 11/20/2022 | |
0.1.127 | 319 | 11/20/2022 | |
0.1.126 | 325 | 11/20/2022 | |
0.1.125 | 333 | 11/19/2022 | |
0.1.124 | 331 | 11/19/2022 | |
0.1.123 | 344 | 11/19/2022 | |
0.1.122 | 321 | 11/19/2022 | |
0.1.121 | 318 | 11/19/2022 | |
0.1.120 | 324 | 11/17/2022 | |
0.1.119 | 331 | 11/17/2022 | |
0.1.118 | 325 | 11/17/2022 | |
0.1.115 | 323 | 11/9/2022 | |
0.1.114 | 347 | 11/7/2022 | |
0.1.113 | 351 | 11/2/2022 | |
0.1.112 | 349 | 11/2/2022 | |
0.1.111 | 345 | 11/2/2022 | |
0.1.110 | 337 | 11/1/2022 | |
0.1.109 | 345 | 11/1/2022 | |
0.1.108 | 360 | 10/28/2022 | |
0.1.107 | 374 | 10/28/2022 | |
0.1.106 | 359 | 10/28/2022 | |
0.1.103 | 398 | 10/22/2022 | |
0.1.101 | 394 | 10/17/2022 | |
0.1.100 | 427 | 10/17/2022 | |
0.1.99 | 390 | 10/17/2022 | |
0.1.98 | 385 | 10/17/2022 | |
0.1.97 | 399 | 10/13/2022 | |
0.1.96 | 383 | 10/3/2022 | |
0.1.94 | 410 | 9/26/2022 | |
0.1.93 | 403 | 9/26/2022 | |
0.1.92 | 407 | 9/26/2022 | |
0.1.91 | 429 | 9/24/2022 | |
0.1.90 | 426 | 9/24/2022 | |
0.1.89 | 428 | 9/24/2022 | |
0.1.88 | 400 | 9/21/2022 | |
0.1.87 | 400 | 9/20/2022 | |
0.1.86 | 404 | 9/20/2022 | |
0.1.84 | 431 | 9/15/2022 | |
0.1.83 | 425 | 9/15/2022 | |
0.1.82 | 394 | 9/11/2022 | |
0.1.81 | 450 | 9/10/2022 | |
0.1.80 | 421 | 9/10/2022 | |
0.1.79 | 416 | 9/10/2022 | |
0.1.78 | 443 | 9/10/2022 |