public async Task <Transaction> CreateTransaction(KDPgIsolationLevel isolationLevel = KDPgIsolationLevel.ReadCommitted) { var connection = await CreateConnection(); var tr = connection.BeginTransaction(Utils.Utils.ToIsolationLevel(isolationLevel)); // ReSharper disable once HeapView.ObjectAllocation.Evident return(new Transaction(this, connection, tr)); }
internal static IsolationLevel ToIsolationLevel(KDPgIsolationLevel level) { return level switch { KDPgIsolationLevel.ReadCommitted => IsolationLevel.ReadCommitted, KDPgIsolationLevel.RepeatableRead => IsolationLevel.RepeatableRead, KDPgIsolationLevel.Serializable => IsolationLevel.Serializable, _ => throw new ArgumentOutOfRangeException(nameof(level), level, null) }; } }
public Batch CreateTransactionBatch(KDPgIsolationLevel isolationLevel = KDPgIsolationLevel.ReadCommitted) => Batch.CreateDedicatedTransaction(this, isolationLevel);