TAMS EF Bulk provides methods for optimized bulk operations in Entity Framework using DataTables. This library aims to improve the performance of bulk insert and merge operations by leveraging DataTables and SqlBulkCopy.
- Bulk Insert
- Bulk Merge
- Support for multiple .NET frameworks:
- .NET Core 3.1
- .NET 4.5
- .NET 8.0
You can install the package via NuGet Package Manager:
dotnet add package TAMS.EfBulk
Or via the Package Manager Console in Visual Studio:
Install-Package TAMS.EfBulk
Here's a basic example of how to use the library for bulk insert and merge operations:
using TAMS.EfBulk;
using Microsoft.EntityFrameworkCore;
using System.Data;
public class MyDbContext : DbContext
{
// Your DbSet properties
}
public class MyEntity
{
// Your entity properties
}
public class Example
{
public async Task BulkOperationsAsync()
{
using var context = new MyDbContext();
// Bulk Insert
DataTable dataTable = await context.CreateDataTableAsync<MyEntity>();
// Fill dataTable with data
await context.BulkInsertAsync<MyEntity>(dataTable);
// Bulk Merge
await context.BulkMergeAsync<MyEntity>(dataTable, allowInsert: true, allowDelete: false);
}
}
For detailed documentation, refer to the official documentation.
Contributions are welcome! Please read our contributing guidelines for more information.
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
- Trais McAllister - Initial work - True Analytics Manufacturing Solutions, LLC
- Special thanks to the developers and contributors who have helped in creating and maintaining this project.
- Initial release.
Feel free to reach out if you have any questions or need further assistance!