Z.EntityFramework.Extensions 3.16.5

Entity Framework Extensions extends your DbContext with high-performance bulk operations: BulkSaveChanges, BulkInsert, BulkUpdate, BulkDelete, BulkMerge, and more.

Example: https://dotnetfiddle.net/awlJdf
Benchmark: https://dotnetfiddle.net/35mQ0W

Include free and prime features.

Install-Package Z.EntityFramework.Extensions -Version 3.16.5
dotnet add package Z.EntityFramework.Extensions --version 3.16.5
paket add Z.EntityFramework.Extensions --version 3.16.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
// Fiddle: https://dotnetfiddle.net/awlJdf
// @nuget: EntityFramework
// @nuget: Z.EntityFramework.Extensions
// Website: https://entityframework-extensions.net/

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Data.Entity;
public class Program
{
	public static List<BenchmarkResult> BenchmarkResults = new List<BenchmarkResult>();
	
	public static void Main()
	{
		JustInTime_Compile();
		
		// Generate X entities
		var customers = GenerateCustomers(1000);
		var inactiveCustomers = customers.Where(x => !x.IsActive).ToList();
		
		var clockInsert = new Stopwatch();
		var clockUpdate = new Stopwatch();
		var clockDelete = new Stopwatch();
		
		using (var context = new EntityContext())
		{
			// BulkInsert
			{
				clockInsert.Start();
				context.BulkInsert(customers);
				clockInsert.Stop();
				
				BenchmarkResults.Add(new BenchmarkResult() { Action = "BulkInsert", Entities = customers.Count, Performance = clockInsert.ElapsedMilliseconds + " ms" });
			}
			
			// BulkUpdate
			{
				inactiveCustomers.ForEach(x => x.Name = "zzz;" + x.Name);
				clockUpdate.Start();
				context.BulkUpdate(inactiveCustomers);
				clockUpdate.Stop();
				
				BenchmarkResults.Add(new BenchmarkResult() { Action = "BulkUpdate", Entities = inactiveCustomers.Count, Performance = clockUpdate.ElapsedMilliseconds + " ms" });
			}
			
			// BulkDelete
			{
				clockDelete.Start();
				context.BulkDelete(inactiveCustomers);
				clockDelete.Stop();
				
				BenchmarkResults.Add(new BenchmarkResult() { Action = "BulkDelete", Entities = inactiveCustomers.Count, Performance = clockDelete.ElapsedMilliseconds + " ms" });
			}
		}
		
		FiddleHelper.WriteTable("EFE - Easy to use, easy to customize!", BenchmarkResults);
	}
		 
	public static void JustInTime_Compile()
	{
		var customers = GenerateCustomers(10);
		
		using (var context = new EntityContext())
		{
			context.BulkInsert(customers);
			context.BulkDelete(customers);
		}
	}
	
	public static List<Customer> GenerateCustomers(int count)
	{
		var list = new List<Customer>();
		
		for(int i = 0; i < count; i++)
		{
			list.Add(new Customer() { Name = "Customer_" + i, Description = "Description_" +  i, IsActive = i % 2 == 0 });
		}

		return list;
	}

	public class EntityContext : DbContext
	{
		public EntityContext() : base(FiddleHelper.GetConnectionStringSqlServer())
		{

		}
		
		public DbSet<Customer> Customers { get; set; }
	}

	public class Customer
	{
		public int CustomerID { get; set; }
		public string Name { get; set; }
		public string Description { get; set; }
		public Boolean IsActive { get; set; }
	}
	
	public class BenchmarkResult
	{
		public string Action { get; set; }
		public int Entities { get; set; }
		public string Performance { get; set; }
	}
}
// Fiddle: https://dotnetfiddle.net/awlJdf
// @nuget: EntityFramework
// @nuget: Z.EntityFramework.Extensions
// Website: https://entityframework-extensions.net/

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Data.Entity;
public class Program
{
	public static List<BenchmarkResult> BenchmarkResults = new List<BenchmarkResult>();
	
	public static void Main()
	{
		JustInTime_Compile();
		
		// Generate X entities
		var customers = GenerateCustomers(1000);
		var inactiveCustomers = customers.Where(x => !x.IsActive).ToList();
		
		var clockInsert = new Stopwatch();
		var clockUpdate = new Stopwatch();
		var clockDelete = new Stopwatch();
		
		using (var context = new EntityContext())
		{
			// BulkInsert
			{
				clockInsert.Start();
				context.BulkInsert(customers);
				clockInsert.Stop();
				
				BenchmarkResults.Add(new BenchmarkResult() { Action = "BulkInsert", Entities = customers.Count, Performance = clockInsert.ElapsedMilliseconds + " ms" });
			}
			
			// BulkUpdate
			{
				inactiveCustomers.ForEach(x => x.Name = "zzz;" + x.Name);
				clockUpdate.Start();
				context.BulkUpdate(inactiveCustomers);
				clockUpdate.Stop();
				
				BenchmarkResults.Add(new BenchmarkResult() { Action = "BulkUpdate", Entities = inactiveCustomers.Count, Performance = clockUpdate.ElapsedMilliseconds + " ms" });
			}
			
			// BulkDelete
			{
				clockDelete.Start();
				context.BulkDelete(inactiveCustomers);
				clockDelete.Stop();
				
				BenchmarkResults.Add(new BenchmarkResult() { Action = "BulkDelete", Entities = inactiveCustomers.Count, Performance = clockDelete.ElapsedMilliseconds + " ms" });
			}
		}
		
		FiddleHelper.WriteTable("EFE - Easy to use, easy to customize!", BenchmarkResults);
	}
		 
