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
I can't use LINQ query with ExecuteBatch. ExecuteBatch requires a DataServiceRequest as parameters, but constructing a query results in a IQueryable.
Assemblies affected
7.11
Reproduce steps
var request1 = context.SomeObject.Select( o => o.HasInterestingProperty)
var request2 = context.SomeAuxiliaryData.Select( o => o.HasSomeOtherProperty)
var batchResponse = context.ExecuteBatch(request1 , request2 );
Expected result
Compiles
Actual result
error: error CS1503: Argument 1: cannot convert from 'System.Linq.IQueryable<...>' to 'Microsoft.OData.Client.DataServiceRequest'
Additional detail
I want to request auxiliary data for a bunch of objects. That data is scattered over multiple endpoints, so a batch request will speed up the requests.
I know I can use AddQueryOption, but that is missing all the nice type checking.
The text was updated successfully, but these errors were encountered:
@FrankTaubert, something is a little off with the code snippet, but I think I understand what you're getting at. You have something like:
DataServiceContext context;
...
var queryable = context.CreateQuery(...).Select(o => o.Foo);
...
and you want to later call:
context.ExecuteBatch(queryable, ...);
right? This does seem pretty annoying. What you can do to maintain type checking is construct the DataServiceRequests yourself. So, you end up with a bunch of IQueryable<T>, and you can do:
context.ExecuteBatch(
new DataServiceQuery<T>(firstQueryable.Expression, new DataServiceQueryProvider(context)),
new DataServiceQuery<U>(secondQueryable.Expression, new DataServiceQueryProvider(context)),
...);
Please try that and let me know if it helps. I'm also looking at what updates we can make to the library so that this flows more naturally.
I can't use LINQ query with ExecuteBatch.
ExecuteBatch
requires aDataServiceRequest
as parameters, but constructing a query results in a IQueryable.Assemblies affected
7.11
Reproduce steps
Expected result
Compiles
Actual result
error: error CS1503: Argument 1: cannot convert from 'System.Linq.IQueryable<...>' to 'Microsoft.OData.Client.DataServiceRequest'
Additional detail
I want to request auxiliary data for a bunch of objects. That data is scattered over multiple endpoints, so a batch request will speed up the requests.
I know I can use
AddQueryOption
, but that is missing all the nice type checking.The text was updated successfully, but these errors were encountered: