odata.net
odata.net copied to clipboard
The method 'Any' is not supported
Hello. I am using Microsoft.OData.Client 7.8.1.
I want create DataServiceContext, CreateQuery and take data.
Code is:
var oDataContext = new DataServiceContext(new Uri("https://localhost:5001"));
var dataSet = oDataContext.CreateQuery<Project>("Projects");
var exists = dataSet.Any();
But i get next error: "System.NotSupportedException: 'The method 'Any' is not supported.'"
StackTrace:
at Microsoft.OData.Client.DataServiceQueryProvider.ReturnSingleton[TElement](Expression expression) at Microsoft.OData.Client.DataServiceQueryProvider.Execute[TResult](Expression expression) at System.Linq.Queryable.Any[TSource](IQueryable`1 source) at ASE.MD.MDP2.Product.MDP2Service.Controllers.TestController.GetByOData() in D:\WorkProjects\MDP\2.0\MDP2.0\MDP2Service\Controllers\TestController.cs:line 146 at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<<InvokeActionMethodAsync>g__Logged|12_1>d.MoveNext()
What's wrong i do?
@ShvetsovAU this is a great suggestion. It might be a good opportunity if you want to make a contribution. We'll be happy to review.
The error method is thrown from 'https://github.com/OData/odata.net/blob/master/src/Microsoft.OData.Client/ALinq/DataServiceQueryProvider.cs#L142'
@ShvetsovAU this is a great suggestion. It might be a good opportunity if you want to make a contribution. We'll be happy to review.
Which methods of linq is not supported now?
Maybe you can recomended another library for translating linq to OData queries?
@ShvetsovAU most of the linq methods are supported by OData Client.. check out this doc https://docs.microsoft.com/en-us/odata/client/query-options. There are also aggregation methods that have recently been supported. https://github.com/OData/odata.net/pull/1921
@ShvetsovAU most of the linq methods are supported by OData Client.. check out this doc https://docs.microsoft.com/en-us/odata/client/query-options. There are also aggregation methods that have recently been supported. #1921
Hello, thank you!
But as i can see, not supported next methods (which i try using): All, Last, LastOrDefault, Contains, Any...another don not try use...
hi team, any update on this ? I encounter the same issue
2024 and Any
still not supported?
I'm confused because this page in the documentation shows examples with Any
. Are there any plans to support it? Or maybe it's supported but I'm not using the right library? Please somebody bring some light to my questions, as I don't understand anything!