[CSHARP-2596] AsQueryable with session (usable during transaction) Created: 19/Apr/19  Updated: 28/Oct/23  Resolved: 28/Apr/20

Status: Closed
Project: C# Driver
Component/s: Linq, Session Management, Transactions
Affects Version/s: 2.11.0
Fix Version/s: 2.11.0

Type: Improvement Priority: Major - P3
Reporter: Origin .NET Assignee: Robert Stam
Resolution: Fixed Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible

 Description   

While writing my own application tests, I just noticed the IMongoCollectionExtensions.AsQueryable extension method lacks session support unlike all other extension methods.

This means you can't use linq queries to access data modified within a transaction.

The fix is quite simple and I created this issue for the pull request.



 Comments   
Comment by Githook User [ 09/Jun/20 ]

Author:

{'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}

Message: CSHARP-2596: Fix test.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/329beaa1b37f873c359de403c94c33716f4ef231

Comment by Githook User [ 05/Jun/20 ]

Author:

{'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}

Message: CSHARP-2596: Refactoring and more tests.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/b9b4d66003bf49a364117b395b3f710b3f4c83d4

Comment by Githook User [ 05/Jun/20 ]

Author:

{'name': 'Origin .NET', 'email': 'origindotnet@gmail.com', 'username': 'origindotnet'}

Message: CSHARP-2596: AsQueryable with session (usable during transaction)
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/97434a2a0dea05ac78b92e16ac6ca90a51859e93

Comment by Róger Lopes [ 12/Nov/19 ]

I am currently in need for this feature too. Don't know how to bypass it without this new implementations. Please approve it

Comment by Shahaf Nahmias [ 14/Jun/19 ]

I highly recommend implementing this. 
I am currently in need for this feature. What is the workaround for using Linq inside a session? Is Fetching all the data and querying it the only way?

Comment by Origin .NET [ 24/Apr/19 ]

I added the test class MongoQueryableSessionTests to the pull request with all the Linq tests duplicated in order to check if it works during a transaction (inside and outside transaction).

Generated at Wed Feb 07 21:42:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.