[Feature Request] Same filter Includes should result in union include instead of error
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
Currently, if you have a complex query which dynamically applies .Includes to a query. Sometimes the query may result in having 2 similar .Includes with filter, like:
```
.Include(x => x.Users.Where(y => y.user_id == user_id))
.Include(x=> x.Users.Where(y=> y.user_id == user_id2))
```
In such cases, we current get an error:
```
.Where(x => x.user_id == user_id_2)' and 'navigation
.Where(y => y.user_id == user_id_0)' have both been configured on the same included navigation. Only one unique filter per navigation is allowed.
```
Instead, EF should construct a union of .Includes like:
`.Include(x=> x.Users.Where(y=> y.user_id == user_id || y.user_id == user_id2))`
If this is not possible, then the last include should win:
`.Include(x=> x.Users.Where(y=> y.user_id == user_id2))`
Contributor guide
Assessment
This issue has not been assessed yet.