DubUrl.Extensions.DependencyInjection 0.4.14

Suggested Alternatives

DubUrl.Extensions

Additional Details

The scope of the legacy package `DubUrl.Extensions.DependencyInjection` is now included in the package `DubUrl.Extensions`

dotnet add package DubUrl.Extensions.DependencyInjection --version 0.4.14
NuGet\Install-Package DubUrl.Extensions.DependencyInjection -Version 0.4.14
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DubUrl.Extensions.DependencyInjection" Version="0.4.14" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DubUrl.Extensions.DependencyInjection --version 0.4.14
#r "nuget: DubUrl.Extensions.DependencyInjection, 0.4.14"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DubUrl.Extensions.DependencyInjection as a Cake Addin
#addin nuget:?package=DubUrl.Extensions.DependencyInjection&version=0.4.14

// Install DubUrl.Extensions.DependencyInjection as a Cake Tool
#tool nuget:?package=DubUrl.Extensions.DependencyInjection&version=0.4.14

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

Social media: website twitter badge

Releases: nuget licence badge

Dev. activity: GitHub last commit Still maintained GitHub commit activity

Continuous integration builds: Build status Tests CodeFactor codecov FOSSA Status

Status: stars badge Bugs badge Top language

Mappers for ADO.Net Provider implemented badge Mappers for ODBC drivers implemented badge Mappers for OLE DB providers implemented badge Mappers for ADOMD.NET providers implemented badge

Upcoming features badge Upcoming databases badge Upcoming ADO.Net badge Upcoming ODBC badge

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
Microsoft SQL Server mssql, ms, sqlserver, mssqlserver Microsoft.Data.SqlClient
MySQL mysql, my MySqlConnector
PostgreSQL pg, pgx, pgsql, postgres, postgresql Npgsql
IBM DB2 db2 IBM.Data.Db2
MariaDB maria, mariadb MySqlConnector
Oracle Database oracle, or, ora Oracle.ManagedDataAccess
DuckDB duck, duckdb DuckDB.NET.Data
Firebird SQL fb, firebird FirebirdSql.Data.FirebirdClient
SQLite3 sq, sqlite Microsoft.Data.Sqlite
CockRoachDB cr, cockroach, cockroachdb, crdb, cdb Npgsql
Snowflake sf, snowflake Snowflake.Data
Teradata td, teradata, tera Teradata.Client
Trino tr, trino NReco.PrestoAdo
QuestDb quest, questdb Npgsql
Timescale ts, timescale Npgsql

ODBC driver locators

The following databases and their associated schemes are supported out of the box:

Database Aliases Name Pattern
Microsoft SQL Server mssql, ms, sqlserver, mssqlserver ^\bODBC Driver\s([0-9]{1,2}(?:.[0-9]{1,2}){0,2})\s\bfor SQL Server$
MySQL mysql, my ^\bMySQL ODBC\s([0-9]{1,2}(?:.[0-9]{1,2}){0,2})\s(ANSI|Unicode)\s\bDriver$
PostgreSQL pg, pgx, pgsql, postgres, postgresql ^\bPostgreSQL\s(ANSI|Unicode)((x64))?$
MariaDB maria, mariadb ^\bMariaDB ODBC\s([0-9]{1,2}(?:.[0-9]{1,2}){0,2})\s\bDriver$
DuckDB duck, duckdb ^\bDuckDB\s\bDriver$
Apache Drill drill ^\bMapR Drill ODBC Driver$
Trino tr, trino ^(Simba)\s\bTrino ODBC Driver$
Microsoft Excel xls, xlsx, xlsb, xlsm ^\bMicrosoft Excel Driver\s(*.xls, *.xlsx, *.xlsm, *.xlsb)$
Text files txt, csv, tsv ^\bMicrosoft Access Text Driver\s(*.txt, *.csv)$
QuestDb quest, questdb ^\bPostgreSQL\s(ANSI|Unicode)((x64))?$
Timescale ts, timescale ^\bPostgreSQL\s(ANSI|Unicode)((x64))?$

