Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregate Statement on Collection of IEdmEntityObjects cant find property #918

Closed
vrkrishn opened this issue Feb 16, 2017 · 2 comments · Fixed by #2302
Closed

Aggregate Statement on Collection of IEdmEntityObjects cant find property #918

vrkrishn opened this issue Feb 16, 2017 · 2 comments · Fixed by #2302
Labels

Comments

@vrkrishn
Copy link

I was wondering whether aggregation was supported for methods that return EdmEntityObjectCollection (i.e. with type parameter Contact). I see that in all the examples, the controller methods return IQueryable but I'm not sure if that would work if the method expects IEdmEntityObjects rather than aspecific contact object. Currently I am running into an exception where I cannot find a property defined in the Contact entityType.

Assemblies affected

Microsoft.AspNet.OData 5.9.1
Microsoft.OData.Core 6.15
Microsoft.OData.Edm 6.15

Reproduce steps

GET /data/Contacts?$apply=aggregate(Date with min as Earliest)

Expected result

{
@odata.context":"http://hostname/data/$metadata#Contacts,
"value": [
{
"@odata.id": null,
"Earliest": Datetime Object
}
]
}

Actual result

"error":{
"code":"","message":"The query specified in the URI is not valid. Could not find a property named 'Date' on type 'System.Web.OData.IEdmEntityObject'.
}

@TehWardy
Copy link

TehWardy commented Apr 4, 2017

I have a similar problem when I use groupby with a DateTime property in the same version assemblies ...

~/Api/MyType?$apply=groupby((DueDate))

With the DueDate property on the type being a DateTime it returns ...

{
  "error": {
    "code": "",
    "message": "An error has occurred."
  }
}

doing a normal "get all" query with the url "~/Api/MyType" returns the data fine and displays the datetime properties correctly as ISO strings as I would expect.

@TehWardy
Copy link

TehWardy commented Apr 4, 2017

Ah looks like my problem is #912
Could be related though I guess ???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants