TypedParameters.Dapper.SqlServer 1.2.0

dotnet add package TypedParameters.Dapper.SqlServer --version 1.2.0
                    
NuGet\Install-Package TypedParameters.Dapper.SqlServer -Version 1.2.0
                    
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="TypedParameters.Dapper.SqlServer" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TypedParameters.Dapper.SqlServer" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="TypedParameters.Dapper.SqlServer" />
                    
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 TypedParameters.Dapper.SqlServer --version 1.2.0
                    
#r "nuget: TypedParameters.Dapper.SqlServer, 1.2.0"
                    
#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 TypedParameters.Dapper.SqlServer@1.2.0
                    
#: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=TypedParameters.Dapper.SqlServer&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=TypedParameters.Dapper.SqlServer&version=1.2.0
                    
Install as a Cake Tool

TypedParameters.Dapper.SqlServer

Explicitly typed SQL Server parameters for Dapper using Microsoft.Data.SqlClient.

Installation

dotnet add package TypedParameters.Dapper.SqlServer

Why use it?

Dapper parameter inference is convenient, but the provider metadata sent to SQL Server is not always obvious at the call site. This package lets code declare the known SQL Server parameter contract explicitly while preserving ordinary Dapper usage.

Quick start

using Dapper;
using Dapper.TypedParameters.SqlServer;
using Microsoft.Data.SqlClient;

await using var connection = new SqlConnection(connectionString);

var customer = await connection.QuerySingleOrDefaultAsync<Customer>(
    """
    SELECT Id, Document, Name
    FROM dbo.Customers
    WHERE Document = @Document;
    """,
    new
    {
        Document = SqlParam.VarChar(document, 11)
    });

Supported parameter types

Family Factories and metadata
Strings VarChar, NVarChar, Char, NChar, VarCharMax, NVarCharMax
Numeric Bit, TinyInt, SmallInt, Int, BigInt, Real, Float, Decimal, Money, SmallMoney
Binary / identifiers UniqueIdentifier, Binary, VarBinary, VarBinaryMax
Temporal Date, Time, DateTime, SmallDateTime, DateTime2, DateTimeOffset
Output parameters AsOutput(), AsInputOutput(), OutputValue, GetValue<T>()
Table-valued parameters TableValued(typeName, dataTable)

Explicit parameter metadata

TypedParameters.Dapper.SqlServer declares SQL Server metadata directly on the SqlParameter that Dapper materializes:

  • SqlDbType
  • Size
  • Precision
  • Scale
  • Direction

Output parameters

Scalar parameters can be converted to output or input/output parameters with AsOutput() and AsInputOutput(). Keep the same typed parameter instance that is passed to Dapper, then read OutputValue or GetValue<T>() after command execution completes.

Table-valued parameters

SqlParam.TableValued(typeName, dataTable) sends a SQL Server Structured parameter. The caller provides the DataTable and the name of an existing SQL Server user-defined table type. This package does not create table types, inspect schema, or map POCOs to DataTable.

Compatibility

  • net8.0
  • net10.0
  • Dapper
  • Microsoft.Data.SqlClient

What this package does not do

This package does not inspect database schema, query metadata, rewrite SQL, analyze execution plans, detect implicit conversions, choose SQL types automatically, create user-defined table types, map POCOs to table-valued parameters, or support System.Data.SqlClient.

Documentation

See the repository README and full documentation in the repository docs/ directory.

License

MIT.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
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
1.2.0 91 8/29/2026
1.0.2 98 8/27/2026
1.0.1 85 8/24/2026
1.0.0 131 8/11/2026
1.0.0-rc.1 249 8/11/2026
0.1.0-preview.1 80 8/10/2026