Open.Database.Extensions.MSSqlClient 11.0.0-rc.2

This is a prerelease version of Open.Database.Extensions.MSSqlClient.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Open.Database.Extensions.MSSqlClient --version 11.0.0-rc.2
                    
NuGet\Install-Package Open.Database.Extensions.MSSqlClient -Version 11.0.0-rc.2
                    
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="Open.Database.Extensions.MSSqlClient" Version="11.0.0-rc.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Open.Database.Extensions.MSSqlClient" Version="11.0.0-rc.2" />
                    
Directory.Packages.props
<PackageReference Include="Open.Database.Extensions.MSSqlClient" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Open.Database.Extensions.MSSqlClient --version 11.0.0-rc.2
                    
#r "nuget: Open.Database.Extensions.MSSqlClient, 11.0.0-rc.2"
                    
#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.
#:package Open.Database.Extensions.MSSqlClient@11.0.0-rc.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Open.Database.Extensions.MSSqlClient&version=11.0.0-rc.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Open.Database.Extensions.MSSqlClient&version=11.0.0-rc.2&prerelease
                    
Install as a Cake Tool

Open.Database.Extensions.MSSqlClient

Open.Database.Extensions.MSSqlClient: You write the SQL. The library writes the other twenty lines.

SQL Server for Open.Database.Extensions: SqlConnectionFactory, SQL-specific commands, and stored procedures on Microsoft.Data.SqlClient. Use it when your database is SQL Server. It includes Open.Database.Extensions.Core and the Microsoft.Data.SqlClient provider, so there is nothing else to install.

dotnet add package Open.Database.Extensions.MSSqlClient --prerelease
using Open.Database.Extensions;

public record Post(int Id, string Title);

// Create the factory once per application.
var connectionFactory = new SqlConnectionFactory(@"Server=(localdb)\MSSQLLocalDB;Database=Blog;Integrated Security=true");
int author = 42;

Post[] posts = await connectionFactory
    .Command("select * from posts where author = @author")
    .AddParam(author)
    .Map<Post>()
    .ToArrayAsync();

Stored procedures: name the argument, not the parameter

AddParam(value) takes the parameter name from the argument expression and matches it to the procedure's real parameters (exactly, then ignoring case, then ignoring case and underscores), so search.TitleContains finds @title_contains. AddParams(search) sends every member of the object that the procedure declares.

// search holds the arguments: any object with the members you want to send, here an anonymous one.
var search = new { Author = 42, TitleContains = "ode" };

Post[] posts = await connectionFactory
    .StoredProcedure("[dbo].[SearchPosts]")
    .AddParam(search.Author)
    .AddParam(search.TitleContains)
    .Map<Post>()
    .ToArrayAsync();

// Or give it the whole object: the members the procedure declares are sent, the rest are ignored.
posts = await connectionFactory
    .StoredProcedure("[dbo].[SearchPosts]")
    .AddParams(search)
    .Map<Post>()
    .ToArrayAsync();

Parameter names are looked up once per connection factory and remembered for five minutes (a connection or factory you create for each call looks them up for every command). The return value of a procedure is readable with ExecuteReturn<int>(); output parameters can be sent, but their values cannot yet be read back. See Expressive commands for the rules and limits.

The packages

Package What it adds Targets
Open.Database.Extensions.Core The foundation, expressive commands and Map<T>(). Provider-agnostic: start here. netstandard2.0, netstandard2.1, net10.0
Open.Database.Extensions.MSSqlClient (this package) SqlConnectionFactory and stored procedures on Microsoft.Data.SqlClient. net472, net10.0
Open.Database.Extensions.SqlClient The same API on the older System.Data.SqlClient. Deprecated: use MSSqlClient. netstandard2.0, netstandard2.1, net10.0
Open.Database.Extensions.Channel Rows into System.Threading.Channels. netstandard2.0, netstandard2.1, net10.0
Open.Database.Extensions.Dataflow Rows into TPL Dataflow blocks. netstandard2.0, netstandard2.1, net10.0

Documentation · API reference · Source and issues · MIT license

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net472 is compatible.  net48 was computed.  net481 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
11.0.0-rc.3 65 11/9/2026
11.0.0-rc.2 49 11/9/2026
11.0.0-rc.1 51 11/8/2026
11.0.0-preview06 68 11/8/2026
11.0.0-preview05 71 11/8/2026
11.0.0-preview04 74 11/6/2026
11.0.0-preview03 69 11/6/2026
11.0.0-preview02 74 11/6/2026
11.0.0-preview01 80 11/5/2026
10.3.0 227 11/5/2026
10.2.0 8,814 8/14/2026
10.1.0 458 8/13/2026
10.0.1 148 8/12/2026
10.0.0 134 8/12/2026
9.0.3 1,220 3/17/2025
9.0.3-debug 255 3/18/2025
9.0.2 250 3/17/2025
9.0.2-debug 246 3/17/2025
9.0.1 259 3/17/2025
9.0.1-debug 261 3/17/2025
Loading failed