Extension for OLEDB provider locators

The following databases and their associated schemes are supported through the OLE DB data provider extension:

Database Aliases Name Pattern
Microsoft SQL Server mssql, ms, sqlserver, mssqlserver ^\bMSOLEDBSQL$
MySQL mysql, my ^\bMySQL Provider$
Microsoft Excel xls ^\bMicrosoft.ACE.OLEDB.([0-9]{1,2}(?:.[0-9]{1,2}){0,2})$
Microsoft Excel xlsx ^\bMicrosoft.ACE.OLEDB.([0-9]{1,2}(?:.[0-9]{1,2}){0,2})$
Microsoft Excel xlsm ^\bMicrosoft.ACE.OLEDB.([0-9]{1,2}(?:.[0-9]{1,2}){0,2})$
Microsoft Excel xlsb ^\bMicrosoft.ACE.OLEDB.([0-9]{1,2}(?:.[0-9]{1,2}){0,2})$

Extension for ADOMD.NET data provider

The following databases and their associated schemes are supported through the ADOMD.NET data provider extension:

Database Aliases Provider Invariant Name
Power BI Desktop pbidesktop, pbix, powerbidesktop Microsoft.AnalysisServices.AdomdClient
Power BI Premium powerbi, pbi, pbiazure, pbipremium, powerbipremium Microsoft.AnalysisServices.AdomdClient

Installing

Install in the usual .NET fashion:

Install-Package DubUrl

To install the extension for OLEDB provider locators

Install-Package DubUrl.OleDb

To install the extension for ADOMD.NET data provider

