dotnet / dotnet/efcore

ExecuteUpdate: allow value tuples in setters for expressing row values

Open
#28,761 1 comment 0 reactions 0 assignees View on GitHub
area-bulkupdate area-perf blocked customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

```c#
context.Blogs.ExecuteUpdate(s => s
.SetProperty(b => ValueTuple.Create(b.Title, b.Content), b => /* some subquery returning two values */);
```

This is important for performance, since the subquery runs only once and returns two values; otherwise the two properties need to be set separately, causing the subquery to be evaluated twice (that's the current workaround).

IIRC this does not work on SQL Server which doesn't support row values very well, but is supported on almost all other databases, including SQLite.

Possibly depends on:

* [ ] #26822

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.