0
次のような単純なOData 4コントローラ(下記参照)を使用すると、都市を選択すると、ちょうどの都市が選択されますか?
{
"@odata.context":"http://localhost/api/$metadata#Customers(Location)","value":[
{
"Location":{
"Country":"Ireland","City":"Sligo"
}
},{
"Location":{
"Country":"Finland","City":"Helsinki"
}
}
]
}
しかし、私はちょうど都市を取得するように、1より深いをドリルダウンする方法がわからない:
http://localhost//api/Customers?$select=Location
は私を与えます。これも可能ですか?
public class CustomersController : ODataController
{
private List<Customer> customers = new List<Customer>()
{
new Customer
{
CustomerId = 1,
Location = new Address
{
City = "Sligo",
Country = "Ireland"
}
},
new Customer
{
CustomerId = 2,
Location = new Address
{
City = "Helsinki",
Country = "Finland"
}
}
};
[EnableQuery]
public List<Customer> Get()
{
return customers;
}
}
おかげで、それは私が最後にやってしまったものです。 –