BulkFlowKit.SqlServer
1.0.0
dotnet add package BulkFlowKit.SqlServer --version 1.0.0
NuGet\Install-Package BulkFlowKit.SqlServer -Version 1.0.0
<PackageReference Include="BulkFlowKit.SqlServer" Version="1.0.0" />
<PackageVersion Include="BulkFlowKit.SqlServer" Version="1.0.0" />
<PackageReference Include="BulkFlowKit.SqlServer" />
paket add BulkFlowKit.SqlServer --version 1.0.0
#r "nuget: BulkFlowKit.SqlServer, 1.0.0"
#:package BulkFlowKit.SqlServer@1.0.0
#addin nuget:?package=BulkFlowKit.SqlServer&version=1.0.0
#tool nuget:?package=BulkFlowKit.SqlServer&version=1.0.0
BulkFlowKit - Yüksek Performanslı EF Core Bulk Operations
BulkFlowKit, Entity Framework Core için profesyonel, yüksek performanslı bulk insert, update ve delete işlemleri sunan açık kaynak bir kütüphanedir.
Özellikler
- BulkInsert - Toplu veri ekleme
- BulkUpdate - Toplu veri güncelleme
- BulkDelete - Toplu veri silme
- 5 Veritabanı Desteği: SQL Server, PostgreSQL, MySQL, SQLite, Oracle
- EF Core 6, 8, 9, 10 desteği
- Batch Processing - Büyük veri setleri için otomatik batch işleme
- Progress Callback - İlerleme takibi
- Transaction Desteği - Mevcut transaction'lar ile uyumlu
- Primary Key Desteği - Tek ve çoklu kolonlu primary key'ler
Kurulum
SQL Server
dotnet add package BulkFlowKit.Core
dotnet add package BulkFlowKit.SqlServer
PostgreSQL
dotnet add package BulkFlowKit.Core
dotnet add package BulkFlowKit.PostgreSql
MySQL
dotnet add package BulkFlowKit.Core
dotnet add package BulkFlowKit.MySql
SQLite
dotnet add package BulkFlowKit.Core
dotnet add package BulkFlowKit.Sqlite
Oracle
dotnet add package BulkFlowKit.Core
dotnet add package BulkFlowKit.Oracle
Kullanım
BulkInsert
using BulkFlowKit.Core.Extensions;
using Microsoft.EntityFrameworkCore;
// Veritabanı bağlantınızı yapılandırın
var options = new DbContextOptionsBuilder<MyDbContext>()
.UseSqlServer("your-connection-string")
.Options;
await using var context = new MyDbContext(options);
// Toplu ekleme
var entities = Enumerable.Range(1, 10000)
.Select(i => new Product
{
Name = $"Product {i}",
Price = i * 10,
CreatedAt = DateTime.UtcNow
})
.ToList();
await context.BulkInsertAsync(entities);
BulkUpdate
// Önce verileri çekin
var products = await context.Products
.Where(p => p.Price < 100)
.ToListAsync();
// Güncellemeleri yapın
foreach (var product in products)
{
product.Price *= 1.1m; // %10 zam
}
// Toplu güncelleme
await context.BulkUpdateAsync(products);
BulkDelete
// Silinecek verileri çekin
var productsToDelete = await context.Products
.Where(p => p.CreatedAt < DateTime.UtcNow.AddYears(-1))
.ToListAsync();
// Toplu silme
await context.BulkDeleteAsync(productsToDelete);
Gelişmiş Kullanım
// Batch size ve progress callback ile
await context.BulkInsertAsync(entities, options =>
{
options.BatchSize = 1000; // Her batch'te 1000 kayıt
options.ProgressCallback = (processed) =>
{
Console.WriteLine($"İşlenen kayıt sayısı: {processed}");
};
});
// SQL Server için özel seçenekler
await context.BulkInsertAsync(entities, options =>
{
options.KeepIdentity = true; // Identity değerlerini koru
options.FireTriggers = true; // Trigger'ları tetikle
options.BatchSize = 5000;
});
Desteklenen Veritabanları
| Veritabanı | BulkInsert | BulkUpdate | BulkDelete |
|---|---|---|---|
| SQL Server | SqlBulkCopy | MERGE | DELETE WHERE IN |
| PostgreSQL | COPY | UPDATE FROM | DELETE USING |
| MySQL | MySqlBulkCopy | INSERT ON DUPLICATE | DELETE WHERE IN |
| SQLite | Batched INSERT | UPDATE WHERE IN | DELETE WHERE IN |
| Oracle | OracleBulkCopy | MERGE INTO | DELETE WHERE IN |
Gereksinimler
- .NET 6.0, 8.0, 9.0 veya 10.0
- Entity Framework Core 6.0, 8.0, 9.0 veya 10.0
- İlgili veritabanı provider'ı (örn:
Microsoft.EntityFrameworkCore.SqlServer)
Yapılandırma
BulkFlowKit otomatik olarak kayıt yapılır (Module Initializer kullanarak). Herhangi bir ek yapılandırma gerekmez.
// Sadece ilgili provider paketini yükleyin ve kullanmaya başlayın!
// Otomatik kayıt için:
_ = typeof(BulkFlowKit.SqlServer.SqlServerBulkOperationExecutor); // SQL Server için
Performans
BulkFlowKit, standart EF Core SaveChanges() metoduna göre 10-100x daha hızlı performans sunar:
- 1 milyon kayıt insert: ~5-10 saniye (EF Core: ~5-10 dakika)
- 100 bin kayıt update: ~2-5 saniye (EF Core: ~2-5 dakika)
- 50 bin kayıt delete: ~1-3 saniye (EF Core: ~1-3 dakika)
Not: Performans veritabanı, network ve donanıma göre değişiklik gösterebilir.
Örnek Entity
public class Product
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public decimal Price { get; set; }
public DateTime CreatedAt { get; set; }
}
public class MyDbContext : DbContext
{
public MyDbContext(DbContextOptions<MyDbContext> options)
: base(options)
{
}
public DbSet<Product> Products { get; set; } = null!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Product>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
}
}
Bilinen Sınırlamalar
- MySQL/SQLite/Oracle: Aktif DbContext transaction içinde bulk operasyonlar desteklenmiyor
- SQLite/Oracle:
KeepIdentityseçeneği desteklenmiyor - Primary Key Gereklidir: BulkUpdate ve BulkDelete için entity'lerin primary key'e sahip olması gerekir
Lisans
MIT License - Detaylar için LICENSE dosyasına bakın.
Katkıda Bulunma
Katkılarınızı bekliyoruz! Lütfen issue açmadan önce mevcut issue'ları kontrol edin.
İletişim
Sorularınız için issue açabilirsiniz.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 was computed. 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. |
-
net6.0
- BulkFlowKit.Core (>= 1.0.0)
- Microsoft.Data.SqlClient (>= 5.2.0)
- Microsoft.EntityFrameworkCore.SqlServer (>= 6.0.35)
-
net8.0
- BulkFlowKit.Core (>= 1.0.0)
- Microsoft.Data.SqlClient (>= 5.2.0)
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.3)
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 |
|---|
Initial release of BulkFlowKit.SqlServer - SQL Server provider for high-performance bulk operations with Entity Framework Core.