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

Edited Issue: "Argument types do not match" OData error [381]

$
0
0
The following two pieces of code crashes with the same error message "Argument types do not match"

NOTE: The query used is "http://localhost:52473/api/myentity/bymunicipality/4fba6fd37fbbc823acdf1d36?$filter=startswith(Name,'Test') eq true"

[Queryable]
public async Task<HttpResponseMessage> GetByMunicipality(string municipalityId)
{
var result = await this.entityRepository.GetByMunicipality(municipalityId);

return Request.CreateResponse(HttpStatusCode.OK, result.AsQueryable());
}

[Queryable]
public async Task<IEnumerable<MyEntity>> GetByMunicipality(string municipalityId, ODataQueryOptions options)
{
var result = await this.entityRepository.GetByMunicipality(municipalityId);

return options.ApplyTo(result.AsQueryable());
}

While this one works:

[Queryable]
public async Task<IEnumerable<MyEntity>> GetByMunicipality(string municipalityId)
{
var result = await this.entityRepository.GetByMunicipality(municipalityId);

return result.ToList();
}

Shouldn't they all return the same thing?

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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