I have implemented an API using the ODataController
When I hit the API at https://localhost:4046/v1/Search
, I am only able to get the backupId
and count
in the GranularSeachResult
object. The RestorePoint
s aren't returned, even though they are getting set and I have double checked that.
What is the reason they are not coming? Is there some change needed in postman route or in code to show the complete GranularSearchResult
with complete information about RestorePoint
?
I even tried using https://localhost:4046/v1/Search?$expand=restorePoint
But still I am not able to get the restorePoint
s in the output.
I tried adding ComplexType
for restorePoint
but that causes an error, saying entity type is already registered. I need the entityType
in startup.cs
for RestorePoint
s and don't want to change it.
Any help would be appreciated.
Most likely is that OData
are not configured correctly as by default functions are disabled.
You can use ENableQuery
attribute on top of the endpoint/method. There are lot of parameters you can use to enable/disable functionality.
[EnableQuery]
public async Task<ActionResult> PostAsync([FromBody] BackupSearchRequest request)
{
...
}
or you can configure through IRouteBuilder
extension method that will enable expanding globally. Again there are many extension methods you can use to configure OData
routing.
app.UseMvc(routeBuilder =>
{
routeBuilder.Expand();
});
More info: