I'm trying to run an async query based on an Expression<Func<>>:
Expression<Func<IDbUserRightsInfo, bool>> expression = u => u.MarketingType == eUserMarketingType.Internal;
var result = await (from u in usersDbSet.AsExpandable()
where expression.Invoke(u)
select u).ToArrayAsync().ConfigureAwait(false);
But it does not work. The exception I get:
System.InvalidOperationException: The source IQueryable doesn't implement IDbAsyncEnumerable. Only sources that implement IDbAsyncEnumerable can be used for Entity Framework asynchronous operations. For more details see http://go.microsoft.com/fwlink/?LinkId=287068.
If I remove the await/async it works fine but I want to use it.
It seems to be caused by the AsExpandable() method, but it is required in order to use the built Expression.