Install-Package DubUrl.Adomd

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 240 11/16/2023
0.4.6 98 11/16/2023
0.4.5 96 11/13/2023
0.4.4 88 11/13/2023
0.4.3 97 11/12/2023
0.4.2 96 11/12/2023
0.4.1 98 11/7/2023
0.4.0 92 11/6/2023
0.3.3 91 11/6/2023
0.3.2 80 11/6/2023
0.3.1 92 11/6/2023
0.3.0 108 10/30/2023
0.2.13 94 10/30/2023
0.2.12 100 10/30/2023
0.2.11 97 10/30/2023
0.2.10 102 10/23/2023
0.2.9 107 10/23/2023
0.2.8 114 10/16/2023
0.2.7 115 10/16/2023
0.2.6 128 10/9/2023
0.2.5 102 10/9/2023
0.2.4 117 10/9/2023
0.2.3 116 10/2/2023
0.2.0 162 9/30/2023
0.1.233 163 9/21/2023
0.1.231 128 9/19/2023
0.1.230 103 9/18/2023
0.1.228 99 9/18/2023
0.1.227 138 9/15/2023
0.1.226 113 9/14/2023
0.1.225 119 9/12/2023
0.1.224 131 9/10/2023
0.1.223 117 9/10/2023
0.1.222 118 9/9/2023
0.1.219 120 9/8/2023
0.1.218 123 9/7/2023
0.1.217 122 9/6/2023
0.1.216 147 8/28/2023
0.1.215 135 8/28/2023
0.1.214 125 8/23/2023
0.1.213 122 8/23/2023
0.1.212 127 8/15/2023
0.1.211 108 8/14/2023
0.1.210 112 8/12/2023
0.1.209 121 8/8/2023
0.1.208 148 8/1/2023
0.1.207 137 7/31/2023
0.1.206 117 7/31/2023
0.1.205 122 7/31/2023
0.1.204 130 7/30/2023
0.1.203 126 7/30/2023
0.1.202 119 7/30/2023
0.1.201 128 7/29/2023
0.1.200 128 7/11/2023
0.1.199 119 7/3/2023
0.1.198 116 7/1/2023
0.1.197 114 6/30/2023
0.1.196 186 6/29/2023
0.1.195 115 6/26/2023
0.1.194 165 6/23/2023
0.1.193 112 6/23/2023
0.1.192 108 6/21/2023
0.1.191 118 6/19/2023
0.1.190 113 6/18/2023
0.1.188 119 6/18/2023
0.1.187 121 6/17/2023
0.1.186 122 6/16/2023
0.1.184 139 6/11/2023
0.1.183 115 6/8/2023
0.1.182 115 5/31/2023
0.1.180 119 5/30/2023
0.1.179 114 5/30/2023
0.1.178 115 5/29/2023
0.1.177 119 5/28/2023
0.1.176 120 5/27/2023
0.1.175 117 5/23/2023
0.1.174 120 5/22/2023
0.1.173 122 5/21/2023
0.1.172 126 5/20/2023
0.1.171 121 5/20/2023
0.1.170 117 5/15/2023
0.1.169 128 5/14/2023
0.1.168 126 5/13/2023
0.1.167 124 5/11/2023
0.1.166 121 5/11/2023
0.1.165 125 5/3/2023
0.1.164 153 4/27/2023
0.1.163 143 4/22/2023
0.1.162 145 4/18/2023
0.1.161 156 4/17/2023
0.1.160 167 4/17/2023
0.1.159 151 4/17/2023
0.1.158 157 4/17/2023
0.1.157 147 4/13/2023
0.1.156 161 4/10/2023
0.1.155 162 4/10/2023
0.1.154 161 4/10/2023
0.1.153 164 4/10/2023
0.1.152 172 4/4/2023
0.1.151 171 4/3/2023
0.1.150 184 3/28/2023
0.1.149 196 3/20/2023
0.1.148 194 3/14/2023
0.1.147 196 3/6/2023
0.1.146 206 3/5/2023
0.1.145 200 3/5/2023
0.1.144 218 3/1/2023
0.1.143 248 1/31/2023
0.1.142 247 1/31/2023
0.1.141 253 1/25/2023
0.1.140 249 1/23/2023
0.1.139 261 1/20/2023
0.1.138 273 1/3/2023
0.1.136 263 1/3/2023
0.1.133 276 12/26/2022
0.1.132 270 12/20/2022
0.1.131 267 12/20/2022
0.1.130 278 12/14/2022
0.1.129 291 11/28/2022
0.1.128 294 11/20/2022
0.1.127 295 11/20/2022
0.1.126 305 11/20/2022
0.1.125 308 11/19/2022
0.1.124 310 11/19/2022
0.1.123 319 11/19/2022
0.1.122 296 11/19/2022
0.1.121 297 11/19/2022
0.1.120 303 11/17/2022
0.1.119 302 11/17/2022
0.1.118 302 11/17/2022
0.1.115 303 11/9/2022
0.1.114 327 11/7/2022
0.1.113 333 11/2/2022
0.1.112 326 11/2/2022
0.1.111 323 11/2/2022
0.1.110 314 11/1/2022
0.1.109 329 11/1/2022
0.1.108 337 10/28/2022
0.1.107 348 10/28/2022
0.1.106 337 10/28/2022
0.1.103 378 10/22/2022
0.1.101 366 10/17/2022
0.1.100 368 10/17/2022
0.1.99 368 10/17/2022
0.1.98 362 10/17/2022
0.1.97 377 10/13/2022
0.1.96 357 10/3/2022
0.1.94 381 9/26/2022
0.1.93 381 9/26/2022
0.1.92 380 9/26/2022
0.1.91 408 9/24/2022
0.1.90 403 9/24/2022
0.1.89 407 9/24/2022
0.1.88 377 9/21/2022
0.1.87 377 9/20/2022
0.1.86 384 9/20/2022
0.1.84 409 9/15/2022
0.1.83 400 9/15/2022
0.1.82 386 9/11/2022
0.1.81 396 9/10/2022
0.1.80 400 9/10/2022
0.1.79 393 9/10/2022
0.1.78 422 9/10/2022