dotnet / dotnet/EntityFramework.Docs
Document ordering expectations for raw SQL
Open
area-query-raw
- Dominant language
- Mermaid
- Stars
- 1.7k
- Forks
- 2k
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 16
Description
Queries of the form
```C#
...
.Take()
.Include().ThenInclude()
```
are translated the following way:
```SQL
SELECT ...
FROM (
SELECT ...
FROM (...
) as l
LIMIT... -- Take()
) as t
JOIN ... -- Include() entity
JOIN ... -- ThenInclude() entity
ORDER BY t... l... -- the extra ORDER BY
```
An additional `ORDER BY` overrides any ordering of the most inner FROM (or natural ordering) if it's a raw query.
----
EF Core version: both 3.1 and 5
Database provider: (tested on PG)
Target framework: .NET Core 3.1
Contributor guide
Assessment
This issue has not been assessed yet.