You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorting on nested endpoints is currently not supported. For example, this request:
GET /blogs/1/articles?sort=-id
returns the next response:
{
"errors": [
{
"id": "772f747d-12d6-47d5-a43e-2e9843fc1cff",
"status": "400",
"title": "The specified query string parameter is currently not supported on nested resource endpoints.",
"detail": "Query string parameter 'sort' is currently not supported on nested resource endpoints. (i.e. of the form '/article/1/author?parameterName=...')",
"source": {
"parameter": "sort"
}
}
]
}
But it turns out that EF Core 3.1 is able to translate the next query:
SELECT b."Id", b."Name", t."Title", t."Id", t."Id0", t."ArticleId", t."AuthorId", t."PublishTime"FROM"Blogs"AS b
LEFT JOIN (
SELECT a."Title", a."Id", r."Id"AS"Id0", r."ArticleId", r."AuthorId", r."PublishTime", a."BlogId"FROM"Article"AS a
LEFT JOIN"Revision"AS r ON a."Id"= r."ArticleId"
) AS t ON b."Id"= t."BlogId"ORDER BY b."Name"DESC, b."Id", t."Title"DESC, t."Id", t."PublishTime"DESC, t."Id0"
context.Database.EnsureDeleted();context.Database.EnsureCreated();varauthorJane=newAuthor{FirstName="Jane",LastName="Smith",Email="[email protected]",LivingAddress=newAddress{Street="Square Street",ZipCode="12345",Country=newCountry{IsoCode="USA",DisplayName="United States of America"}}};varauthorJohn=newAuthor{FirstName="John",LastName="Doe",Email="[email protected]",LivingAddress=newAddress{Street="Main Street",ZipCode="11111",Country=newCountry{IsoCode="AUS",DisplayName="Australia"}}};context.Blogs.AddRange(newBlog{Name="Coding Guidelines",Articles=newList<Article>{newArticle{Title="The art of refactoring",Url="http://www.coding.com/refactoring",Author=authorJohn},newArticle{Title="What's new in .NET Core",Url="http://www.coding.com/netcore",Author=authorJane,Revisions=newList<Revision>{newRevision{Author=authorJane,PublishTime=newDateTime(2020,5,12)},newRevision{Author=authorJane,PublishTime=newDateTime(2019,8,11)}}}}},newBlog{Name="Nature",Articles=newList<Article>{newArticle{Title="Wildlife",Url="http://www.nature.com/wildlife",Author=authorJane},newArticle{Title="Flowers",Url="http://www.nature.com/flowers",Author=authorJane}}});
Sorting on nested endpoints is currently not supported. For example, this request:
returns the next response:
But it turns out that EF Core 3.1 is able to translate the next query:
Into:
Resulting in the next response:
Seed data, for reference:
Models, for reference:
The text was updated successfully, but these errors were encountered: