Ntxinh.EFCore.Bulks
10.0.0
dotnet add package Ntxinh.EFCore.Bulks --version 10.0.0
NuGet\Install-Package Ntxinh.EFCore.Bulks -Version 10.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="Ntxinh.EFCore.Bulks" Version="10.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ntxinh.EFCore.Bulks" Version="10.0.0" />
<PackageReference Include="Ntxinh.EFCore.Bulks" />
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 Ntxinh.EFCore.Bulks --version 10.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ntxinh.EFCore.Bulks, 10.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 Ntxinh.EFCore.Bulks@10.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=Ntxinh.EFCore.Bulks&version=10.0.0
#tool nuget:?package=Ntxinh.EFCore.Bulks&version=10.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Ntxinh.EFCore.Bulks
Simple bulk implementation in .NET
Nuget
https://www.nuget.org/packages/Ntxinh.EFCore.Bulks
Features
BulkInsertAsync()andDataTableHelper.CreateDataTable<T>()BulkInsertAsync<T>()BulkInsertMultipleTablesAsync()GenerateInsertQuery<T>()GenerateUpdateQuery<T>()GenerateDeleteQuery<T>()GenerateSelectQuery<T>()GenerateCreateTableQuery<T>()GenerateDropTableQuery<T>()GenerateTruncateTableQuery<T>()GenerateBulkUpdateQuery<T>()GenerateMergeUpsertQueryExtensions<T>()
How to use
using Ntxinh.EFCore.Bulks;
namespace MyProject;
using (var _dbContext = new DemoDbContext())
{
IEnumerable<DemoEntity> data = ...;
await _dbContext.BulkInsertAsync<DemoEntity>(data, null, connectionString);
await _dbContext.BulkInsertAsync(typeof(DemoEntity), DataTableHelper.CreateDataTable<DemoEntity>(data), null, connectionString);
await _dbContext.BulkInsertMultipleTablesAsync([new BulkInsertMultipleTablesDto { ClrEntityType = typeof(DemoEntity), DataTable = DataTableHelper.CreateDataTable<DemoEntity>(data) }], null, connectionString);
var createTableStr = _dbContext.GenerateCreateTableQuery<DemoEntity>();
Console.WriteLine($"Script Create Table: {createTableStr}");
var dropTableStr = _dbContext.GenerateDropTableQuery<DemoEntity>();
Console.WriteLine($"Script Drop Table: {dropTableStr}");
var truncateTableStr = _dbContext.GenerateTruncateTableQuery<DemoEntity>();
Console.WriteLine($"Script Truncate Table: {truncateTableStr}");
var insertQueryStr = _dbContext.GenerateInsertQuery<DemoEntity>();
Console.WriteLine($"Script Insert Table: {insertQueryStr}");
var (updateQueryStr, primaryKeyColumn) = _dbContext.GenerateUpdateQuery<DemoEntity>();
Console.WriteLine($"Script Update Table: {updateQueryStr}");
Console.WriteLine($"Script Primary Column Info: {primaryKeyColumn.ColumnName}, {primaryKeyColumn.DataType}");
var (deleteQueryStr, primaryKeyColumn2) = _dbContext.GenerateDeleteQuery<DemoEntity>();
Console.WriteLine($"Script Delete Table: {deleteQueryStr}");
Console.WriteLine($"Script Primary Column Info: {primaryKeyColumn2.ColumnName}, {primaryKeyColumn2.DataType}");
var selectQueryStr = _dbContext.GenerateSelectQuery<DemoEntity>();
Console.WriteLine($"Script Select Table: {selectQueryStr}");
var bulkUpdateData = new List<DemoEntity>
{
new DemoEntity
{
Id = 1,
Formula = "New Formula 1",
CategoryId = 1,
},
new DemoEntity
{
Id = 2,
Formula = "New Formula 2",
CategoryId = 2,
},
};
List<string> bulkUpdateColumns = ["Formula", "CategoryId"];
var bulkUpdateQueryStr = _dbContext.GenerateBulkUpdateQuery<DemoEntity>(bulkUpdateData, bulkUpdateColumns);
Console.WriteLine($"Script Bulk Update: {bulkUpdateQueryStr}");
}
How to push (Contributor only)
- Update version in
Ntxinh.EFCore.Bulks.csprojfirst
cd src/Ntxinh.EFCore.Bulks
dotnet clean && dotnet build
cd bin/Debug
dotnet nuget push Ntxinh.EFCore.Bulks.10.0.x.nupkg --api-key API_KEY --source https://api.nuget.org/v3/index.json
# dotnet nuget locals --clear all
TODO:
-
SqlTransaction:SqlBulkCopyOptions.UseInternalTransaction& existing transaction -
SqlBulkCopyOptions:SqlBulkCopyOptions.KeepIdentity -
BulkInsertAsync()andDataTableHelper.CreateDataTable<T>() -
BulkInsertAsync<T>() -
GenerateInsertQuery<T>() -
GenerateUpdateQuery<T>() -
GenerateDeleteQuery<T>() -
GenerateSelectQuery<T>() -
GenerateCreateTableQuery<T>() -
GenerateDropTableQuery<T>() -
GenerateTruncateTableQuery<T>() -
GenerateBulkUpdateQuery<T>() -
BulkInsertMultipleTablesAsync() -
GenerateMergeUpsertQuery<T>() -
GenerateMergeUpsertQuery<T>(isMulipleData: true, useTempTable: true)
| Product | Versions 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.EntityFrameworkCore (>= 10.0.0)
- Microsoft.EntityFrameworkCore.SqlServer (>= 10.0.0)
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 |
|---|---|---|
| 10.0.0 | 159 | 1/30/2026 |
| 8.0.14 | 7,560 | 5/19/2025 |
| 8.0.13 | 214 | 5/18/2025 |
| 8.0.12 | 220 | 5/18/2025 |
| 8.0.11 | 203 | 5/17/2025 |
| 8.0.10 | 168 | 5/17/2025 |
| 8.0.9 | 169 | 5/17/2025 |
| 8.0.8 | 179 | 5/17/2025 |
| 8.0.7 | 3,328 | 10/7/2024 |
| 8.0.6 | 168 | 10/7/2024 |
| 8.0.5 | 195 | 9/14/2024 |
| 8.0.4 | 455 | 9/14/2024 |
| 8.0.3 | 183 | 9/14/2024 |
| 8.0.2 | 187 | 9/13/2024 |
| 8.0.1 | 177 | 9/13/2024 |
| 1.0.6 | 194 | 9/13/2024 |
| 1.0.5 | 377 | 8/25/2024 |
| 1.0.4 | 200 | 8/25/2024 |
| 1.0.3 | 194 | 8/25/2024 |
| 1.0.2 | 216 | 8/25/2024 |
Loading failed