	public static void JustInTime_Compile()
	{
		var customers = GenerateCustomers(10);
		
		using (var context = new EntityContext())
		{
			context.BulkInsert(customers);
			context.BulkDelete(customers);
		}
	}
	
	public static List<Customer> GenerateCustomers(int count)
	{
		var list = new List<Customer>();
		
		for(int i = 0; i < count; i++)
		{
			list.Add(new Customer() { Name = "Customer_" + i, Description = "Description_" +  i, IsActive = i % 2 == 0 });
		}

		return list;
	}

	public class EntityContext : DbContext
	{
		public EntityContext() : base(FiddleHelper.GetConnectionStringSqlServer())
		{

		}
		
		public DbSet<Customer> Customers { get; set; }
	}

	public class Customer
	{
		public int CustomerID { get; set; }
		public string Name { get; set; }
		public string Description { get; set; }
		public Boolean IsActive { get; set; }
	}
	
	public class BenchmarkResult
	{
		public string Action { get; set; }
		public int Entities { get; set; }
		public string Performance { get; set; }
	}
}

Version History

Version Downloads Last updated
3.16.5 13 10/16/2018
3.16.4 93 10/15/2018
3.16.3 645 10/8/2018
3.16.2 2,607 9/29/2018
3.16.1 337 9/27/2018
3.16.0 2,254 9/13/2018
3.15.22 372 9/12/2018
3.15.21 97 9/11/2018
3.15.20 1,739 9/1/2018
3.15.19 610 8/30/2018
3.15.17 5,756 8/2/2018
3.15.16 120 8/2/2018
3.15.15 2,129 7/31/2018
3.15.14 456 7/31/2018
3.15.12 1,063 7/25/2018
3.15.11 124 7/25/2018
3.15.10 78 7/25/2018
3.15.9 1,055 7/20/2018
3.15.8 253 7/19/2018
3.15.7 53 7/19/2018
3.15.6 953 7/16/2018
3.15.5 1,703 7/8/2018
3.15.4 6,119 6/29/2018
3.15.3 1,884 6/21/2018
3.15.2 454 6/20/2018
3.15.1 250 6/19/2018
3.15.0 2,539 6/12/2018
3.14.33 4,066 6/5/2018
3.14.32 2,429 6/1/2018
3.14.31 674 5/31/2018
3.14.30 171 5/30/2018
3.14.29 763 5/27/2018
3.14.28 1,063 5/25/2018
3.14.27 1,103 5/22/2018
3.14.26 2,701 5/9/2018
3.14.25 4,983 5/1/2018
3.14.24 6,469 4/23/2018
3.14.23 2,198 4/17/2018
3.14.22 540 4/16/2018
3.14.21 407 4/13/2018
3.14.20 383 4/11/2018
3.14.19 312 4/11/2018
3.14.18 2,251 4/7/2018
3.14.17 3,395 3/30/2018
3.14.16 188 3/29/2018
3.14.14 1,149 3/27/2018
3.14.13 889 3/25/2018
3.14.12 4,350 3/5/2018
3.14.11 1,788 2/28/2018
3.14.10 1,599 2/27/2018
3.14.9 861 2/22/2018
3.14.8 8,019 2/14/2018
3.14.7 19,352 1/31/2018
3.14.5 17,376 1/3/2018
3.14.4 2,621 12/28/2017
3.14.3 2,714 12/19/2017
3.14.2 233 12/19/2017
3.14.1 711 12/14/2017
3.14.0 6,536 11/30/2017
3.13.16 680 11/27/2017
3.13.14 138 11/27/2017
3.13.13 2,273 11/20/2017
3.13.12 4,157 11/9/2017
3.13.11 537 11/7/2017
3.13.10 1,318 11/2/2017
3.13.9 3,323 10/30/2017
3.13.8 614 10/26/2017
3.13.7 176 10/26/2017
3.13.6 1,626 10/22/2017
3.13.5 2,936 10/16/2017
3.13.4 389 10/13/2017
3.13.3 4,816 10/4/2017
3.13.2 6,234 9/30/2017
3.13.1 1,322 9/27/2017
3.13.0 2,518 9/25/2017
3.12.27 1,158 9/18/2017
3.12.26 1,862 9/12/2017
3.12.25 122 9/12/2017
3.12.24 1,533 9/6/2017
3.12.23 14,800 8/31/2017
3.12.22 669 8/31/2017
3.12.21 167 8/30/2017
3.12.20 2,880 8/28/2017
3.12.19 5,297 8/15/2017
3.12.18 852 8/11/2017
3.12.17 1,193 8/6/2017
3.12.16 448 8/3/2017
3.12.15 26,901 7/25/2017
3.12.14 4,240 7/12/2017
3.12.13 1,718 7/4/2017
3.12.12 152 7/4/2017
3.12.11 618 7/3/2017
3.12.10 1,051 7/2/2017
3.12.9 5,700 6/29/2017
3.11.20 1,971 4/30/2017