Differense between EF Extensions UpdateFromQuery() and EF Plus Update()
Asked Answered
K

1

6

The library Entity.Framework.Extensions (paid) has a method for doing entity updates:

context.Customers
.Where(c=>c.XXX = "")
.UpdateFromQuery(c=>new Customer{ Timestamp = DateTime.UtcNow })

The library Entity.Framework.Plus (free) has a similar method for doing entity updates:

context.Customers
.Where(c=>c.XXX = "")
.Update(c=> new Customer{ Timestamp = DateTime.UtcNow })

What is the difference between these two implementations?

Karyogamy answered 22/9, 2017 at 7:4 Comment(2)
Hello @Freddy, as a side question, which method name do you prefer?Glacis
Not significant, but simply Update() is preferred since the whole FromQuery moniker is obvious anyway since we are in a LINQ context.Karyogamy
G
2

There is a slight difference between both libraries for SQL Server due to how they have been implemented. However, they should support all the same scenarios.

For other providers, the same base code is used.

At one point in the future, we plan to only keep this feature Batch Delete and Batch Update in only one of our libraries.

If we choose to keep it under Entity Framework Extensions, we will make sure this feature will be available for free

Glacis answered 22/9, 2017 at 14:16 Comment(2)
Since we pay for EF Extensions and also use EF Plus, should I prefer one over the other (we use SQL server)? Is the one in EF Extensions "better" in any way? I do prefer the one provided with EF Plus since it returns the number of rows affected and the other don't.Karyogamy
I recommend you also to take the EF Plus one. The implementation is better.Glacis

© 2022 - 2024 — McMap. All rights reserved.