コード例 #1
0
ファイル: Driver.cs プロジェクト: KrystianD/KDPgDriver
        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));
        }
コード例 #2
0
   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)
     };
   }
 }
コード例 #3
0
ファイル: Driver.cs プロジェクト: KrystianD/KDPgDriver
 public Batch CreateTransactionBatch(KDPgIsolationLevel isolationLevel = KDPgIsolationLevel.ReadCommitted) => Batch.CreateDedicatedTransaction(this, isolationLevel);