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

Commented Issue: OData 2: $filter=round(FloatProperty) eq 1 halt with ArgumentException during parsing [1408]

$
0
0
I have an entity with following property:
```
public float FloatProperty { get; set; }
```
When I try to query data from it using my OData contoller like
[http://localhost/WebApi/EntityWithSimpleTypes?$filter=round(FloatProperty) eq 1](link)
I get an exception.
It seems the float argument is converted to Nullable<double> to make a call to Round method there. But there are two Round methods and wrong one is selected (i.e. Round(decimal))
I suppose the float argument should be converted to double or proper methods need to be selected for nullable type
Comments: No repro on Owin Self Host in 5.1 class Program { private static readonly string serverUrl = "http://localhost:12345"; static void Main(string[] args) { using (WebApp.Start(serverUrl, Configuration)) { Console.WriteLine("Server listening on {0}", serverUrl); Console.Read(); } } private static void Configuration(IAppBuilder builder) { ODataModelBuilder omb = new ODataConventionModelBuilder(); omb.EntitySet<SampleType>("SampleTypes"); HttpConfiguration configuration = new HttpConfiguration(); configuration.Routes.MapODataRoute("odata", "odata", omb.GetEdmModel()); builder.UseWebApi(configuration); } } public class SampleTypesController : ODataController { [Queryable] public IHttpActionResult Get() { return Ok(Enumerable.Range(0, 10).Select(i => new SampleType { Id = i, FloatProp = 0.6f + i })); } } public class SampleType { public int Id { get; set; } public float FloatProp { get; set; } }

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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