Z.EntityFramework.Extensions.EF4 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.EF4 -Version 3.16.5
dotnet add package Z.EntityFramework.Extensions.EF4 --version 3.16.5
<PackageReference Include="Z.EntityFramework.Extensions.EF4" 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.EF4 --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; }
	}
}

GitHub repositories (0)

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
4.0.79 103 6/16/2020
4.0.78 175 6/13/2020
4.0.76 112 6/3/2020
4.0.75 81 5/22/2020
4.0.73 115 5/18/2020
4.0.72 43 5/14/2020
4.0.71 48 5/12/2020
4.0.70 41 5/11/2020
4.0.69 61 5/5/2020
4.0.68 63 4/29/2020
4.0.67 64 4/22/2020
4.0.66 54 4/22/2020
4.0.65 65 4/17/2020
4.0.64 75 4/15/2020
4.0.63 76 4/8/2020
4.0.62 84 4/7/2020
4.0.61 79 4/2/2020
4.0.60 115 4/1/2020
4.0.59 97 3/23/2020
4.0.58 81 3/23/2020
4.0.57 120 3/16/2020
4.0.56 103 3/10/2020
4.0.55 93 3/10/2020
4.0.54 190 3/3/2020
4.0.53 108 2/27/2020
4.0.52 68 2/25/2020
4.0.51 100 2/24/2020
4.0.50 83 2/19/2020
4.0.49 86 2/17/2020
4.0.48 77 2/17/2020
4.0.47 152 2/11/2020
4.0.46 142 2/8/2020
4.0.45 182 2/7/2020
4.0.44 141 2/6/2020
4.0.43 77 2/3/2020
4.0.42 98 1/31/2020
4.0.40 124 1/29/2020
4.0.39 72 1/28/2020
4.0.35 84 1/9/2020
4.0.34 182 12/29/2019
4.0.33 178 12/29/2019
4.0.30 120 12/16/2019
4.0.29 89 12/13/2019
4.0.28 93 12/13/2019
4.0.27 101 12/13/2019
4.0.24 102 12/4/2019
4.0.23 87 12/4/2019
4.0.22 113 12/4/2019
4.0.21 104 12/3/2019
4.0.20 97 11/21/2019
4.0.19 87 11/20/2019
4.0.18 86 11/20/2019
4.0.13 96 11/14/2019
4.0.12 104 10/30/2019
4.0.11 100 10/23/2019
4.0.10 94 10/21/2019
4.0.9 111 10/10/2019
4.0.7 96 10/8/2019
4.0.6 111 10/1/2019
4.0.5 107 9/27/2019
4.0.4 113 9/26/2019
4.0.3 122 9/25/2019
4.0.2 103 9/23/2019
4.0.1 108 9/21/2019
4.0.0 102 9/20/2019
4.0.0-beta1 95 9/17/2019
3.22.7 114 9/11/2019
3.22.6 113 9/10/2019
3.22.5 110 9/5/2019
3.22.4 119 8/30/2019
3.22.3 120 8/26/2019
3.22.2 126 8/24/2019
3.22.1 124 8/19/2019
3.22.0 124 8/17/2019
3.21.13 125 8/16/2019
3.21.12 144 8/15/2019
3.21.11 145 8/5/2019
3.21.10 147 7/31/2019
3.21.9 148 7/28/2019
3.21.8 152 7/24/2019
3.21.7 139 7/17/2019
3.21.6 158 7/16/2019
3.21.5 150 7/11/2019
3.21.4 159 7/9/2019
3.21.2 160 6/29/2019
3.21.1 154 6/28/2019
3.21.0 159 6/26/2019
3.20.8 150 7/24/2019
3.20.7 152 6/25/2019
3.20.6 153 6/20/2019
3.20.5 171 6/18/2019
3.20.4 150 6/18/2019
3.20.2 162 6/17/2019
3.20.1 167 6/14/2019
3.20.0 156 6/13/2019
3.19.0 179 6/4/2019
3.18.6 188 6/4/2019
3.18.5 175 5/30/2019
3.18.4 170 5/28/2019
3.18.3 172 5/14/2019
3.18.2 173 5/14/2019
3.18.1 163 5/9/2019
3.18.0 186 5/7/2019
3.17.8 191 4/30/2019
3.17.7 193 4/25/2019
3.17.6 188 4/18/2019
3.17.5 194 4/16/2019
3.17.4 201 4/11/2019
3.17.3 188 4/8/2019
3.17.1 201 3/30/2019
3.17.0 177 3/30/2019
3.16.45 189 3/27/2019
3.16.44 193 3/27/2019
3.16.43 219 3/23/2019
3.16.41 212 3/19/2019
3.16.40 206 3/15/2019
3.16.39 204 3/15/2019
3.16.38 191 3/15/2019
3.16.37 185 3/13/2019
3.16.36 187 3/12/2019
3.16.35 198 3/12/2019
3.16.34 194 3/12/2019
3.16.33 204 3/8/2019
3.16.32 195 3/8/2019
3.16.30 215 3/1/2019
3.16.29 195 2/28/2019
3.16.28 199 2/27/2019
3.16.27 188 2/25/2019
3.16.26 215 2/24/2019
3.16.25 203 2/21/2019
3.16.24 227 2/12/2019
3.16.23 226 1/30/2019
3.16.22 267 1/18/2019
3.16.21 249 1/15/2019
3.16.20 271 1/14/2019
3.16.19 269 1/8/2019
3.16.18 248 12/30/2018
3.16.17 232 12/20/2018
3.16.16 220 12/15/2018
3.16.15 280 12/7/2018
3.16.14 242 11/29/2018
3.16.13 252 11/28/2018
3.16.12 209 11/20/2018
3.16.11 297 11/9/2018
3.16.10 224 11/6/2018
3.16.8 266 10/28/2018
3.16.7 239 10/23/2018
3.16.6 233 10/23/2018
3.16.5 260 10/16/2018
3.16.4 251 10/15/2018
3.16.3 253 10/8/2018
3.16.2 245 9/29/2018
3.16.1 244 9/27/2018
3.16.0 262 9/13/2018
3.15.22 260 9/12/2018
3.15.21 251 9/11/2018
3.15.20 278 9/1/2018
3.15.19 288 8/30/2018
3.15.18 324 8/3/2018
3.15.17 305 8/2/2018
3.15.16 312 8/2/2018
3.15.14 285 7/31/2018
3.15.13 294 7/31/2018
3.15.12 301 7/25/2018
3.15.11 293 7/25/2018
3.15.10 309 7/25/2018
3.15.9 302 7/20/2018
3.15.8 343 7/19/2018
3.15.7 334 7/19/2018
3.15.6 395 7/16/2018
3.15.5 358 7/8/2018
3.15.4 374 6/29/2018
3.15.3 392 6/21/2018
3.15.0 375 6/12/2018
3.14.33 361 6/5/2018
3.14.32 364 6/1/2018
3.14.31 346 5/31/2018
3.14.30 346 5/30/2018
3.14.29 370 5/27/2018
3.14.28 368 5/25/2018
3.14.27 346 5/22/2018
3.14.26 395 5/9/2018
3.14.25 382 5/1/2018
3.14.24 315 4/23/2018
3.14.23 442 4/17/2018
3.14.22 391 4/16/2018
3.14.21 414 4/13/2018
3.14.20 382 4/11/2018
3.14.19 457 4/11/2018
3.14.18 516 4/7/2018
3.14.17 504 3/30/2018
3.14.16 378 3/29/2018
3.14.15 377 3/27/2018
3.14.14 371 3/27/2018
3.14.13 360 3/25/2018
3.14.12 391 3/5/2018
3.14.11 407 2/28/2018
3.14.10 384 2/27/2018
3.14.9 401 2/22/2018
3.14.8 400 2/14/2018
3.14.7 379 1/31/2018
1.0.0-beta1 326 1/17/2018
Show less