PetToys.DbAssistant.Mssql 8.0.0

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

Database Assistant (Mssql)

Unit Test NuGet Version NuGet Downloads

promotion

DbAssistant.Mssql is the open source .net library with nice wrappers for SqlConnection.

Key features:

  • Accepts IEnumerable<TEntity>
  • Supports mapping of entity properties to table columns
  • Supports nullable value type properties
  • Supports reference types with nullable context. If the entity class does not have a nullable context, use an extra parameter in the converter.
  • Supports following property types:
    • bool
    • char
    • string
    • byte
    • short
    • int
    • long
    • float
    • double
    • decimal
    • DateTime
    • Guid
    • byte[]
    • char[]
  • For better performance, it is recommended to insert data into a temporary table that has no indexes or keys. After that, you can copy data from the temporary table to the target table.

Usage

using PetToys.DbAssistant.Mssql;

await using var connection = new SqlConnection(connectionString);
var result = await connection.CreateBulkContext<Entity>(tableName)
            .MapProperty(e => e.Int0)
            .MapProperty(e => e.Int1, "alias")
            .MapProperty(e => e.Date0)
            .MapProperty(e => e.Date1)
            .MapProperty(e => e.Str0)
            .MapProperty(e => e.Str1, referenceNullable: true)
            .MapProperty(e => e.Arr0)
            .MapProperty(e => e.Arr1)
            .WriteDataAsync(data, options =>
            {
                options.BulkCopyTimeout = 30;
            })

This package is created for my own needs. Requests for additional functionality and pull requests are welcome.


Provided under the Apache License, Version 2.0.

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 is compatible.  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 was computed.  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
8.0.0 467 4/28/2025

initial version