1

My main codebase operate IAsyncQueryable, but I have obsolete parts of code / consumed API which has no ability to provide IAsyncQueryable, however provides IQueryable. What I miss is IAsyncqueryable ToAsyncQueryable(this IQueryable queryable) method to convert it (yes, it would be sub-optimal, that's okay until no conversion to IEnumerable).

Is any standard approach to deal with it or possibly someone has implementation of such method (I did not find)

Alexander
  • 11
  • 1
  • 2
  • Welcome to StackOverflow. Please share with us your simplified code and indicate where did you stuck. – Peter Csala May 04 '21 at 12:48
  • 2
    The first answer in this question should be working for you: https://stackoverflow.com/questions/60274758/empty-iqueryable-that-implements-iasyncenumerable – volley May 04 '21 at 12:50
  • @volley unfortunately not, you are confusing `IAsyncEnumerable` and `IAsyncQueryable` – Alexander May 04 '21 at 15:03
  • What is the point to operate with IAsyncQueryable? As I know each LINQ Provider has it's own methods to execute async calls. – Svyatoslav Danyliv May 04 '21 at 15:53
  • `IAsyncQueryable` is more efficient in highly concurrable environment because it does not block thread until fully completed, also you can enumerate result without keeping whole query result in memory. Yes, `IAsyncQueryable` behavior depends on backed implementation (which we have for our primary sources), but third-party provider's like MongoDB.Driver for example implements only `IQueryable` – Alexander May 05 '21 at 13:17

0 Answers0