63
1
// Entity Framework Classic
2
// Doc: https://entityframework-classic.net/bulk-update
3
4
// @nuget: Z.EntityFramework.Classic
5
6
7
using System;
8
using System.Collections.Generic;
9
using System.Linq;
10
using System.Data.Entity;
11
public class Program
12
{
13
public static void Main()
14
{
15
GenerateCustomers(5);
16
17
using(var context = new EntityContext())
18
{
19
FiddleHelper.WriteTable("1 - Before BulkUpdate", context.Customers.AsNoTracking().ToList());
20
21
var customerUpdated = context.Customers
22
.Where(x => x.CustomerID < 5)
23
.UpdateFromQuery( x => new Customer { FirstName = "foo" } );
24
Cached Result
Set one (current: 2):
>