Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecuteUpdate: allow value tuples in setters for expressing row values #28761

Open
1 task
roji opened this issue Aug 17, 2022 · 1 comment
Open
1 task

ExecuteUpdate: allow value tuples in setters for expressing row values #28761

roji opened this issue Aug 17, 2022 · 1 comment

Comments

@roji
Copy link
Member

roji commented Aug 17, 2022

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:

@roji
Copy link
Member Author

roji commented Aug 24, 2022

Note: we are not sure this is strictly necessary perf-wise; it should be possible to project before ExecuteUpdate, and then refer to the results of a subquery from that projection multiple times in the ExecuteUpdate setters. According to @smitpatel this may currently be blocked by some pending selector work, but that's something we'd want to do regardless.

So investigate whether this is actually needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants