Using PetaPoco, you are allowed to manage transactions by doing something like this:
var newObject = new NewObject(); var newObjectId = 1; using (var scope = db.GetTransaction()) { newObject = db.SingleOrDefault<NewObject>("SELECT * FROM tblNewObject WHERE Id = @0", newObjectId); scope.Complete(); }
While this is great for management, when it is committed in transactional updates, it is a little lacking to control the transaction isolation level, similar to how you did it with a traditional SQL connection:
TransactionOptions transOptions = new TransactionOptions() { IsolationLevel = IsolationLevel.ReadUncommitted }; using (new TransactionScope(TransactionScopeOption.Required, transOptions)) {
A new transaction is returned to PetaPoco GetTransaction , which, using this constructor , calls BeginTransaction . In this case, BeginTransaction uses the .NET IDbConnection.BeginTransaction () - which has an overload to provide a level of transaction isolation. As far as I can tell, PetaPoco provides no way to provide an isolation level for this method. Does anyone know if it is possible to really change the isolation level of PetaPoco without having to delve into the source code and add an overloaded constructor with an isolation level? I am happy to do this and send a transfer request, but I want to make sure that before I do this work, I will not miss something direct.
source share