Z.EntityFramework.Extensions.EF5 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.

There is a newer version of this package available.
See the version list below for details.
Install-Package Z.EntityFramework.Extensions.EF5 -Version 3.16.5
dotnet add package Z.EntityFramework.Extensions.EF5 --version 3.16.5
<PackageReference Include="Z.EntityFramework.Extensions.EF5" Version="3.16.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Z.EntityFramework.Extensions.EF5 --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; }
	}
}

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
3.22.7 26 9/11/2019
3.22.6 25 9/10/2019
3.22.5 24 9/5/2019
3.22.4 53 8/30/2019
3.22.3 38 8/26/2019
3.22.2 41 8/24/2019
3.22.1 46 8/19/2019
3.22.0 45 8/17/2019
3.21.13 43 8/16/2019
3.21.12 45 8/15/2019
3.21.11 68 8/5/2019
3.21.10 63 7/31/2019
3.21.9 54 7/28/2019
3.21.8 56 7/24/2019
3.21.7 63 7/17/2019
3.21.6 58 7/16/2019
3.21.5 61 7/11/2019
3.21.4 68 7/9/2019
3.21.2 75 6/29/2019
3.21.1 62 6/28/2019
3.21.0 63 6/26/2019
3.20.7 61 6/25/2019
3.20.6 64 6/20/2019
3.20.5 66 6/18/2019
3.20.4 61 6/18/2019
3.20.3 62 6/18/2019
3.20.2 62 6/17/2019
3.20.1 84 6/14/2019
3.20.0 65 6/13/2019
3.19.0 97 6/4/2019
3.18.6 99 6/4/2019
3.18.5 108 5/30/2019
3.18.4 75 5/28/2019
3.18.3 98 5/14/2019
3.18.2 91 5/14/2019
3.18.1 76 5/9/2019
3.18.0 89 5/7/2019
3.17.8 104 4/30/2019
3.17.7 118 4/25/2019
3.17.6 99 4/18/2019
3.17.5 126 4/16/2019
3.17.4 107 4/11/2019
3.17.3 124 4/8/2019
3.17.1 111 3/30/2019
3.17.0 101 3/30/2019
3.16.45 104 3/27/2019
3.16.44 106 3/27/2019
3.16.43 137 3/23/2019
3.16.41 106 3/19/2019
3.16.40 109 3/15/2019
3.16.39 102 3/15/2019
3.16.38 102 3/15/2019
3.16.37 100 3/13/2019
3.16.36 88 3/12/2019
3.16.35 96 3/12/2019
3.16.34 101 3/12/2019
3.16.33 101 3/8/2019
3.16.32 110 3/8/2019
3.16.30 133 3/1/2019
3.16.29 111 2/28/2019
3.16.28 132 2/27/2019
3.16.27 109 2/25/2019
3.16.26 120 2/24/2019
3.16.25 122 2/21/2019
3.16.24 164 2/12/2019
3.16.23 154 1/30/2019
3.16.22 206 1/18/2019
3.16.21 157 1/15/2019
3.16.20 162 1/14/2019
3.16.19 271 1/8/2019
3.16.18 183 12/30/2018
3.16.17 156 12/20/2018
3.16.16 122 12/15/2018
3.16.15 155 12/7/2018
3.16.14 186 11/29/2018
3.16.13 154 11/28/2018
3.16.12 151 11/20/2018
3.16.11 216 11/9/2018
3.16.10 155 11/6/2018
3.16.8 169 10/28/2018
3.16.7 155 10/23/2018
3.16.6 147 10/23/2018
3.16.5 161 10/16/2018
3.16.4 159 10/15/2018
3.16.3 167 10/8/2018
3.16.2 151 9/29/2018
3.16.1 155 9/27/2018
3.16.0 174 9/13/2018
3.15.22 155 9/12/2018
3.15.21 168 9/11/2018
3.15.20 211 9/1/2018
3.15.19 178 8/30/2018
3.15.18 237 8/3/2018
3.15.17 229 8/2/2018
3.15.16 230 8/2/2018
3.15.14 190 7/31/2018
3.15.13 194 7/31/2018
3.15.12 224 7/25/2018
3.15.11 187 7/25/2018
3.15.10 192 7/25/2018
3.15.9 202 7/20/2018
3.15.8 232 7/19/2018
3.15.7 221 7/19/2018
3.15.6 274 7/16/2018
3.15.5 242 7/8/2018
3.15.4 236 6/29/2018
3.15.3 249 6/21/2018
3.15.0 236 6/12/2018
3.14.33 239 6/5/2018
3.14.32 263 6/1/2018
3.14.31 237 5/31/2018
3.14.30 249 5/30/2018
3.14.29 232 5/27/2018
3.14.28 253 5/25/2018
3.14.27 251 5/22/2018
3.14.26 270 5/9/2018
3.14.25 256 5/1/2018
3.14.24 250 4/23/2018
3.14.23 252 4/17/2018
3.14.22 262 4/16/2018
3.14.21 401 4/13/2018
3.14.20 268 4/11/2018
3.14.19 352 4/11/2018
3.14.18 413 4/7/2018
3.14.17 450 3/30/2018
3.14.16 263 3/29/2018
3.14.14 239 3/27/2018
3.14.13 263 3/25/2018
3.14.12 329 3/5/2018
3.14.11 277 2/28/2018
3.14.10 293 2/27/2018
3.14.9 250 2/22/2018
3.14.8 300 2/14/2018
3.14.7 293 1/31/2018
3.14.6 300 1/17/2018
3.14.5 346 1/3/2018
3.14.4 241 12/28/2017
3.14.3 363 12/19/2017
3.14.2 275 12/19/2017
3.14.1 254 12/14/2017
3.14.0 282 11/30/2017
3.13.16 282 11/27/2017
3.13.15 227 11/27/2017
3.13.14 217 11/27/2017
3.13.13 249 11/20/2017
3.13.12 265 11/9/2017
3.13.11 263 11/7/2017
3.13.9 239 10/30/2017
3.13.8 263 10/26/2017
3.13.7 237 10/26/2017
3.13.6 244 10/22/2017
3.13.5 239 10/16/2017
3.13.4 245 10/13/2017
3.13.3 247 10/4/2017
3.13.2 266 9/30/2017
3.13.1 235 9/27/2017
3.13.0 259 9/25/2017
3.12.27 289 9/18/2017
3.12.26 278 9/12/2017
3.12.25 234 9/12/2017
3.12.24 239 9/6/2017
3.12.23 252 8/31/2017
3.12.22 236 8/31/2017
3.12.21 249 8/30/2017
3.12.20 252 8/28/2017
3.12.19 5,773 8/15/2017
3.12.18 247 8/11/2017
3.12.17 263 8/6/2017
3.12.16 257 8/3/2017
3.12.15 282 7/25/2017
3.12.14 278 7/12/2017
3.12.13 294 7/4/2017
3.12.12 311 7/4/2017
3.12.11 274 7/3/2017
3.12.10 298 7/2/2017
3.12.9 284 6/29/2017
Show less