Allow a TemporalAll and other temporal range queries to Include the current rows from non-temporal tables
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
## File a bug
The same as https://github.com/dotnet/efcore/issues/26704. I undersand reasoning in https://github.com/dotnet/efcore/issues/26704 but it should work when used with `.Select(x => new { ... })` or `.AsNoTracking()`. The whole feature is pretty much useless if we can't query anything but one table. Even hack we use today
```
var query = Set().ProjectTo();
sql = query.ToQueryString();
sql = sql.Replace($"[{table}]", $"[{table}] FOR SYSTEM_TIME ALL");
var rows = Set().FromSqlRaw(sql).ToList();
```
is way better than the official implementation.
### Include your code
```C#
context.Set().TemporalAll().Select(x => new { x.A, x.B.C }).ToList();
```
### Include stack traces
```
Unhandled exception. System.InvalidOperationException: Temporal query is trying to use navigation to an entity 'XXX' which itself doesn't map to temporal table. Either map the entity to temporal table or use join manually to access it.
```
### Include provider and version information
EF Core version: 6.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6.0
Operating system: Debian 11
Contributor guide
Assessment
This issue has not been assessed yet.