DapperLike.SqlBulkCopy 0.1.7

.NET Standard 2.0 .NET Framework 4.5.1
Install-Package DapperLike.SqlBulkCopy -Version 0.1.7
dotnet add package DapperLike.SqlBulkCopy --version 0.1.7
<PackageReference Include="DapperLike.SqlBulkCopy" Version="0.1.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DapperLike.SqlBulkCopy --version 0.1.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DapperLike.SqlBulkCopy, 0.1.7"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install DapperLike.SqlBulkCopy as a Cake Addin
#addin nuget:?package=DapperLike.SqlBulkCopy&version=0.1.7

// Install DapperLike.SqlBulkCopy as a Cake Tool
#tool nuget:?package=DapperLike.SqlBulkCopy&version=0.1.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

SqlBulkCopy wrapper with Dapper-like API

Build status NuGet

This library wraps SqlBulkCopy class with Dapper-like API. It provides extension methods for IDbConnection (just like Dapper do), but will only work for SqlConnection (for obvious reasons).

Usage Example


    FirstName nvarchar(250),
    LastName nvarchar(250),
    Age int,
    Gender bit


public class User
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public int Age { get; set; }
    public bool Gender { get; set; }


IEnumerable<User> users = GetUsers();

All properties will be automatically mapped to table columns as well as the type name will be mapped to table name.

Let's check:

// Using Dapper to Query users:
IEnumerable<User> inserted = connection.Query<User>("SELECT * FROM [User]");

// Assert
Assert.IsTrue(users.SequenceEqual(inserted, new UserComparer())); // true
Simple data to single column
List<byte[]> blobs = GetBinaryData();
connection.BulkInsert(blobs, tableName: "dbo.Data", columnName: "Blob");

Table and column names must be specified explicitly since they cannot be inferred from type/prop names.

Anonymous types
IEnumerable<DomainObject> domainObjects = GetData();
var dto = domainObjects
    .Select(obj => new
        Foo = obj.Prop1,
        Bar = obj.Prop2.Normalize(),
        Baz = ConvertToBaz(obj.Prop3)
connection.BulkInsert(dto, tableName: "FooBar");

Column names can be inferred from anonymous type props, but table name from type name cannot, so again it must be specified explicitly.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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.1.7 233 3/21/2022
0.1.6 23,440 8/23/2018
0.1.5 1,283 7/6/2018
0.1.4 740 7/5/2018
0.1.3 661 7/4/2018
0.1.1 679 6/8/2018
0.1.0 800 5/1/2018