Web API OData: How do you $expand on a single entity?

前端 未结 1 1761
不知归路
不知归路 2021-01-13 04:20

I\'ve read both these articles multiple times to try and figure out a way to use the $expand query option on a single entity, but in each and every way I\'ve tr

相关标签:
1条回答
  • 2021-01-13 04:44

    Your action GetPlayer got the parameter name incorrect. The parameter name should be "key" instead of id. Try this as your action instead,

    [Queryable]
    public SingleResult<Player> GetPlayer([FromODataUri]int key)
    {
        return SingleResult.Create(_db.Players.Where(c => c.PlayerId == key));
    }
    
    0 讨论(0)
提交回复
热议问题