dotnet / dotnet/efcore

Set operations: infer type mappings from the other side

Open
#29,081 5 comments 7 reactions 0 assignees View on GitHub
area-query area-set-operations customer-reported needs-design
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

When performing set operations, if a constant/parameter is specified, we should infer the type mapping from the column on the other side. Currently, queries which do this frequently fail since we don't support any type/facet mismatch between the two sides (e.g. #19129).

```c#
var test = await DbContext.Foo
.Select(f => new
{
FooProp = f.FooProp,
BarProp = "SomeBar"
})
.Union(DbContext.Bar
.Select(b => new
{
FooProp = "SomeFoo",
BarProp = b.Bar
}))
.ToListAsync();
```

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.