I am working on a middle tier OData-API and for now I am stuck with support for IQueryable<T>. Since I want to avoid using Entity Framework I was on a search for an ORM or database with native IQueryable<T> support. I found RavenDB and like it a lot, but I have an OData related problem:
Since RavenDBs .Query() returns IRavenQueryable<T> which in fact is an IQueryable<T> it is really easy to return all suitable documents with just
A simple call per Postman
https://localhost:44329/odata/Geschaeftspartner
works like a charm. But as soon as I use Query Parameters like
https://localhost:44329/odata/Geschaeftspartner?$select=Name
In the response body I just get:
If I customize my database request into
Session.Query<T>().ToList().AsQueryable();
everything works like a charm. I assume that `.ToList().AsQueryable()` "disconnects" from the database session and creates a new IQueryable<T>. I want to avoid that because of a larger memory footprint on the server side and I think its just stupid to convert from IQueryable to IEnumerable and then to a new IQueryable. I like to follow KISSAUAFRAP: Keep it simple stupid and use a few ressources as possible! ;-)
I assume that I either don't understand the inner workings of
ASP.NET core/OData or that the database session gets disposed or "lost" when the OData library gets to work after my controller action.
The result looks like some error is happening in the background an the response building is stopped/interrupted.
Any help or suggestions are VERY welcome.