ASP.NET core serving OData 4 with RavenDB

159 views
Skip to first unread message

El Hippo

unread,
Apr 7, 2019, 3:31:58 AM4/7/19
to RavenDB - 2nd generation document database
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
Session.Query<T>();


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. 

Egor Shamanaev

unread,
Apr 7, 2019, 6:55:05 AM4/7/19
to rav...@googlegroups.com
Hello El Hippo,
Please provide us additional details on what are you trying to achieve? What is the response you get from RavenDB?

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
To post to this group, send email to rav...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ravendb/d24d82cd-057d-41a3-b741-2dae6b582095%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages