You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Here is the repo with the problem described below: https://github.com/vabic/ODataComputeLambdaErrorExample.git
This example is based on Sam Xu blog $compute and $search in ASP.NET Core OData 8here with the starter repo NewQueryOptionIn8 also tagged in your README. So I took it as an official example.
I added a new prop on the Product model IList Candys like this: public IList<string> Candys { get; set; }
new Product
{
Id = 3, Name = "Noodle", Color = Color.Brown, Price = 2.99, Qty = 50, Category = Category.Food, TaxRate = 0.10,
Location = addresses[1],
Sales = new List<Sale>
{
new Sale { SaleDate = new Date(1999, 8, 12), ProductId = 3, Amount = 11 },
new Sale { SaleDate = new Date(2018, 3, 19), ProductId = 3, Amount = 8 },
},
**Candys = new List<string>(){ "kit kat"}**
},
new Product
{
Id = 4, Name = "Flute", Color = Color.Yellow, Price = 12.0, Qty = 75, Category = Category.Music, TaxRate = 0.14 ,
Location = addresses[0],
Sales = new List<Sale>
{
new Sale { SaleDate = new Date(2022, 12, 9), ProductId = 4, Amount = 15 },
new Sale { SaleDate = new Date(2022, 5, 29), ProductId = 4, Amount = 18 },
},
**Candys = new List<string>(){ "candy"}**
},
new Product
{
Id = 5, Name = "Paper", Color = Color.White, Price = 6.99, Qty = 14 , Category = Category.Office, TaxRate = 0.24,
Location = addresses[2],
Sales = new List<Sale>
{
new Sale { SaleDate = new Date(2013, 1, 9), ProductId = 5, Amount = 2 },
new Sale { SaleDate = new Date(2022, 1, 1), ProductId = 5, Amount = 3 },
},
**Candys = new List<string>(){ "Snikers"}**
},
I try to do a $compute on a Candy prop with a lambda expression to compute who has Snikers and I get an error :
OData Url: http://localhost:5102/odata/products?$select=HasSnikers&$compute=Candys/any(r:r eq 'Snikers') as HasSnikers
Error: "The query specified in the URI is not valid. The binary operator Equal is not defined for the types 'NewQueryOptionIn8.Models.Product' and 'System.String'.",
Reproduce steps
clone repo, start the solution, use Postman or equivalent.
Screenshots
The text was updated successfully, but these errors were encountered:
Assemblies affected
tried on 8.0.6 and 8.2.3
Describe the bug
Here is the repo with the problem described below: https://github.com/vabic/ODataComputeLambdaErrorExample.git
This example is based on Sam Xu blog
$compute and $search in ASP.NET Core OData 8
here with the starter repo NewQueryOptionIn8 also tagged in your README. So I took it as an official example.I added a new prop on the Product model IList Candys like this:
public IList<string> Candys { get; set; }
I try to do a $compute on a Candy prop with a lambda expression to compute who has Snikers and I get an error :
OData Url:
http://localhost:5102/odata/products?$select=HasSnikers&$compute=Candys/any(r:r eq 'Snikers') as HasSnikers
Error:
"The query specified in the URI is not valid. The binary operator Equal is not defined for the types 'NewQueryOptionIn8.Models.Product' and 'System.String'.",
Reproduce steps
clone repo, start the solution, use Postman or equivalent.
Screenshots
The text was updated successfully, but these errors were encountered: