OData / WebApi

OData Web API: A server library built upon ODataLib and WebApi
https://docs.microsoft.com/odata
Other
857 stars 473 forks source link

Expand nested orderby multiple column result incorrect #2093

Open AiHaibara opened 4 years ago

AiHaibara commented 4 years ago

$expand nested $orderby multiple column result incorrect.

Assemblies affected

OData WebApi lib 7.2.2, EntityframeworkCore 2.2.4 NetCore2.2 OData WebApi lib 7.3.0, EntityframeworkCore 3.1.2 NetCore3.1

Reproduce steps

https://localhost:44353/api/datas?$filter=DataId eq '00000000000000012345                '&$expand=Detail($orderby=Index,Side;$select=Index,Side)

Expected result

{
    "@odata.context": "https://localhost:44353/api/$metadata#Datas(Detial(Side,Index))",
    "value": [
        {
            "DataId": "00000000000000012345                ",
            "Detail": [
                {
                    "Index": 1,
                    "Side": 0
                },
                {
                    "Index": 1,
                    "Side": 1
                },
                {
                    "Index": 2,
                    "Side": 0
                },
                {
                    "Index": 2,
                    "Side": 1
                }
            ]
        }
    ]
}

Actual result

{
    "@odata.context": "https://localhost:44353/api/$metadata#Datas(Detial(Side,Index))",
    "value": [
        {
            "DataId": "00000000000000012345                ",
            "Detail": [
                {
                    "Index": 1,
                    "Side": 0
                },
                {
                    "Index": 1,
                    "Side": 1
                },
                {
                    "Index": 2,
                    "Side": 1
                },
                {
                    "Index": 2,
                    "Side": 0
                }
            ]
        }
    ]
}
AiHaibara commented 4 years ago

Hello, any message about this?