Reputation:
So I used to be able to run Linq queries against the MongoCollection
through IQueryable
in version 1.x
When I'm referencing my db libraries, since all I'm doing is exposing the IQueryable
interface, my calling code never needed to reference any of the C# driver stuff. It seems like I need to manually map my queries now, or expose the filter definition. Is there a "right" way to do this? (easy to read/easy to maintain)
Upvotes: 0
Views: 355
Reputation: 116518
I suggest simply not abstracting over the driver.
You can't really use LINQ and exchange the underlying DB and expect everything to work anyway.
As was suggested by xanatos in the comments, you can wait for the driver to add support for LINQ in v2.1, but keep in mind that LINQ is synchronous and the driver isn't. That means that you will either block on async
code (which is bad) or you would use the driver's special async
methods (which isn't really an abstraction)
Maintaining the abstraction seems not to be worth the effort in my opinion.
Upvotes: 2