dotnet / dotnet/efcore

Support ExecuteUpdate/Delete with view mapping where the column name differs between the table and view

Open
#34,713 0 comments 0 reactions 0 assignees View on GitHub
area-bulkupdate
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

When ExecuteUpdate/Delete is executed on a table that has a view mapping, special rewriting of the query expression must be done, as the translation references the view but we need to update the table instead (see #34677). This was done in #34709, but without handling the case where column names actually differ between the two mapings:

```c#
modelBuilder.Entity()
.ToTable("Cat", b => b.Property(c => c.Name).HasColumnName("Name"))
.ToView("CatView", b => b.Property(c => c.Name).HasColumnName("ViewName"));
```

To support this, we need to re-visit the expression, rewriting ColumnExpressions.

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.