Install
dotnet add package ObjectBulkCopy --version 0.2.2
| Product | Versions |
|---|---|
| .NET |
README
ObjectBulkCopy
A super simple C# library for performing SqlBulkCopy directly on your CLR objects. No need to manually map properties--just plug in your list of objects and copy them to SQL Server with minimal setup. Ideal for high-performance data inserts in .NET applications.
Support Platform
- .NET 8.0+
How to use
using System.ComponentModel.DataAnnotations.Schema;
[Table("Users")] // must set table name
public class User
{
[Column("Id", Order = 0)] // must set zero-based order
public required int Id { get; init; }
[Column("Name", Order = 1)]
public required string Name { get; init; }
}
using ObjectBulkCopy;
using (var connection = new SqlConnection(...))
{
User[] records
= [
new(){ Id = 0, Name = "xin9le" },
new(){ Id = 1, Name = "Takaaki Suzuki" },
];
const SqlBulkCopyOptions options = SqlBulkCopyOptions.Default;
int? timeout = null;
var affectedCount = await connection.BulkInsertAsync(records, options, timeout, cancellationToken);
}
Installation
Getting started from downloading NuGet package.
dotnet add package ObjectBulkCopy
License
This library is provided under MIT License.
Author
Takaaki Suzuki (a.k.a @xin9le) is software developer in Japan who awarded Microsoft MVP for Developer Technologies (C#) since July 2012.
Changes from Previous Version
v0.2.1v0.2.2
Added Dependencies
System.Security.Cryptography.Pkcs(net10.0)
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.