Skip to content

Allow ExecuteUpdate to update properties of multiple queries as long as they map to a single table #31406

@roji

Description

@roji

Our current ExecuteUpdate logic checks that only one entity type is updated by all the setters; this blocks scenarios such as the following:

Updating columns mapped to multiple owned entities (and the owner):

_ = await ctx.Blogs.ExecuteUpdateAsync(s => s
    .SetProperty(b => b.Name, "foo")
    .SetProperty(b => b.BlogDetails.Details, "bar"));

(note: this will also apply to complex types)

Updating columns mapped to a single table within a TPT hierarchy:

_ = await ctx.SpecialBlogs.ExecuteUpdateAsync(
    s => s.SetProperty(b => b.SpecialProperty, "foo"));

Updating the main table of an entity with entity splitting

As long as updates only affect columns on the main table, this now works.

Unfortunately, updates to any of the split tables fail on SQL Server for other, architectural reasons, see #31407. On Sqlite they pass, because a different query shape is generated.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions