All Projects → phongnguyend → EntityFrameworkCore.SqlServer.SimpleBulks

phongnguyend / EntityFrameworkCore.SqlServer.SimpleBulks

Licence: MIT License
Very simple .net library (lightweight, easy to use and customize) that supports bulk insert (return db generated Ids), bulk update, bulk delete and bulk merge database operations. Lambda Expression is also supported.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to EntityFrameworkCore.SqlServer.SimpleBulks

EFSqlTranslator
A standalone linq to sql translator that can be used with EF and Dapper.
Stars: ✭ 51 (-46.32%)
Mutual labels:  netcore, efcore
XAF Security E4908
This repository contains examples for Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM
Stars: ✭ 47 (-50.53%)
Mutual labels:  netcore, entityframeworkcore
Efcore.bulkextensions
Entity Framework Core Bulk Batch Extensions for Insert Update Delete Read (CRUD), Truncate and SaveChanges operations on SQL Server, PostgreSQL, SQLite
Stars: ✭ 2,295 (+2315.79%)
Mutual labels:  efcore, entityframeworkcore
SignalR-Core-SqlTableDependency
Shows how the new SignalR Core works with hubs and sockets, also how it can integrate with SqlTableDependency API.
Stars: ✭ 36 (-62.11%)
Mutual labels:  netcore, entityframeworkcore
ormdb
ORM tool for .Net / .Net.Core
Stars: ✭ 14 (-85.26%)
Mutual labels:  netcore
AvroConvert
Apache Avro serializer for .NET
Stars: ✭ 44 (-53.68%)
Mutual labels:  netcore
Symbol
Symbol .net library
Stars: ✭ 14 (-85.26%)
Mutual labels:  netcore
WinReform
A simple tool to help resize and relocate stubborn windows.
Stars: ✭ 20 (-78.95%)
Mutual labels:  netcore
Sharer
Arduino & .NET serial communication library to read/write variables and remote call functions using the Sharer protocol. Works on Windows, Linux and MacOS.
Stars: ✭ 21 (-77.89%)
Mutual labels:  netcore
onvif-discovery
C# .NetStandard 2.0 library to discover ONVIF compliant devices
Stars: ✭ 29 (-69.47%)
Mutual labels:  netcore
WebApiJwt
Asp.NET Core 2.0 WebApi JWT Authentication with Identity & MySQL
Stars: ✭ 118 (+24.21%)
Mutual labels:  efcore
GenshinPray
一个.net core编写的模拟原神抽卡的api,根据米哈游公布的概率模拟生成十连或单抽结果图,并返回图片地址
Stars: ✭ 33 (-65.26%)
Mutual labels:  netcore
Kodkod
https://github.com/alirizaadiyahsi/Nucleus Web API layered architecture startup template with ASP.NET Core 2.1, EF Core 2.1 and Vue Client
Stars: ✭ 45 (-52.63%)
Mutual labels:  netcore
kafka-net-core
kafka .net core library
Stars: ✭ 23 (-75.79%)
Mutual labels:  netcore
EPPlus4PHP
an easy-to-use excel library for php project which is compiled with peachpie. NOT FOR THE COMMON PHP PROJECT!
Stars: ✭ 15 (-84.21%)
Mutual labels:  netcore
SockNet
The easiest and fastest way to work with sockets in C#
Stars: ✭ 42 (-55.79%)
Mutual labels:  netcore
nactivity
workflow engine activity activiti
Stars: ✭ 55 (-42.11%)
Mutual labels:  netcore
ddd-net-ef-core
Self study: DDD, .net core, entity framework core
Stars: ✭ 41 (-56.84%)
Mutual labels:  netcore
MyDAL
The fastest and best ORM lite on C# for MySQL ! -- 友好, 轻量, 极致性能, 无任何第三方依赖, 持续演进~~
Stars: ✭ 32 (-66.32%)
Mutual labels:  netcore
Cosmos.Identity
A Cosmos storage provider for ASP.NET Core Identity.
Stars: ✭ 26 (-72.63%)
Mutual labels:  netcore

EntityFrameworkCore.SqlServer.SimpleBulks

This is a very simple .net core library that can help to work with large number of records using the SqlBulkCopy class.  

Overview

This library provides extension methods so that you can use with your EntityFrameworkCore DbContext instance: DbContextExtensions.cs or you can use SqlConnectionExtensions.cs to work directly with a SqlConnection instance.

Nuget

https://www.nuget.org/packages/EntityFrameworkCore.SqlServer.SimpleBulks

EntityFrameworkCore.SqlServer.SimpleBulks supports:

  • Bulk Insert
  • Bulk Update
  • Bulk Delete
  • Bulk Merge

Examples

DbContextExtensions:

Using Lambda Expression:

using EntityFrameworkCore.SqlServer.SimpleBulks.BulkDelete;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkInsert;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkMerge;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkUpdate;

// Insert all columns
dbct.BulkInsert(rows);
dbct.BulkInsert(compositeKeyRows);

// Insert selected columns only
dbct.BulkInsert(rows,
    row => new { row.Column1, row.Column2, row.Column3 });
dbct.BulkInsert(compositeKeyRows,
    row => new { row.Id1, row.Id2, row.Column1, row.Column2, row.Column3 });

dbct.BulkUpdate(rows,
    row => new { row.Column3, row.Column2 });
dbct.BulkUpdate(compositeKeyRows,
    row => new { row.Column3, row.Column2 });

dbct.BulkMerge(rows,
    row => row.Id,
    row => new { row.Column1, row.Column2 },
    row => new { row.Column1, row.Column2, row.Column3 });
dbct.BulkMerge(compositeKeyRows,
    row => new { row.Id1, row.Id2 },
    row => new { row.Column1, row.Column2, row.Column3 },
    row => new { row.Id1, row.Id2, row.Column1, row.Column2, row.Column3 });
                        
dbct.BulkDelete(rows);
dbct.BulkDelete(compositeKeyRows);

Using Dynamic String:

using EntityFrameworkCore.SqlServer.SimpleBulks.BulkDelete;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkInsert;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkMerge;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkUpdate;

dbct.BulkUpdate(rows,
    new [] { "Column3", "Column2" });
dbct.BulkUpdate(compositeKeyRows,
    new [] { "Column3", "Column2" });

dbct.BulkMerge(rows,
    "Id",
    new [] { "Column1", "Column2" },
    new [] { "Column1", "Column2", "Column3" });
dbct.BulkMerge(compositeKeyRows,
    new [] { "Id1", "Id2" },
    new [] { "Column1", "Column2", "Column3" },
    new [] { "Id1", "Id2", "Column1", "Column2", "Column3" });

Using Builder Approach in case you need to mix both Dynamic & Lambda Expression:

new BulkInsertBuilder<Row>(dbct.GetSqlConnection())
	.WithData(rows)
	.WithColumns(row => new { row.Column1, row.Column2, row.Column3 })
	// or .WithColumns(new [] { "Column1", "Column2", "Column3" })
	.WithOuputId(row => row.Id)
	// or .WithOuputId("Id")
	.ToTable(dbct.GetTableName(typeof(Row)))
	// or .ToTable("Rows")
	.Execute();

SqlConnectionExtensions:

Using Lambda Expression:

using EntityFrameworkCore.SqlServer.SimpleBulks.BulkDelete;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkInsert;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkMerge;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkUpdate;

// Register Type - Table Name globaly
TableMapper.Register(typeof(Row), "Rows");
TableMapper.Register(typeof(CompositeKeyRow), "CompositeKeyRows");

connection.BulkInsert(rows,
           row => new { row.Column1, row.Column2, row.Column3 });
connection.BulkInsert(compositeKeyRows,
           row => new { row.Id1, row.Id2, row.Column1, row.Column2, row.Column3 });

connection.BulkUpdate(rows,
           row => row.Id,
           row => new { row.Column3, row.Column2 });
connection.BulkUpdate(compositeKeyRows,
           row => new { row.Id1, row.Id2 },
           row => new { row.Column3, row.Column2 });

connection.BulkMerge(rows,
           row => row.Id,
           row => new { row.Column1, row.Column2 },
           row => new { row.Column1, row.Column2, row.Column3 });
connection.BulkMerge(compositeKeyRows,
           row => new { row.Id1, row.Id2 },
           row => new { row.Column1, row.Column2, row.Column3 },
           row => new { row.Id1, row.Id2, row.Column1, row.Column2, row.Column3 });
                        
connection.BulkDelete(rows, row => row.Id);
connection.BulkDelete(compositeKeyRows, row => new { row.Id1, row.Id2 });

Using Dynamic String:

using EntityFrameworkCore.SqlServer.SimpleBulks.BulkDelete;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkInsert;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkMerge;
using EntityFrameworkCore.SqlServer.SimpleBulks.BulkUpdate;

connection.BulkInsert(rows, "Rows",
           new [] { "Column1", "Column2", "Column3" });
connection.BulkInsert(rows.Take(1000), "Rows",
           typeof(Row).GetDbColumnNames("Id"));
connection.BulkInsert(compositeKeyRows, "CompositeKeyRows",
           new [] { "Id1", "Id2", "Column1", "Column2", "Column3" });

connection.BulkUpdate(rows, "Rows",
           "Id",
           new [] { "Column3", "Column2" });
connection.BulkUpdate(compositeKeyRows, "CompositeKeyRows",
           new [] { "Id1", "Id2" },
           new [] { "Column3", "Column2" });

connection.BulkMerge(rows, "Rows",
           "Id",
           new [] { "Column1", "Column2" },
           new [] { "Column1", "Column2", "Column3" });
connection.BulkMerge(compositeKeyRows, "CompositeKeyRows",
           new [] { "Id1", "Id2" },
           new [] { "Column1", "Column2", "Column3" },
           new [] { "Id1", "Id2", "Column1", "Column2", "Column3" });

connection.BulkDelete(rows, "Rows", "Id");
connection.BulkDelete(compositeKeyRows, "CompositeKeyRows", new [] { "Id1", "Id2" });

Using Builder Approach in case you need to mix both Dynamic & Lambda Expression:

new BulkInsertBuilder<Row>(connection)
	.WithData(rows)
	.WithColumns(row => new { row.Column1, row.Column2, row.Column3 })
	// or .WithColumns(new [] { "Column1", "Column2", "Column3" })
	.WithOuputId(row => row.Id)
	// or .WithOuputId("Id")
	.ToTable("Rows")
	.Execute();

License

EntityFrameworkCore.SqlServer.SimpleBulks is licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].