Don't generate unneeded subquery in TPC with OfType
Open
area-query
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
Query:
```C#
var results3 = context.Animals.OfType().Where(a => a.Species.StartsWith("F")).ToList();
```
SQL:
```sql
SELECT [t].[Id], [t].[Species], [t].[Name], [t].[EducationLevel], [t].[Discriminator]
FROM (
SELECT [c].[Id], [c].[Species], [c].[Name], [c].[EducationLevel], N'Cat' AS [Discriminator]
FROM [Cats] AS [c]
) AS [t]
WHERE [t].[Species] LIKE N'F%'
```
The extra subquery here isn't needed and can be removed.
Split off from #28199
Contributor guide
Assessment
This issue has not been assessed yet.