Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Unassigned: Action returning collection of complex type doesn't include count when using $inlinecount=allpages [1707]

$
0
0
Action returning collection of complex type doesn't include count when using $inlinecount=allpages.

Controller implementation:
```
[HttpPost]
public PageResult<odata.TestItem> FooBar(ODataActionParameters parameters, ODataQueryOptions queryOptions)
{
var items = Enumerable.Repeat(new odata.TestItem() {Foo = "bar"}, 200);

return new PageResult<odata.TestItem>(items, new Uri("http://next/page"), 4000);
}
```

ConventionModelBuilder:
```
builder.Entity<odata.MyType>()
.Collection
.Action("FooBar")
.ReturnsCollection<odata.TestItem>();
```

Request: http://myserver/odata/MyType/FooBar?$inlinecount=allpages

Response does not include the 'count'
```
{
"odata.metadata":"http://myserver/odata/$metadata#Collection(MyNamespace.TestItem)","value":[
{
"Foo":"bar"
},{
"Foo":"bar"
},{
"Foo":"bar"
},{
"Foo":"bar"
},{
"Foo":"bar"
},{
"Foo":"bar"

... snip ..
}
```

If I change to use 'ReturnsCollectionFromEntitySet<T>' instead of 'ReturnsCollection<T>' it works. But this doesn't make sense semantically, since the 'odata.TestItem' above is a Complex Type and NOT an entity.

This builder setup works:
```
builder.Entity<odata.MyType>()
.Collection
.Action("FooBar")
.ReturnsCollectionFromEntitySet<odata.TestItem>("TestItem");
```

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>