From 38a01c87df20a041401bba0fe5d4d07d134211c3 Mon Sep 17 00:00:00 2001 From: Kerry Perret Date: Sat, 23 Jan 2021 08:30:06 +0100 Subject: [PATCH] feat(tc): add support for weird isolation level --- Vp.FSharp.Sql/Transaction.fs | 11 +++++------ Vp.FSharp.Sql/Types.fs | 5 +++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Vp.FSharp.Sql/Transaction.fs b/Vp.FSharp.Sql/Transaction.fs index 5097265..9792265 100644 --- a/Vp.FSharp.Sql/Transaction.fs +++ b/Vp.FSharp.Sql/Transaction.fs @@ -3,9 +3,8 @@ module Vp.FSharp.Sql.Transaction open System.Threading open System.Data.Common - -open System.Threading.Tasks open System.Transactions +open System.Threading.Tasks open Vp.FSharp.Sql.Helpers @@ -15,7 +14,7 @@ let DefaultIsolationLevel = IsolationLevel.ReadCommitted let commit cancellationToken isolationLevel (connection: #DbConnection) - (beginTransaction: #DbConnection -> IsolationLevel -> CancellationToken -> ValueTask<#DbTransaction>) + (beginTransaction: #DbConnection -> 'IsolationLevel -> CancellationToken -> ValueTask<#DbTransaction>) (body: #DbConnection -> #DbTransaction -> Async<'Output>)= async { let wasClosed = DbConnection.isClosed connection @@ -32,7 +31,7 @@ let commit cancellationToken isolationLevel let notCommit cancellationToken isolationLevel (connection: #DbConnection) - (beginTransaction: #DbConnection -> IsolationLevel -> CancellationToken -> ValueTask<#DbTransaction>) + (beginTransaction: #DbConnection -> 'IsolationLevel -> CancellationToken -> ValueTask<#DbTransaction>) (body: #DbConnection -> #DbTransaction -> Async<'Output>) = async { let wasClosed = DbConnection.isClosed connection @@ -48,7 +47,7 @@ let notCommit cancellationToken isolationLevel let commitOnSome cancellationToken isolationLevel (connection: #DbConnection) - (beginTransaction: #DbConnection -> IsolationLevel -> CancellationToken -> ValueTask<#DbTransaction>) + (beginTransaction: #DbConnection -> 'IsolationLevel -> CancellationToken -> ValueTask<#DbTransaction>) (body: #DbConnection -> #DbTransaction -> Async<'Output option>) = async { let wasClosed = DbConnection.isClosed connection @@ -68,7 +67,7 @@ let commitOnSome cancellationToken isolationLevel let commitOnOk cancellationToken isolationLevel (connection: #DbConnection) - (beginTransaction: #DbConnection -> IsolationLevel -> CancellationToken -> ValueTask<#DbTransaction>) + (beginTransaction: #DbConnection -> 'IsolationLevel -> CancellationToken -> ValueTask<#DbTransaction>) (body: #DbConnection -> #DbTransaction -> Async>) = async { let wasClosed = DbConnection.isClosed connection diff --git a/Vp.FSharp.Sql/Types.fs b/Vp.FSharp.Sql/Types.fs index 6445224..8a41da7 100644 --- a/Vp.FSharp.Sql/Types.fs +++ b/Vp.FSharp.Sql/Types.fs @@ -108,7 +108,8 @@ type SqlConfigurationCache<'DbConnection, 'DbCommand // Ie. The ADO.NET Provider generic constraints mapper due to the lack of proper support for some variant of the SRTP // and the hideous members shadowing occuring in most ADO.NET Providers implementation -type SqlDependencies<'DbConnection, 'DbCommand, 'DbParameter, 'DbDataReader, 'DbTransaction, 'DbType +type SqlDependencies<'DbConnection, 'DbCommand, 'DbParameter, 'DbDataReader, + 'DbTransaction, 'DbTransactionIsolationLevel, 'DbType when 'DbConnection :> DbConnection and 'DbCommand :> DbCommand and 'DbParameter :> DbParameter @@ -116,7 +117,7 @@ type SqlDependencies<'DbConnection, 'DbCommand, 'DbParameter, 'DbDataReader, 'Db and 'DbTransaction :> DbTransaction> = { CreateCommand: 'DbConnection -> 'DbCommand SetCommandTransaction: 'DbCommand -> 'DbTransaction -> unit - BeginTransactionAsync: 'DbConnection -> IsolationLevel -> CancellationToken -> ValueTask<'DbTransaction> + BeginTransactionAsync: 'DbConnection -> 'DbTransactionIsolationLevel -> CancellationToken -> ValueTask<'DbTransaction> ExecuteReaderAsync: 'DbCommand -> CancellationToken -> Task<'DbDataReader> DbValueToParameter: string -> 'DbType -> 'DbParameter }