[CSHARP-2890] TransactionScope support for MongoDB Created: 05/Jan/20  Updated: 31/Mar/22

Status: Backlog
Project: C# Driver
Component/s: Transactions
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: shubham saini Assignee: Unassigned
Resolution: Unresolved Votes: 9
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Implement a Resource Manager that should be enlisted as a participant in a transaction.
The objective would be to make transactions in MongoDB compatible with .NET standard way of handling transactions using TransactionScope.

This should make handling transactions implicit without the need for using StartTransaction and AbortTransaction method.

 
using(Transaction scope = new TransactionScope())
{
    database.GetCollection<Car>("Car").InsertOne(new Car { Model = "S" });
    scope.Complete();
}

 

 



 Comments   
Comment by Gabriel Lucaci [ 23/Aug/21 ]

https://www.nuget.org/packages/MongoDB.Extensions.Transactions

IMongoCollection<BsonDocument> users = _database.GetCollection<BsonDocument>("users").AsTransactionCollection();

Comment by Gabriel Lucaci [ 11/Feb/21 ]

+1

Comment by Luc Dubrois [ 08/Dec/20 ]

Any news on this request ?

It will be much appreciated to support this to allow no direct dependencies on MongoDB assemblies in interfaces, more easy to mock interfaces in tests, ....

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