Z.EntityFramework.Extensions 3.16.4

Entity Framework: Bulk Insert, BulkSaveChanges, Bulk Update, Bulk Delete, Bulk Merge, and Bulk Synchronize.

Support: SQL Server, SQL Azure, SQL Compact, Oracle, MySQL, SQLite, and PostgreSQL.

This library is NOT FREE. Trial period always stops at the end of the month.

There is a newer version of this package available.
See the version list below for details.
Install-Package Z.EntityFramework.Extensions -Version 3.16.4
dotnet add package Z.EntityFramework.Extensions --version 3.16.4
paket add Z.EntityFramework.Extensions --version 3.16.4
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.11 155 11/9/2018
3.16.10 470 11/6/2018
3.16.9 1,442 10/30/2018
3.16.8 233 10/28/2018
3.16.7 587 10/23/2018
3.16.6 47 10/23/2018
3.16.5 1,685 10/16/2018
3.16.4 153 10/15/2018
3.16.3 1,270 10/8/2018
3.16.2 5,177 9/29/2018
3.16.1 425 9/27/2018
3.16.0 2,642 9/13/2018
3.15.22 406 9/12/2018
3.15.21 109 9/11/2018
3.15.20 1,951 9/1/2018
3.15.19 642 8/30/2018
3.15.17 6,807 8/2/2018
3.15.16 146 8/2/2018
3.15.15 2,343 7/31/2018
3.15.14 484 7/31/2018
3.15.12 1,131 7/25/2018
3.15.11 148 7/25/2018
3.15.10 106 7/25/2018
3.15.9 1,095 7/20/2018
3.15.8 347 7/19/2018
3.15.7 81 7/19/2018
3.15.6 1,052 7/16/2018
3.15.5 1,868 7/8/2018
3.15.4 7,537 6/29/2018
3.15.3 2,139 6/21/2018
3.15.2 496 6/20/2018
3.15.1 280 6/19/2018
3.15.0 2,691 6/12/2018
3.14.33 4,124 6/5/2018
3.14.32 2,677 6/1/2018
3.14.31 714 5/31/2018
3.14.30 199 5/30/2018
3.14.29 946 5/27/2018
3.14.28 1,938 5/25/2018
3.14.27 1,139 5/22/2018
3.14.26 2,898 5/9/2018
3.14.25 5,157 5/1/2018
3.14.24 6,567 4/23/2018
3.14.23 2,799 4/17/2018
3.14.22 570 4/16/2018
3.14.21 440 4/13/2018
3.14.20 413 4/11/2018
3.14.19 339 4/11/2018
3.14.18 2,473 4/7/2018
3.14.17 3,474 3/30/2018
3.14.16 218 3/29/2018
3.14.14 1,262 3/27/2018
3.14.13 1,062 3/25/2018
3.14.12 4,508 3/5/2018
3.14.11 1,881 2/28/2018
3.14.10 1,628 2/27/2018
3.14.9 1,024 2/22/2018
3.14.8 8,761 2/14/2018
3.14.7 20,063 1/31/2018
3.14.5 18,616 1/3/2018
3.14.4 2,706 12/28/2017
3.14.3 2,753 12/19/2017
3.14.2 262 12/19/2017
3.14.1 746 12/14/2017
3.14.0 6,652 11/30/2017
3.13.16 722 11/27/2017
3.13.14 163 11/27/2017
3.13.13 2,424 11/20/2017
3.13.12 4,352 11/9/2017
3.13.11 571 11/7/2017
3.13.10 1,353 11/2/2017
3.13.9 3,464 10/30/2017
3.13.8 641 10/26/2017
3.13.7 201 10/26/2017
3.13.6 1,715 10/22/2017
3.13.5 3,084 10/16/2017
3.13.4 415 10/13/2017
3.13.3 4,965 10/4/2017
3.13.2 6,708 9/30/2017
3.13.1 1,421 9/27/2017
3.13.0 2,702 9/25/2017
3.12.27 1,291 9/18/2017
3.12.26 1,902 9/12/2017
3.12.25 150 9/12/2017
3.12.24 1,562 9/6/2017
3.12.23 15,430 8/31/2017
3.12.22 695 8/31/2017
3.12.21 193 8/30/2017
3.12.20 3,092 8/28/2017
3.12.19 5,330 8/15/2017
3.12.18 923 8/11/2017
3.12.17 1,242 8/6/2017
3.12.16 477 8/3/2017
3.12.15 30,086 7/25/2017
3.12.14 4,289 7/12/2017
3.12.13 1,929 7/4/2017
3.12.12 178 7/4/2017
3.12.11 646 7/3/2017
3.12.10 1,091 7/2/2017
3.12.9 5,933 6/29/2017
3.11.20 2,009 4/30/2017
Show less