Replies: 2 comments
-
Maybe this is caused by something in Entity Framework? and not ODATA. |
Beta Was this translation helpful? Give feedback.
-
My guess is that this would be happening in order to support stable ordering, given that you have a But I'm curious to understand what the What kind of query do you get when you disable stable ordering (by setting |
Beta Was this translation helpful? Give feedback.
-
I have a very simple test odata controller. Why is this order by clause going in the query?!?!?
[HttpGet]
[Route("contact")]
[EnableQueryMods(PageSize = 500)]
public ActionResult<IEnumerable> GetContact()
{
var people = _db.Person.Where(p => p.ArchivedFlag == false).AsNoTracking().Select(p => new Contact
{
PersonId = p.PersonId,
lastname = p.LastName,
firstname = p.FirstName,
middlename = p.MiddleName,
});
return Ok(people);
}
URL:
https://localhost:7128/person/contact?$filter=personid in (1286456,1286457,1286470)
Produces a query like"
SELECT TOP(@__TypedProperty_1) [p].[PersonId], [p].[LastName] AS [lastname], [p].[FirstName] AS [firstname], [p].[MiddleName] AS [middlename]
FROM [Person] AS [p]
INNER JOIN [School] AS [s] ON [p].[SchoolId] = [s].[SchoolID]
WHERE [p].[ArchivedFlag] = CAST(0 AS bit) AND [p].[PersonId] IN (1286456, 1286457, 1286470)
ORDER BY [p].[FirstName], [p].[LastName], [[p].[MiddleName]
Beta Was this translation helpful? Give feedback.
All reactions