├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE.md ├── .gitignore ├── Dapper.Transaction.Net461 ├── Dapper.Transaction.Net461.csproj ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── Dapper.Transaction.Net5 └── Dapper.Transaction.Net5.csproj ├── Dapper.Transaction.Net7 └── Dapper.Transaction.Net7.csproj ├── Dapper.Transaction.NetStandard20 └── Dapper.Transaction.NetStandard20.csproj ├── Dapper.Transaction.Shared ├── Dapper.Transaction.Shared.projitems ├── Dapper.Transaction.Shared.shproj ├── DbTransaction │ └── Extensions │ │ ├── Execute.cs │ │ ├── ExecuteAsync.cs │ │ ├── ExecuteReader.cs │ │ ├── ExecuteReaderAsync.cs │ │ ├── ExecuteScalar.cs │ │ ├── ExecuteScalarAsync.cs │ │ ├── ExecuteScalarAsync`.cs │ │ ├── ExecuteScalar`.cs │ │ ├── Query.cs │ │ ├── QueryAsync.cs │ │ ├── QueryAsync`.cs │ │ ├── QueryFirst.cs │ │ ├── QueryFirstAsync.cs │ │ ├── QueryFirstAsync`.cs │ │ ├── QueryFirstOrDefault.cs │ │ ├── QueryFirstOrDefaultAsync.cs │ │ ├── QueryFirstOrDefaultAsync`.cs │ │ ├── QueryFirstOrDefault`.cs │ │ ├── QueryFirst`.cs │ │ ├── QueryMultiple.cs │ │ ├── QueryMultipleAsync.cs │ │ ├── QuerySingle.cs │ │ ├── QuerySingleAsync.cs │ │ ├── QuerySingleAsync`.cs │ │ ├── QuerySingleOrDefault.cs │ │ ├── QuerySingleOrDefaultAsync.cs │ │ ├── QuerySingleOrDefaultAsync`.cs │ │ ├── QuerySingleOrDefault`.cs │ │ ├── QuerySingle`.cs │ │ ├── QueryUnbufferedAsync.cs │ │ ├── QueryUnbufferedAsync`.cs │ │ └── Query`.cs └── Helper │ └── GetConnection.cs ├── Dapper.Transaction.StrongName.Net461 ├── Dapper.Transaction.StrongName.Net461.csproj ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── Dapper.Transaction.StrongName.Net5 └── Dapper.Transaction.StrongName.Net5.csproj ├── Dapper.Transaction.StrongName.Net7 └── Dapper.Transaction.StrongName.Net7.csproj ├── Dapper.Transaction.StrongName.NetStandard20 └── Dapper.Transaction.StrongName.NetStandard20.csproj ├── Dapper.Transaction.sln ├── Key.snk ├── LICENSE ├── Lab.StrongName ├── App.config ├── Lab.StrongName.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── Lab ├── App.config ├── Lab.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── README.md ├── dapper-plus-sponsor.png └── entity-framework-extensions-sponsor.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [zzzprojects] 2 | custom: ["https://zzzprojects.com/contribute"] 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Here is what to include in your request to make sure we implement a solution as quickly as possible. 2 | 3 | ## 1. Description 4 | Describe the issue or propose a feature. 5 | 6 | ## 2. Exception 7 | If you are seeing an exception, include the full exception details (message and stack trace). 8 | 9 | ``` 10 | Exception message: 11 | Stack trace: 12 | ``` 13 | 14 | ## 3. Fiddle or Project 15 | If you are able, 16 | 17 | Provide a Fiddle that reproduce the issue: https://dotnetfiddle.net/25Vjsn 18 | 19 | Or provide a project/solution that we can run to reproduce the issue. 20 | - Make sure the project compile 21 | - Make sure to provide only the code that is required to reproduce the issue, not the whole project 22 | - You can send private code here: info@zzzprojects.com 23 | 24 | Otherwise, make sure to include as much information as possible to help our team to reproduce the issue. 25 | 26 | ## 4. Any further technical details 27 | Add any relevant detail that can help us. 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | packages/ 3 | ################# 4 | ## Eclipse 5 | ################# 6 | 7 | *.pydevproject 8 | .project 9 | .metadata 10 | bin/ 11 | tmp/ 12 | *.tmp 13 | *.bak 14 | *.swp 15 | *~.nib 16 | local.properties 17 | .classpath 18 | .settings/ 19 | .loadpath 20 | 21 | # External tool builders 22 | .externalToolBuilders/ 23 | 24 | # Locally stored "Eclipse launch configurations" 25 | *.launch 26 | 27 | # CDT-specific 28 | .cproject 29 | 30 | # PDT-specific 31 | .buildpath 32 | 33 | 34 | ################# 35 | ## Visual Studio 36 | ################# 37 | 38 | ## Ignore Visual Studio temporary files, build results, and 39 | ## files generated by popular Visual Studio add-ons. 40 | 41 | # User-specific files 42 | *.suo 43 | *.user 44 | *.sln.docstates 45 | 46 | # Build results 47 | [Dd]ebug/ 48 | [Rr]elease/ 49 | *_i.c 50 | *_p.c 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.vspscc 65 | .builds 66 | *.dotCover 67 | 68 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 69 | #packages/ 70 | 71 | # Visual C++ cache files 72 | ipch/ 73 | *.aps 74 | *.ncb 75 | *.opensdf 76 | *.sdf 77 | 78 | # Visual Studio profiler 79 | *.psess 80 | *.vsp 81 | 82 | # ReSharper is a .NET coding add-in 83 | _ReSharper* 84 | 85 | # Installshield output folder 86 | [Ee]xpress 87 | 88 | # DocProject is a documentation generator add-in 89 | DocProject/buildhelp/ 90 | DocProject/Help/*.HxT 91 | DocProject/Help/*.HxC 92 | DocProject/Help/*.hhc 93 | DocProject/Help/*.hhk 94 | DocProject/Help/*.hhp 95 | DocProject/Help/Html2 96 | DocProject/Help/html 97 | 98 | # Click-Once directory 99 | publish 100 | 101 | # Others 102 | [Bb]in 103 | [Oo]bj 104 | sql 105 | TestResults 106 | *.Cache 107 | ClientBin 108 | stylecop.* 109 | ~$* 110 | *.dbmdl 111 | Generated_Code #added for RIA/Silverlight projects 112 | 113 | # Backup & report files from converting an old project file to a newer 114 | # Visual Studio version. Backup files are not needed, because we have git ;-) 115 | _UpgradeReport_Files/ 116 | Backup*/ 117 | UpgradeLog*.XML 118 | 119 | 120 | 121 | ############ 122 | ## Windows 123 | ############ 124 | 125 | # Windows image file caches 126 | Thumbs.db 127 | 128 | # Folder config file 129 | Desktop.ini 130 | 131 | 132 | ############# 133 | ## Python 134 | ############# 135 | 136 | *.py[co] 137 | 138 | # Packages 139 | *.egg 140 | *.egg-info 141 | dist 142 | build 143 | eggs 144 | parts 145 | bin 146 | var 147 | sdist 148 | develop-eggs 149 | .installed.cfg 150 | 151 | # Installer logs 152 | pip-log.txt 153 | 154 | # Unit test / coverage reports 155 | .coverage 156 | .tox 157 | 158 | #Translations 159 | *.mo 160 | 161 | #Mr Developer 162 | .mr.developer.cfg 163 | 164 | # Mac crap 165 | .DS_Store -------------------------------------------------------------------------------- /Dapper.Transaction.Net461/Dapper.Transaction.Net461.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B95951E5-7167-4B34-9CF0-D33AC6178333} 8 | Library 9 | Properties 10 | Dapper.Transaction 11 | Dapper.Transaction 12 | v4.6.1 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | bin\Release\Dapper.Transaction.xml 33 | 34 | 35 | false 36 | 37 | 38 | ..\Key.snk 39 | 40 | 41 | 42 | ..\packages\Dapper.2.1.35\lib\net461\Dapper.dll 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Dapper.Transaction.Net461/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("Dapper.Transaction")] 5 | [assembly: AssemblyDescription("IDbTransaction extension methods for Dapper: A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite, SqlCE, Firebird etc..")] 6 | [assembly: AssemblyConfiguration("")] 7 | [assembly: AssemblyCompany("ZZZ Projects Inc.")] 8 | [assembly: AssemblyProduct("Dapper.Transaction")] 9 | [assembly: AssemblyCopyright("ZZZ Projects Inc.")] 10 | [assembly: AssemblyTrademark("")] 11 | [assembly: AssemblyCulture("")] 12 | [assembly: ComVisible(false)] 13 | [assembly: Guid("b95951e5-7167-4b34-9cf0-d33ac6178333")] 14 | 15 | [assembly: AssemblyVersion("2.1.35.0")] 16 | [assembly: AssemblyFileVersion("2.1.35.0")] 17 | -------------------------------------------------------------------------------- /Dapper.Transaction.Net461/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Dapper.Transaction.Net5/Dapper.Transaction.Net5.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net5.0 5 | Dapper.Transaction 6 | Dapper.Transaction 7 | 2.1.35 8 | ZZZ Projects Inc. 9 | ZZZ Projects Inc. 10 | ZZZ Projects Inc. 11 | 12 | 13 | 14 | bin\Release\ 15 | bin\Release\Dapper.Transaction.xml 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Dapper.Transaction.Net7/Dapper.Transaction.Net7.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | Dapper.Transaction 6 | Dapper.Transaction 7 | 2.1.35 8 | ZZZ Projects Inc. 9 | ZZZ Projects Inc. 10 | ZZZ Projects Inc. 11 | 12 | 13 | 14 | bin\Release\ 15 | bin\Release\Dapper.Transaction.xml 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Dapper.Transaction.NetStandard20/Dapper.Transaction.NetStandard20.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | false 6 | ..\Key.snk 7 | 2.1.35 8 | Dapper.Transaction 9 | ZZZ Projects Inc. 10 | ZZZ Projects Inc. 11 | Dapper.Transaction 12 | Dapper.Transaction 13 | IDbTransaction extension methods for Dapper: A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite, SqlCE, Firebird etc.. 14 | ZZZ Projects Inc. 15 | 16 | 17 | 18 | \bin\Release\netstandard2.0\Dapper.Transaction.xml 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/Dapper.Transaction.Shared.projitems: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | f448faea-4a1d-4432-8343-99c346856dab 7 | 8 | 9 | Dapper.Transaction.Shared 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/Dapper.Transaction.Shared.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | f448faea-4a1d-4432-8343-99c346856dab 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/Execute.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace Dapper.Transaction 4 | { 5 | public static partial class DbTransactionExtensions 6 | { 7 | /// 8 | /// Execute parameterized SQL. 9 | /// 10 | /// The transaction to execute on. 11 | /// The command to execute on this connection. 12 | /// The number of rows affected. 13 | public static int Execute(this IDbTransaction transaction, CommandDefinition command) 14 | { 15 | return InternalGetConnection.GetConnection(transaction).Execute(command); 16 | } 17 | 18 | /// 19 | /// Execute parameterized SQL. 20 | /// 21 | /// The transaction to query on. 22 | /// The SQL to execute for this query. 23 | /// The parameters to use for this query. 24 | /// Number of seconds before command execution timeout. 25 | /// Is it a stored proc or a batch? 26 | /// The number of rows affected. 27 | public static int Execute(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 28 | { 29 | return InternalGetConnection.GetConnection(transaction).Execute(sql, param, transaction, commandTimeout, commandType); 30 | } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/ExecuteAsync.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using System.Threading.Tasks; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | /// 9 | /// Execute a command asynchronously using Task. 10 | /// 11 | /// The transaction to execute on. 12 | /// The command to execute on this connection. 13 | /// The number of rows affected. 14 | public static Task ExecuteAsync(this IDbTransaction transaction, CommandDefinition command) 15 | { 16 | return InternalGetConnection.GetConnection(transaction).ExecuteAsync(command); 17 | } 18 | 19 | /// 20 | /// Execute a command asynchronously using Task. 21 | /// 22 | /// The transaction to query on. 23 | /// The SQL to execute for this query. 24 | /// The parameters to use for this query. 25 | /// Number of seconds before command execution timeout. 26 | /// Is it a stored proc or a batch? 27 | /// The number of rows affected. 28 | public static Task ExecuteAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 29 | { 30 | return InternalGetConnection.GetConnection(transaction).ExecuteAsync(sql, param, transaction, commandTimeout, commandType); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/ExecuteReader.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace Dapper.Transaction 4 | { 5 | public static partial class DbTransactionExtensions 6 | { 7 | /// 8 | /// Execute parameterized SQL and return an . 9 | /// 10 | /// The transaction to execute on. 11 | /// The SQL to execute. 12 | /// The parameters to use for this command. 13 | /// Number of seconds before command execution timeout. 14 | /// Is it a stored proc or a batch? 15 | /// An that can be used to iterate over the results of the SQL query. 16 | /// 17 | /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a 18 | /// or . 19 | /// 20 | /// 21 | /// 22 | /// 29 | /// 30 | /// 31 | public static IDataReader ExecuteReader(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 32 | { 33 | return InternalGetConnection.GetConnection(transaction).ExecuteReader(sql, param, transaction, commandTimeout, commandType); 34 | } 35 | 36 | /// 37 | /// Execute parameterized SQL and return an . 38 | /// 39 | /// The connection to execute on. 40 | /// The command to execute. 41 | /// An that can be used to iterate over the results of the SQL query. 42 | /// 43 | /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a 44 | /// or . 45 | /// 46 | public static IDataReader ExecuteReader(this IDbTransaction transaction, CommandDefinition command) 47 | { 48 | return InternalGetConnection.GetConnection(transaction).ExecuteReader(command); 49 | } 50 | 51 | /// 52 | /// Execute parameterized SQL and return an . 53 | /// 54 | /// The connection to execute on. 55 | /// The command to execute. 56 | /// The flags for this reader. 57 | /// An that can be used to iterate over the results of the SQL query. 58 | /// 59 | /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a 60 | /// or . 61 | /// 62 | public static IDataReader ExecuteReader(this IDbTransaction transaction, CommandDefinition command, CommandBehavior commandBehavior) 63 | { 64 | return InternalGetConnection.GetConnection(transaction).ExecuteReader(command, commandBehavior); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/ExecuteReaderAsync.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using System.Data.Common; 3 | using System.Threading.Tasks; 4 | 5 | namespace Dapper.Transaction 6 | { 7 | public static partial class DbTransactionExtensions 8 | { 9 | /// 10 | /// Execute parameterized SQL and return an . 11 | /// 12 | /// The transaction to execute on. 13 | /// The SQL to execute. 14 | /// The parameters to use for this command. 15 | /// Number of seconds before command execution timeout. 16 | /// Is it a stored proc or a batch? 17 | /// An that can be used to iterate over the results of the SQL query. 18 | /// 19 | /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a 20 | /// or . 21 | /// 22 | /// 23 | /// 24 | /// 31 | /// 32 | /// 33 | public static Task ExecuteReaderAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 34 | { 35 | return InternalGetConnection.GetConnection(transaction).ExecuteReaderAsync(sql, param, transaction, commandTimeout, commandType); 36 | } 37 | 38 | /// 39 | /// Execute parameterized SQL and return a . 40 | /// 41 | /// The transaction to execute on. 42 | /// The SQL to execute. 43 | /// The parameters to use for this command. 44 | /// Number of seconds before command execution timeout. 45 | /// Is it a stored proc or a batch? 46 | public static Task ExecuteReaderAsync(this DbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 47 | { 48 | return InternalGetConnection.GetConnection(transaction).ExecuteReaderAsync(sql, param, transaction, commandTimeout, commandType); 49 | } 50 | 51 | /// 52 | /// Execute parameterized SQL and return an . 53 | /// 54 | /// The transaction to execute on. 55 | /// The command to execute. 56 | /// An that can be used to iterate over the results of the SQL query. 57 | /// 58 | /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a 59 | /// or . 60 | /// 61 | public static Task ExecuteReaderAsync(this IDbTransaction transaction, CommandDefinition command) 62 | { 63 | return InternalGetConnection.GetConnection(transaction).ExecuteReaderAsync(command); 64 | } 65 | 66 | /// 67 | /// Execute parameterized SQL and return a . 68 | /// 69 | /// The transaction to execute on. 70 | /// The command to execute. 71 | public static Task ExecuteReaderAsync(this DbTransaction transaction, CommandDefinition command) 72 | { 73 | return InternalGetConnection.GetConnection(transaction).ExecuteReaderAsync(command); 74 | } 75 | 76 | /// 77 | /// Execute parameterized SQL and return an . 78 | /// 79 | /// The transaction to execute on. 80 | /// The command to execute. 81 | /// The flags for this reader. 82 | /// An that can be used to iterate over the results of the SQL query. 83 | /// 84 | /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a 85 | /// or . 86 | /// 87 | public static Task ExecuteReaderAsync(this IDbTransaction transaction, CommandDefinition command, CommandBehavior commandBehavior) 88 | { 89 | return InternalGetConnection.GetConnection(transaction).ExecuteReaderAsync(command, commandBehavior); 90 | } 91 | 92 | /// 93 | /// Execute parameterized SQL and return a . 94 | /// 95 | /// The transaction to execute on. 96 | /// The command to execute. 97 | /// The flags for this reader. 98 | public static Task ExecuteReaderAsync(this DbTransaction transaction, CommandDefinition command, CommandBehavior commandBehavior) 99 | { 100 | return InternalGetConnection.GetConnection(transaction).ExecuteReaderAsync(command, commandBehavior); 101 | } 102 | } 103 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/ExecuteScalar.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace Dapper.Transaction 4 | { 5 | public static partial class DbTransactionExtensions 6 | { 7 | /// 8 | /// Execute parameterized SQL that selects a single value. 9 | /// 10 | /// The transaction to execute on. 11 | /// The SQL to execute. 12 | /// The parameters to use for this command. 13 | /// Number of seconds before command execution timeout. 14 | /// Is it a stored proc or a batch? 15 | /// The first cell selected as . 16 | public static object ExecuteScalar(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 17 | { 18 | return InternalGetConnection.GetConnection(transaction).ExecuteScalar(sql, param, transaction, commandTimeout, commandType); 19 | } 20 | 21 | /// 22 | /// Execute parameterized SQL that selects a single value. 23 | /// 24 | /// The transaction to execute on. 25 | /// The command to execute. 26 | /// The first cell selected as . 27 | public static object ExecuteScalar(this IDbTransaction transaction, CommandDefinition command) 28 | { 29 | return InternalGetConnection.GetConnection(transaction).ExecuteScalar(command); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/ExecuteScalarAsync.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using System.Threading.Tasks; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | /// 9 | /// Execute parameterized SQL that selects a single value. 10 | /// 11 | /// The transaction to execute on. 12 | /// The SQL to execute. 13 | /// The parameters to use for this command. 14 | /// Number of seconds before command execution timeout. 15 | /// Is it a stored proc or a batch? 16 | /// The first cell returned, as . 17 | public static Task ExecuteScalarAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 18 | { 19 | return InternalGetConnection.GetConnection(transaction).ExecuteScalarAsync(sql, param, transaction, commandTimeout, commandType); 20 | } 21 | 22 | /// 23 | /// Execute parameterized SQL that selects a single value. 24 | /// 25 | /// The transaction to execute on. 26 | /// The command to execute. 27 | /// The first cell selected as . 28 | public static Task ExecuteScalarAsync(this IDbTransaction transaction, CommandDefinition command) 29 | { 30 | return InternalGetConnection.GetConnection(transaction).ExecuteScalarAsync(command); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/ExecuteScalarAsync`.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using System.Threading.Tasks; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | /// 9 | /// Execute parameterized SQL that selects a single value. 10 | /// 11 | /// The type to return. 12 | /// The transaction to execute on. 13 | /// The SQL to execute. 14 | /// The parameters to use for this command. 15 | /// Number of seconds before command execution timeout. 16 | /// Is it a stored proc or a batch? 17 | /// The first cell returned, as . 18 | public static Task ExecuteScalarAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 19 | { 20 | return InternalGetConnection.GetConnection(transaction).ExecuteScalarAsync(sql, param, transaction, commandTimeout, commandType); 21 | } 22 | 23 | 24 | /// 25 | /// Execute parameterized SQL that selects a single value. 26 | /// 27 | /// The type to return. 28 | /// The transaction to execute on. 29 | /// The command to execute. 30 | /// The first cell selected as . 31 | public static Task ExecuteScalarAsync(this IDbTransaction transaction, CommandDefinition command) 32 | { 33 | return InternalGetConnection.GetConnection(transaction).ExecuteScalarAsync(command); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/ExecuteScalar`.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace Dapper.Transaction 4 | { 5 | public static partial class DbTransactionExtensions 6 | { 7 | /// 8 | /// Execute parameterized SQL that selects a single value. 9 | /// 10 | /// The type to return. 11 | /// The transaction to execute on. 12 | /// The SQL to execute. 13 | /// The parameters to use for this command. 14 | /// Number of seconds before command execution timeout. 15 | /// Is it a stored proc or a batch? 16 | /// The first cell returned, as . 17 | public static T ExecuteScalar(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 18 | { 19 | return InternalGetConnection.GetConnection(transaction).ExecuteScalar(sql, param, transaction, commandTimeout, commandType); 20 | } 21 | 22 | 23 | /// 24 | /// Execute parameterized SQL that selects a single value. 25 | /// 26 | /// The type to return. 27 | /// The transaction to execute on. 28 | /// The command to execute. 29 | /// The first cell selected as . 30 | public static T ExecuteScalar(this IDbTransaction transaction, CommandDefinition command) 31 | { 32 | return InternalGetConnection.GetConnection(transaction).ExecuteScalar(command); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/Query.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | 5 | namespace Dapper.Transaction 6 | { 7 | public static partial class DbTransactionExtensions 8 | { 9 | /// 10 | /// Return a sequence of dynamic objects with properties matching the columns. 11 | /// 12 | /// The transaction to query on. 13 | /// The SQL to execute for the query. 14 | /// The parameters to pass, if any. 15 | /// Whether to buffer the results in memory. 16 | /// The command timeout (in seconds). 17 | /// The type of command to execute. 18 | /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> 19 | public static IEnumerable Query(this IDbTransaction transaction, string sql, object param = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null) 20 | { 21 | return InternalGetConnection.GetConnection(transaction).Query(sql, param, transaction, buffered, commandTimeout, commandType); 22 | } 23 | 24 | 25 | /// 26 | /// Executes a single-row query, returning the data typed as . 27 | /// 28 | /// The transaction to query on. 29 | /// The type to return. 30 | /// The SQL to execute for the query. 31 | /// The parameters to pass, if any. 32 | /// Whether to buffer results in memory. 33 | /// The command timeout (in seconds). 34 | /// The type of command to execute. 35 | /// is null. 36 | /// 37 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 38 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 39 | /// 40 | public static IEnumerable Query(this IDbTransaction transaction, Type type, string sql, object param = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null) 41 | { 42 | return InternalGetConnection.GetConnection(transaction).Query(type, sql, param, transaction, buffered, commandTimeout, commandType); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryAsync.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Threading.Tasks; 5 | 6 | namespace Dapper.Transaction 7 | { 8 | public static partial class DbTransactionExtensions 9 | { 10 | /// 11 | /// Execute a query asynchronously using Task. 12 | /// 13 | /// The transaction to query on. 14 | /// The SQL to execute for the query. 15 | /// The parameters to pass, if any. 16 | /// The command timeout (in seconds). 17 | /// The type of command to execute. 18 | /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> 19 | public static Task> QueryAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 20 | { 21 | return InternalGetConnection.GetConnection(transaction).QueryAsync(sql, param, transaction, commandTimeout, commandType); 22 | } 23 | 24 | 25 | /// 26 | /// Execute a query asynchronously using Task. 27 | /// 28 | /// The connection to query on. 29 | /// The type to return. 30 | /// The SQL to execute for the query. 31 | /// The parameters to pass, if any. 32 | /// The command timeout (in seconds). 33 | /// The type of command to execute. 34 | /// is null. 35 | public static Task> QueryAsync(this IDbTransaction transaction, Type type, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 36 | { 37 | return InternalGetConnection.GetConnection(transaction).QueryAsync(type, sql, param, transaction, commandTimeout, commandType); 38 | } 39 | 40 | /// 41 | /// Execute a query asynchronously using Task. 42 | /// 43 | /// The transaction to query on. 44 | /// The command used to query on this connection. 45 | /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> 46 | public static Task> QueryAsync(this IDbTransaction transaction, CommandDefinition command) 47 | { 48 | return InternalGetConnection.GetConnection(transaction).QueryAsync(command); 49 | } 50 | 51 | /// 52 | /// Execute a query asynchronously using Task. 53 | /// 54 | /// The transaction to query on. 55 | /// The type to return. 56 | /// The command used to query on this connection. 57 | public static Task> QueryAsync(this IDbTransaction transaction, Type type, CommandDefinition command) 58 | { 59 | return InternalGetConnection.GetConnection(transaction).QueryAsync(type, command); 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryAsync`.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Threading.Tasks; 5 | 6 | namespace Dapper.Transaction 7 | { 8 | public static partial class DbTransactionExtensions 9 | { 10 | /// 11 | /// Executes a query, returning the data typed as . 12 | /// 13 | /// The type of results to return. 14 | /// The transaction to query on. 15 | /// The SQL to execute for the query. 16 | /// The parameters to pass, if any. 17 | /// The command timeout (in seconds). 18 | /// The type of command to execute. 19 | /// 20 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 21 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 22 | /// 23 | public static Task> QueryAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 24 | { 25 | return InternalGetConnection.GetConnection(transaction).QueryAsync(sql, param, transaction, commandTimeout, commandType); 26 | } 27 | 28 | /// 29 | /// Executes a query, returning the data typed as . 30 | /// 31 | /// The type of results to return. 32 | /// The transaction to query on. 33 | /// The command used to query on this connection. 34 | /// 35 | /// A sequence of data of ; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 36 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 37 | /// 38 | public static Task> QueryAsync(this IDbTransaction transaction, CommandDefinition command) 39 | { 40 | return InternalGetConnection.GetConnection(transaction).QueryAsync(command); 41 | } 42 | 43 | /// 44 | /// Perform a multi-mapping query with 2 input types. 45 | /// This returns a single type, combined from the raw types via . 46 | /// 47 | /// The first type in the recordset. 48 | /// The second type in the recordset. 49 | /// The combined type to return. 50 | /// The transaction to query on. 51 | /// The SQL to execute for this query. 52 | /// The function to map row types to the return type. 53 | /// The parameters to use for this query. 54 | /// Whether to buffer the results in memory. 55 | /// The field we should split and read the second object from (default: "Id"). 56 | /// Number of seconds before command execution timeout. 57 | /// Is it a stored proc or a batch? 58 | /// An enumerable of . 59 | public static Task> QueryAsync(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 60 | { 61 | return InternalGetConnection.GetConnection(transaction).QueryAsync(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 62 | } 63 | 64 | /// 65 | /// Perform a asynchronous multi-mapping query with 2 input types. 66 | /// This returns a single type, combined from the raw types via . 67 | /// 68 | /// The first type in the recordset. 69 | /// The second type in the recordset. 70 | /// The combined type to return. 71 | /// The transaction to query on. 72 | /// The field we should split and read the second object from (default: "Id"). 73 | /// The command to execute. 74 | /// The function to map row types to the return type. 75 | /// An enumerable of . 76 | public static Task> QueryAsync(this IDbTransaction transaction, CommandDefinition command, Func map, string splitOn = "Id") 77 | { 78 | return InternalGetConnection.GetConnection(transaction).QueryAsync(command, map, splitOn); 79 | } 80 | 81 | /// 82 | /// Perform a multi-mapping query with 3 input types. 83 | /// This returns a single type, combined from the raw types via . 84 | /// 85 | /// The first type in the recordset. 86 | /// The second type in the recordset. 87 | /// The third type in the recordset. 88 | /// The combined type to return. 89 | /// The transaction to query on. 90 | /// The SQL to execute for this query. 91 | /// The function to map row types to the return type. 92 | /// The parameters to use for this query. 93 | /// Whether to buffer the results in memory. 94 | /// The field we should split and read the second object from (default: "Id"). 95 | /// Number of seconds before command execution timeout. 96 | /// Is it a stored proc or a batch? 97 | /// An enumerable of . 98 | public static Task> QueryAsync(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 99 | { 100 | return InternalGetConnection.GetConnection(transaction).QueryAsync(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 101 | } 102 | 103 | /// 104 | /// Perform a asynchronous multi-mapping query with 3 input types. 105 | /// This returns a single type, combined from the raw types via . 106 | /// 107 | /// The first type in the recordset. 108 | /// The second type in the recordset. 109 | /// The third type in the recordset. 110 | /// The combined type to return. 111 | /// The transaction to query on. 112 | /// The field we should split and read the second object from (default: "Id"). 113 | /// The command to execute. 114 | /// The function to map row types to the return type. 115 | /// An enumerable of . 116 | public static Task> QueryAsync(this IDbTransaction transaction, CommandDefinition command, Func map, string splitOn = "Id") 117 | { 118 | return InternalGetConnection.GetConnection(transaction).QueryAsync(command, map, splitOn); 119 | } 120 | 121 | 122 | /// 123 | /// Perform a multi-mapping query with 4 input types. 124 | /// This returns a single type, combined from the raw types via . 125 | /// 126 | /// The first type in the recordset. 127 | /// The second type in the recordset. 128 | /// The third type in the recordset. 129 | /// The fourth type in the recordset. 130 | /// The combined type to return. 131 | /// The transaction to query on. 132 | /// The SQL to execute for this query. 133 | /// The function to map row types to the return type. 134 | /// The parameters to use for this query. 135 | /// Whether to buffer the results in memory. 136 | /// The field we should split and read the second object from (default: "Id"). 137 | /// Number of seconds before command execution timeout. 138 | /// Is it a stored proc or a batch? 139 | /// An enumerable of . 140 | public static Task> QueryAsync(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 141 | { 142 | return InternalGetConnection.GetConnection(transaction).QueryAsync(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 143 | } 144 | 145 | /// 146 | /// Perform a asynchronous multi-mapping query with 4 input types. 147 | /// This returns a single type, combined from the raw types via . 148 | /// 149 | /// The first type in the recordset. 150 | /// The second type in the recordset. 151 | /// The third type in the recordset. 152 | /// The fourth type in the recordset. 153 | /// The combined type to return. 154 | /// The transaction to query on. 155 | /// The field we should split and read the second object from (default: "Id"). 156 | /// The command to execute. 157 | /// The function to map row types to the return type. 158 | /// An enumerable of . 159 | public static Task> QueryAsync(this IDbTransaction transaction, CommandDefinition command, Func map, string splitOn = "Id") 160 | { 161 | return InternalGetConnection.GetConnection(transaction).QueryAsync(command, map, splitOn); 162 | } 163 | 164 | /// 165 | /// Perform a multi-mapping query with 5 input types. 166 | /// This returns a single type, combined from the raw types via . 167 | /// 168 | /// The first type in the recordset. 169 | /// The second type in the recordset. 170 | /// The third type in the recordset. 171 | /// The fourth type in the recordset. 172 | /// The fifth type in the recordset. 173 | /// The combined type to return. 174 | /// The transaction to query on. 175 | /// The SQL to execute for this query. 176 | /// The function to map row types to the return type. 177 | /// The parameters to use for this query. 178 | /// Whether to buffer the results in memory. 179 | /// The field we should split and read the second object from (default: "Id"). 180 | /// Number of seconds before command execution timeout. 181 | /// Is it a stored proc or a batch? 182 | /// An enumerable of . 183 | public static Task> QueryAsync(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 184 | { 185 | return InternalGetConnection.GetConnection(transaction).QueryAsync(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 186 | } 187 | 188 | /// 189 | /// Perform a asynchronous multi-mapping query with 5 input types. 190 | /// This returns a single type, combined from the raw types via . 191 | /// 192 | /// The first type in the recordset. 193 | /// The second type in the recordset. 194 | /// The third type in the recordset. 195 | /// The fourth type in the recordset. 196 | /// The fifth type in the recordset. 197 | /// The combined type to return. 198 | /// The transaction to query on. 199 | /// The field we should split and read the second object from (default: "Id"). 200 | /// The command to execute. 201 | /// The function to map row types to the return type. 202 | /// An enumerable of . 203 | public static Task> QueryAsync(this IDbTransaction transaction, CommandDefinition command, Func map, string splitOn = "Id") 204 | { 205 | return InternalGetConnection.GetConnection(transaction).QueryAsync(command, map, splitOn); 206 | } 207 | 208 | /// 209 | /// Perform a multi-mapping query with 6 input types. 210 | /// This returns a single type, combined from the raw types via . 211 | /// 212 | /// The first type in the recordset. 213 | /// The second type in the recordset. 214 | /// The third type in the recordset. 215 | /// The fourth type in the recordset. 216 | /// The fifth type in the recordset. 217 | /// The sixth type in the recordset. 218 | /// The combined type to return. 219 | /// The transaction to query on. 220 | /// The SQL to execute for this query. 221 | /// The function to map row types to the return type. 222 | /// The parameters to use for this query. 223 | /// Whether to buffer the results in memory. 224 | /// The field we should split and read the second object from (default: "Id"). 225 | /// Number of seconds before command execution timeout. 226 | /// Is it a stored proc or a batch? 227 | /// An enumerable of . 228 | public static Task> QueryAsync(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 229 | { 230 | return InternalGetConnection.GetConnection(transaction).QueryAsync(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 231 | } 232 | 233 | /// 234 | /// Perform a asynchronous multi-mapping query with 6 input types. 235 | /// This returns a single type, combined from the raw types via . 236 | /// 237 | /// The first type in the recordset. 238 | /// The second type in the recordset. 239 | /// The third type in the recordset. 240 | /// The fourth type in the recordset. 241 | /// The fifth type in the recordset. 242 | /// The sixth type in the recordset. 243 | /// The combined type to return. 244 | /// The transaction to query on. 245 | /// The field we should split and read the second object from (default: "Id"). 246 | /// The command to execute. 247 | /// The function to map row types to the return type. 248 | /// An enumerable of . 249 | public static Task> QueryAsync(this IDbTransaction transaction, CommandDefinition command, Func map, string splitOn = "Id") 250 | { 251 | return InternalGetConnection.GetConnection(transaction).QueryAsync(command, map, splitOn); 252 | } 253 | 254 | /// 255 | /// Perform a multi-mapping query with 7 input types. If you need more types -> use Query with Type[] parameter. 256 | /// This returns a single type, combined from the raw types via . 257 | /// 258 | /// The first type in the recordset. 259 | /// The second type in the recordset. 260 | /// The third type in the recordset. 261 | /// The fourth type in the recordset. 262 | /// The fifth type in the recordset. 263 | /// The sixth type in the recordset. 264 | /// The seventh type in the recordset. 265 | /// The combined type to return. 266 | /// The transaction to query on. 267 | /// The SQL to execute for this query. 268 | /// The function to map row types to the return type. 269 | /// The parameters to use for this query. 270 | /// Whether to buffer the results in memory. 271 | /// The field we should split and read the second object from (default: "Id"). 272 | /// Number of seconds before command execution timeout. 273 | /// Is it a stored proc or a batch? 274 | /// An enumerable of . 275 | public static Task> QueryAsync(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 276 | { 277 | return InternalGetConnection.GetConnection(transaction).QueryAsync(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 278 | } 279 | 280 | /// 281 | /// Perform an asynchronous multi-mapping query with 7 input types. 282 | /// This returns a single type, combined from the raw types via . 283 | /// 284 | /// The first type in the recordset. 285 | /// The second type in the recordset. 286 | /// The third type in the recordset. 287 | /// The fourth type in the recordset. 288 | /// The fifth type in the recordset. 289 | /// The sixth type in the recordset. 290 | /// The seventh type in the recordset. 291 | /// The combined type to return. 292 | /// The transaction to query on. 293 | /// The field we should split and read the second object from (default: "Id"). 294 | /// The command to execute. 295 | /// The function to map row types to the return type. 296 | /// An enumerable of . 297 | public static Task> QueryAsync(this IDbTransaction transaction, CommandDefinition command, Func map, string splitOn = "Id") 298 | { 299 | return InternalGetConnection.GetConnection(transaction).QueryAsync(command, map, splitOn); 300 | } 301 | 302 | /// 303 | /// Perform a multi-mapping query with an arbitrary number of input types. 304 | /// This returns a single type, combined from the raw types via . 305 | /// 306 | /// The combined type to return. 307 | /// The transaction to query on. 308 | /// The SQL to execute for this query. 309 | /// Array of types in the recordset. 310 | /// The function to map row types to the return type. 311 | /// The parameters to use for this query. 312 | /// Whether to buffer the results in memory. 313 | /// The field we should split and read the second object from (default: "Id"). 314 | /// Number of seconds before command execution timeout. 315 | /// Is it a stored proc or a batch? 316 | /// An enumerable of . 317 | public static Task> QueryAsync(this IDbTransaction transaction, string sql, Type[] types, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 318 | { 319 | return InternalGetConnection.GetConnection(transaction).QueryAsync(sql, types, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 320 | } 321 | } 322 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryFirst.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | /// 9 | /// Return a dynamic object with properties matching the columns. 10 | /// 11 | /// The transaction to query on. 12 | /// The SQL to execute for the query. 13 | /// The parameters to pass, if any. 14 | /// The command timeout (in seconds). 15 | /// The type of command to execute. 16 | /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> 17 | public static dynamic QueryFirst(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 18 | { 19 | return InternalGetConnection.GetConnection(transaction).QueryFirst(sql, param, transaction, commandTimeout, commandType); 20 | } 21 | 22 | /// 23 | /// Executes a single-row query, returning the data typed as . 24 | /// 25 | /// The transaction to query on. 26 | /// The type to return. 27 | /// The SQL to execute for the query. 28 | /// The parameters to pass, if any. 29 | /// The command timeout (in seconds). 30 | /// The type of command to execute. 31 | /// is null. 32 | /// 33 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 34 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 35 | /// 36 | public static object QueryFirst(this IDbTransaction transaction, Type type, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 37 | { 38 | return InternalGetConnection.GetConnection(transaction).QueryFirst(type, sql, param, transaction, commandTimeout, commandType); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryFirstAsync.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using System.Threading.Tasks; 4 | 5 | namespace Dapper.Transaction 6 | { 7 | public static partial class DbTransactionExtensions 8 | { 9 | /// 10 | /// Execute a single-row query asynchronously using Task. 11 | /// 12 | /// The transaction to query on. 13 | /// The command used to query on this connection. 14 | /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> 15 | public static Task QueryFirstAsync(this IDbTransaction transaction, CommandDefinition command) 16 | { 17 | return InternalGetConnection.GetConnection(transaction).QueryFirstAsync(command); 18 | } 19 | 20 | /// 21 | /// Execute a single-row query asynchronously using Task. 22 | /// 23 | /// The transaction to query on. 24 | /// The type to return. 25 | /// The command used to query on this connection. 26 | public static Task QueryFirstAsync(this IDbTransaction transaction, Type type, CommandDefinition command) 27 | { 28 | return InternalGetConnection.GetConnection(transaction).QueryFirstAsync(type, command); 29 | } 30 | 31 | /// 32 | /// Execute a single-row query asynchronously using Task. 33 | /// 34 | /// The transaction to query on. 35 | /// The SQL to execute for the query. 36 | /// The parameters to pass, if any. 37 | /// The command timeout (in seconds). 38 | /// The type of command to execute. 39 | public static Task QueryFirstAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 40 | { 41 | return InternalGetConnection.GetConnection(transaction).QueryFirstAsync(sql, param, transaction, commandTimeout, commandType); 42 | } 43 | 44 | /// 45 | /// Execute a single-row query asynchronously using Task. 46 | /// 47 | /// The transaction to query on. 48 | /// The type to return. 49 | /// The SQL to execute for the query. 50 | /// The parameters to pass, if any. 51 | /// The command timeout (in seconds). 52 | /// The type of command to execute. 53 | /// is null. 54 | public static Task QueryFirstAsync(this IDbTransaction transaction, Type type, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 55 | { 56 | return InternalGetConnection.GetConnection(transaction).QueryFirstAsync(type, sql, param, transaction, commandTimeout, commandType); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryFirstAsync`.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using System.Threading.Tasks; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | /// 9 | /// Executes a single-row query, returning the data typed as . 10 | /// 11 | /// The type of result to return. 12 | /// The transaction to query on. 13 | /// The SQL to execute for the query. 14 | /// The parameters to pass, if any. 15 | /// The command timeout (in seconds). 16 | /// The type of command to execute. 17 | /// 18 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 19 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 20 | /// 21 | public static Task QueryFirstAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 22 | { 23 | return InternalGetConnection.GetConnection(transaction).QueryFirstAsync(sql, param, transaction, commandTimeout, commandType); 24 | } 25 | 26 | /// 27 | /// Executes a query, returning the data typed as . 28 | /// 29 | /// The type of results to return. 30 | /// The transaction to query on. 31 | /// The command used to query on this connection. 32 | /// 33 | /// A single instance or null of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 34 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 35 | /// 36 | public static Task QueryFirstAsync(this IDbTransaction transaction, CommandDefinition command) 37 | { 38 | return InternalGetConnection.GetConnection(transaction).QueryFirstAsync(command); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryFirstOrDefault.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | /// 9 | /// Return a dynamic object with properties matching the columns. 10 | /// 11 | /// The transaction to query on. 12 | /// The SQL to execute for the query. 13 | /// The parameters to pass, if any. 14 | /// The command timeout (in seconds). 15 | /// The type of command to execute. 16 | /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> 17 | public static dynamic QueryFirstOrDefault(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 18 | { 19 | return InternalGetConnection.GetConnection(transaction).QueryFirstOrDefault(sql, param, transaction, commandTimeout, commandType); 20 | } 21 | 22 | /// 23 | /// Executes a single-row query, returning the data typed as . 24 | /// 25 | /// The transaction to query on. 26 | /// The type to return. 27 | /// The SQL to execute for the query. 28 | /// The parameters to pass, if any. 29 | /// The command timeout (in seconds). 30 | /// The type of command to execute. 31 | /// is null. 32 | /// 33 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 34 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 35 | /// 36 | public static object QueryFirstOrDefault(this IDbTransaction transaction, Type type, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 37 | { 38 | return InternalGetConnection.GetConnection(transaction).QueryFirstOrDefault(type, sql, param, transaction, commandTimeout, commandType); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryFirstOrDefaultAsync.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using System.Threading.Tasks; 4 | 5 | namespace Dapper.Transaction 6 | { 7 | public static partial class DbTransactionExtensions 8 | { 9 | /// 10 | /// Execute a single-row query asynchronously using Task. 11 | /// 12 | /// The transaction to query on. 13 | /// The command used to query on this connection. 14 | /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> 15 | public static Task QueryFirstOrDefaultAsync(this IDbTransaction transaction, CommandDefinition command) 16 | { 17 | return InternalGetConnection.GetConnection(transaction).QueryFirstOrDefaultAsync(command); 18 | } 19 | 20 | /// 21 | /// Execute a single-row query asynchronously using Task. 22 | /// 23 | /// The transaction to query on. 24 | /// The type to return. 25 | /// The command used to query on this connection. 26 | public static Task QueryFirstOrDefaultAsync(this IDbTransaction transaction, Type type, CommandDefinition command) 27 | { 28 | return InternalGetConnection.GetConnection(transaction).QueryFirstOrDefaultAsync(type, command); 29 | } 30 | 31 | /// 32 | /// Execute a single-row query asynchronously using Task. 33 | /// 34 | /// The transaction to query on. 35 | /// The SQL to execute for the query. 36 | /// The parameters to pass, if any. 37 | /// The command timeout (in seconds). 38 | /// The type of command to execute. 39 | public static Task QueryFirstOrDefaultAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 40 | { 41 | return InternalGetConnection.GetConnection(transaction).QueryFirstOrDefaultAsync(sql, param, transaction, commandTimeout, commandType); 42 | } 43 | 44 | /// 45 | /// Execute a single-row query asynchronously using Task. 46 | /// 47 | /// The connection to query on. 48 | /// The type to return. 49 | /// The SQL to execute for the query. 50 | /// The parameters to pass, if any. 51 | /// The command timeout (in seconds). 52 | /// The type of command to execute. 53 | /// is null. 54 | public static Task QueryFirstOrDefaultAsync(this IDbTransaction transaction, Type type, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 55 | { 56 | return InternalGetConnection.GetConnection(transaction).QueryFirstOrDefaultAsync(type, sql, param, transaction, commandTimeout, commandType); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryFirstOrDefaultAsync`.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using System.Threading.Tasks; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | /// 9 | /// Executes a single-row query, returning the data typed as . 10 | /// 11 | /// The type of result to return. 12 | /// The transaction to query on. 13 | /// The SQL to execute for the query. 14 | /// The parameters to pass, if any. 15 | /// The command timeout (in seconds). 16 | /// The type of command to execute. 17 | /// 18 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 19 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 20 | /// 21 | public static Task QueryFirstOrDefaultAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 22 | { 23 | return InternalGetConnection.GetConnection(transaction).QueryFirstOrDefaultAsync(sql, param, transaction, commandTimeout, commandType); 24 | } 25 | 26 | /// 27 | /// Executes a query, returning the data typed as . 28 | /// 29 | /// The type of results to return. 30 | /// The transaction to query on. 31 | /// The command used to query on this connection. 32 | /// 33 | /// A single or null instance of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 34 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 35 | /// 36 | public static Task QueryFirstOrDefaultAsync(this IDbTransaction transaction, CommandDefinition command) 37 | { 38 | return InternalGetConnection.GetConnection(transaction).QueryFirstOrDefaultAsync(command); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryFirstOrDefault`.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace Dapper.Transaction 4 | { 5 | public static partial class DbTransactionExtensions 6 | { 7 | /// 8 | /// Executes a single-row query, returning the data typed as . 9 | /// 10 | /// The type of result to return. 11 | /// The transaction to query on. 12 | /// The SQL to execute for the query. 13 | /// The parameters to pass, if any. 14 | /// The command timeout (in seconds). 15 | /// The type of command to execute. 16 | /// 17 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 18 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 19 | /// 20 | public static T QueryFirstOrDefault(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 21 | { 22 | return InternalGetConnection.GetConnection(transaction).QueryFirstOrDefault(sql, param, transaction, commandTimeout, commandType); 23 | } 24 | 25 | /// 26 | /// Executes a query, returning the data typed as . 27 | /// 28 | /// The type of results to return. 29 | /// The transaction to query on. 30 | /// The command used to query on this connection. 31 | /// 32 | /// A single or null instance of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 33 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 34 | /// 35 | public static T QueryFirstOrDefault(this IDbTransaction transaction, CommandDefinition command) 36 | { 37 | return InternalGetConnection.GetConnection(transaction).QueryFirstOrDefault(command); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryFirst`.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace Dapper.Transaction 4 | { 5 | public static partial class DbTransactionExtensions 6 | { 7 | /// 8 | /// Executes a single-row query, returning the data typed as . 9 | /// 10 | /// The type of result to return. 11 | /// The transaction to query on. 12 | /// The SQL to execute for the query. 13 | /// The parameters to pass, if any. 14 | /// The command timeout (in seconds). 15 | /// The type of command to execute. 16 | /// 17 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 18 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 19 | /// 20 | public static T QueryFirst(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 21 | { 22 | return InternalGetConnection.GetConnection(transaction).QueryFirst(sql, param, transaction, commandTimeout, commandType); 23 | } 24 | 25 | /// 26 | /// Executes a query, returning the data typed as . 27 | /// 28 | /// The type of results to return. 29 | /// The transaction to query on. 30 | /// The command used to query on this connection. 31 | /// 32 | /// A single instance or null of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 33 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 34 | /// 35 | public static T QueryFirst(this IDbTransaction transaction, CommandDefinition command) 36 | { 37 | return InternalGetConnection.GetConnection(transaction).QueryFirst(command); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryMultiple.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace Dapper.Transaction 4 | { 5 | public static partial class DbTransactionExtensions 6 | { 7 | /// 8 | /// Execute a command that returns multiple result sets, and access each in turn. 9 | /// 10 | /// The transaction to query on. 11 | /// The SQL to execute for this query. 12 | /// The parameters to use for this query. 13 | /// Number of seconds before command execution timeout. 14 | /// Is it a stored proc or a batch? 15 | public static SqlMapper.GridReader QueryMultiple(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 16 | { 17 | return InternalGetConnection.GetConnection(transaction).QueryMultiple(sql, param, transaction, commandTimeout, commandType); 18 | } 19 | 20 | /// 21 | /// Execute a command that returns multiple result sets, and access each in turn. 22 | /// 23 | /// The transaction to query on. 24 | /// The command to execute for this query. 25 | public static SqlMapper.GridReader QueryMultiple(this IDbTransaction transaction, CommandDefinition command) 26 | { 27 | return InternalGetConnection.GetConnection(transaction).QueryMultiple(command); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryMultipleAsync.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using System.Threading.Tasks; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | /// 9 | /// Execute a command that returns multiple result sets, and access each in turn. 10 | /// 11 | /// The transaction to query on. 12 | /// The SQL to execute for this query. 13 | /// The parameters to use for this query. 14 | /// Number of seconds before command execution timeout. 15 | /// Is it a stored proc or a batch? 16 | public static Task QueryMultipleAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 17 | { 18 | return InternalGetConnection.GetConnection(transaction).QueryMultipleAsync(sql, param, transaction, commandTimeout, commandType); 19 | } 20 | 21 | /// 22 | /// Execute a command that returns multiple result sets, and access each in turn. 23 | /// 24 | /// The transaction to query on. 25 | /// The command to execute for this query. 26 | public static Task QueryMultipleAsync(this IDbTransaction transaction, CommandDefinition command) 27 | { 28 | return InternalGetConnection.GetConnection(transaction).QueryMultipleAsync(command); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QuerySingle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | 9 | /// 10 | /// Return a dynamic object with properties matching the columns. 11 | /// 12 | /// The transaction to query on. 13 | /// The SQL to execute for the query. 14 | /// The parameters to pass, if any. 15 | /// The command timeout (in seconds). 16 | /// The type of command to execute. 17 | /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> 18 | public static dynamic QuerySingle(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 19 | { 20 | return InternalGetConnection.GetConnection(transaction).QuerySingle(sql, param, transaction, commandTimeout, commandType); 21 | } 22 | 23 | /// 24 | /// Executes a single-row query, returning the data typed as . 25 | /// 26 | /// The transaction to query on. 27 | /// The type to return. 28 | /// The SQL to execute for the query. 29 | /// The parameters to pass, if any. 30 | /// The command timeout (in seconds). 31 | /// The type of command to execute. 32 | /// is null. 33 | /// 34 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 35 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 36 | /// 37 | public static object QuerySingle(this IDbTransaction transaction, Type type, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 38 | { 39 | return InternalGetConnection.GetConnection(transaction).QuerySingle(type, sql, param, transaction, commandTimeout, commandType); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QuerySingleAsync.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using System.Threading.Tasks; 4 | 5 | namespace Dapper.Transaction 6 | { 7 | public static partial class DbTransactionExtensions 8 | { 9 | /// 10 | /// Execute a single-row query asynchronously using Task. 11 | /// 12 | /// The transaction to query on. 13 | /// The command used to query on this connection. 14 | /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> 15 | public static Task QuerySingleAsync(this IDbTransaction transaction, CommandDefinition command) 16 | { 17 | return InternalGetConnection.GetConnection(transaction).QuerySingleAsync(command); 18 | } 19 | 20 | /// 21 | /// Execute a single-row query asynchronously using Task. 22 | /// 23 | /// The transaction to query on. 24 | /// The type to return. 25 | /// The command used to query on this connection. 26 | public static Task QuerySingleAsync(this IDbTransaction transaction, Type type, CommandDefinition command) 27 | { 28 | return InternalGetConnection.GetConnection(transaction).QuerySingleAsync(type, command); 29 | } 30 | 31 | /// 32 | /// Execute a single-row query asynchronously using Task. 33 | /// 34 | /// The transaction to query on. 35 | /// The SQL to execute for the query. 36 | /// The parameters to pass, if any. 37 | /// The command timeout (in seconds). 38 | /// The type of command to execute. 39 | public static Task QuerySingleAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 40 | { 41 | return InternalGetConnection.GetConnection(transaction).QuerySingleAsync(sql, param, transaction, commandTimeout, commandType); 42 | } 43 | 44 | /// 45 | /// Execute a single-row query asynchronously using Task. 46 | /// 47 | /// The transaction to query on. 48 | /// The type to return. 49 | /// The SQL to execute for the query. 50 | /// The parameters to pass, if any. 51 | /// The command timeout (in seconds). 52 | /// The type of command to execute. 53 | /// is null. 54 | public static Task QuerySingleAsync(this IDbTransaction transaction, Type type, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 55 | { 56 | return InternalGetConnection.GetConnection(transaction).QuerySingleAsync(type, sql, param, transaction, commandTimeout, commandType); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QuerySingleAsync`.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using System.Threading.Tasks; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | /// 9 | /// Executes a single-row query, returning the data typed as . 10 | /// 11 | /// The type of result to return. 12 | /// The transaction to query on. 13 | /// The SQL to execute for the query. 14 | /// The parameters to pass, if any. 15 | /// The command timeout (in seconds). 16 | /// The type of command to execute. 17 | /// 18 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 19 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 20 | /// 21 | public static Task QuerySingleAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 22 | { 23 | return InternalGetConnection.GetConnection(transaction).QuerySingleAsync(sql, param, transaction, commandTimeout, commandType); 24 | } 25 | 26 | /// 27 | /// Executes a query, returning the data typed as . 28 | /// 29 | /// The type of results to return. 30 | /// The transaction to query on. 31 | /// The command used to query on this connection. 32 | /// 33 | /// A single instance or null of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 34 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 35 | /// 36 | public static Task QuerySingleAsync(this IDbTransaction transaction, CommandDefinition command) 37 | { 38 | return InternalGetConnection.GetConnection(transaction).QuerySingleAsync(command); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QuerySingleOrDefault.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | /// 9 | /// Return a dynamic object with properties matching the columns. 10 | /// 11 | /// The transaction to query on. 12 | /// The SQL to execute for the query. 13 | /// The parameters to pass, if any. 14 | /// The command timeout (in seconds). 15 | /// The type of command to execute. 16 | /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> 17 | public static dynamic QuerySingleOrDefault(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 18 | { 19 | return InternalGetConnection.GetConnection(transaction).QuerySingleOrDefault(sql, param, transaction, commandTimeout, commandType); 20 | } 21 | 22 | /// 23 | /// Executes a single-row query, returning the data typed as . 24 | /// 25 | /// The transaction to query on. 26 | /// The type to return. 27 | /// The SQL to execute for the query. 28 | /// The parameters to pass, if any. 29 | /// The command timeout (in seconds). 30 | /// The type of command to execute. 31 | /// is null. 32 | /// 33 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 34 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 35 | /// 36 | public static object QuerySingleOrDefault(this IDbTransaction transaction, Type type, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 37 | { 38 | return InternalGetConnection.GetConnection(transaction).QuerySingleOrDefault(type, sql, param, transaction, commandTimeout, commandType); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QuerySingleOrDefaultAsync.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using System.Threading.Tasks; 4 | 5 | namespace Dapper.Transaction 6 | { 7 | public static partial class DbTransactionExtensions 8 | { 9 | /// 10 | /// Execute a single-row query asynchronously using Task. 11 | /// 12 | /// The transaction to query on. 13 | /// The command used to query on this connection. 14 | /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> 15 | public static Task QuerySingleOrDefaultAsync(this IDbTransaction transaction, CommandDefinition command) 16 | { 17 | return InternalGetConnection.GetConnection(transaction).QuerySingleOrDefaultAsync(command); 18 | } 19 | 20 | /// 21 | /// Execute a single-row query asynchronously using Task. 22 | /// 23 | /// The transaction to query on. 24 | /// The type to return. 25 | /// The command used to query on this connection. 26 | public static Task QuerySingleOrDefaultAsync(this IDbTransaction transaction, Type type, CommandDefinition command) 27 | { 28 | return InternalGetConnection.GetConnection(transaction).QuerySingleOrDefaultAsync(type, command); 29 | } 30 | 31 | /// 32 | /// Execute a single-row query asynchronously using Task. 33 | /// 34 | /// The transaction to query on. 35 | /// The SQL to execute for the query. 36 | /// The parameters to pass, if any. 37 | /// The command timeout (in seconds). 38 | /// The type of command to execute. 39 | public static Task QuerySingleOrDefaultAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 40 | { 41 | return InternalGetConnection.GetConnection(transaction).QuerySingleOrDefaultAsync(sql, param, transaction, commandTimeout, commandType); 42 | } 43 | 44 | /// 45 | /// Execute a single-row query asynchronously using Task. 46 | /// 47 | /// The connection to query on. 48 | /// The type to return. 49 | /// The SQL to execute for the query. 50 | /// The parameters to pass, if any. 51 | /// The command timeout (in seconds). 52 | /// The type of command to execute. 53 | /// is null. 54 | public static Task QuerySingleOrDefaultAsync(this IDbTransaction transaction, Type type, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 55 | { 56 | return InternalGetConnection.GetConnection(transaction).QuerySingleOrDefaultAsync(type, sql, param, transaction, commandTimeout, commandType); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QuerySingleOrDefaultAsync`.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using System.Threading.Tasks; 3 | 4 | namespace Dapper.Transaction 5 | { 6 | public static partial class DbTransactionExtensions 7 | { 8 | /// 9 | /// Executes a single-row query, returning the data typed as . 10 | /// 11 | /// The type of result to return. 12 | /// The transaction to query on. 13 | /// The SQL to execute for the query. 14 | /// The parameters to pass, if any. 15 | /// The command timeout (in seconds). 16 | /// The type of command to execute. 17 | /// 18 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 19 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 20 | /// 21 | public static Task QuerySingleOrDefaultAsync(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 22 | { 23 | return InternalGetConnection.GetConnection(transaction).QuerySingleOrDefaultAsync(sql, param, transaction, commandTimeout, commandType); 24 | } 25 | 26 | /// 27 | /// Executes a query, returning the data typed as . 28 | /// 29 | /// The type of results to return. 30 | /// The transaction to query on. 31 | /// The command used to query on this connection. 32 | /// 33 | /// A single or null instance of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 34 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 35 | /// 36 | public static Task QuerySingleOrDefaultAsync(this IDbTransaction transaction, CommandDefinition command) 37 | { 38 | return InternalGetConnection.GetConnection(transaction).QuerySingleOrDefaultAsync(command); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QuerySingleOrDefault`.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace Dapper.Transaction 4 | { 5 | public static partial class DbTransactionExtensions 6 | { 7 | /// 8 | /// Executes a single-row query, returning the data typed as . 9 | /// 10 | /// The type of result to return. 11 | /// The transaction to query on. 12 | /// The SQL to execute for the query. 13 | /// The parameters to pass, if any. 14 | /// The command timeout (in seconds). 15 | /// The type of command to execute. 16 | /// 17 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 18 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 19 | /// 20 | public static T QuerySingleOrDefault(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 21 | { 22 | return InternalGetConnection.GetConnection(transaction).QuerySingleOrDefault(sql, param, transaction, commandTimeout, commandType); 23 | } 24 | 25 | /// 26 | /// Executes a query, returning the data typed as . 27 | /// 28 | /// The type of results to return. 29 | /// The transaction to query on. 30 | /// The command used to query on this connection. 31 | /// 32 | /// A single or null instance of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 33 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 34 | /// 35 | public static T QuerySingleOrDefault(this IDbTransaction transaction, CommandDefinition command) 36 | { 37 | return InternalGetConnection.GetConnection(transaction).QuerySingleOrDefault(command); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QuerySingle`.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace Dapper.Transaction 4 | { 5 | public static partial class DbTransactionExtensions 6 | { 7 | /// 8 | /// Executes a single-row query, returning the data typed as . 9 | /// 10 | /// The type of result to return. 11 | /// The transaction to query on. 12 | /// The SQL to execute for the query. 13 | /// The parameters to pass, if any. 14 | /// The command timeout (in seconds). 15 | /// The type of command to execute. 16 | /// 17 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 18 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 19 | /// 20 | public static T QuerySingle(this IDbTransaction transaction, string sql, object param = null, int? commandTimeout = null, CommandType? commandType = null) 21 | { 22 | return InternalGetConnection.GetConnection(transaction).QuerySingle(sql, param, transaction, commandTimeout, commandType); 23 | } 24 | 25 | /// 26 | /// Executes a query, returning the data typed as . 27 | /// 28 | /// The type of results to return. 29 | /// The transaction to query on. 30 | /// The command used to query on this connection. 31 | /// 32 | /// A single instance of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 33 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 34 | /// 35 | public static T QuerySingle(this IDbTransaction transaction, CommandDefinition command) 36 | { 37 | return InternalGetConnection.GetConnection(transaction).QuerySingle(command); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryUnbufferedAsync.cs: -------------------------------------------------------------------------------- 1 | #if NET5_0_OR_GREATER 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Data; 5 | using System.Data.Common; 6 | 7 | namespace Dapper.Transaction 8 | { 9 | public static partial class DbTransactionExtensions 10 | { 11 | /// 12 | /// Execute a query asynchronously using . 13 | /// 14 | /// The transaction to query on. 15 | /// The SQL to execute for the query. 16 | /// The parameters to pass, if any. 17 | /// The transaction to use, if any. 18 | /// The command timeout (in seconds). 19 | /// The type of command to execute. 20 | /// 21 | /// A sequence of data of dynamic data 22 | /// 23 | public static IAsyncEnumerable QueryUnbufferedAsync(this DbTransaction @this, string sql, object? param = null, DbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) 24 | { 25 | return InternalGetConnection.GetConnection(@this).QueryUnbufferedAsync(sql, param, transaction, commandTimeout, commandType); 26 | } 27 | } 28 | } 29 | #endif -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/QueryUnbufferedAsync`.cs: -------------------------------------------------------------------------------- 1 | #if NET5_0_OR_GREATER 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Data; 5 | using System.Data.Common; 6 | 7 | namespace Dapper.Transaction 8 | { 9 | public static partial class DbTransactionExtensions 10 | { 11 | /// 12 | /// Execute a query asynchronously using . 13 | /// 14 | /// The type of results to return. 15 | /// The connection to query on. 16 | /// The SQL to execute for the query. 17 | /// The parameters to pass, if any. 18 | /// The transaction to use, if any. 19 | /// The command timeout (in seconds). 20 | /// The type of command to execute. 21 | /// 22 | /// A sequence of data of ; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is 23 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 24 | /// 25 | public static IAsyncEnumerable QueryUnbufferedAsync(this DbTransaction @this, string sql, object? param = null, DbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) 26 | { 27 | return InternalGetConnection.GetConnection(@this).QueryUnbufferedAsync(sql, param, transaction, commandTimeout, commandType); 28 | } 29 | } 30 | } 31 | #endif -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/DbTransaction/Extensions/Query`.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | 5 | namespace Dapper.Transaction 6 | { 7 | public static partial class DbTransactionExtensions 8 | { 9 | /// 10 | /// Executes a query, returning the data typed as . 11 | /// 12 | /// The type of results to return. 13 | /// The transaction to query on. 14 | /// The SQL to execute for the query. 15 | /// The parameters to pass, if any. 16 | /// Whether to buffer results in memory. 17 | /// The command timeout (in seconds). 18 | /// The type of command to execute. 19 | /// 20 | /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 21 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 22 | /// 23 | public static IEnumerable Query(this IDbTransaction transaction, string sql, object param = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null) 24 | { 25 | return InternalGetConnection.GetConnection(transaction).Query(sql, param, transaction, buffered, commandTimeout, commandType); 26 | } 27 | 28 | /// 29 | /// Executes a query, returning the data typed as . 30 | /// 31 | /// The type of results to return. 32 | /// The transaction to query on. 33 | /// The command used to query on this connection. 34 | /// 35 | /// A sequence of data of ; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is 36 | /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). 37 | /// 38 | public static IEnumerable Query(this IDbTransaction transaction, CommandDefinition command) 39 | { 40 | return InternalGetConnection.GetConnection(transaction).Query(command); 41 | } 42 | 43 | /// 44 | /// Perform a multi-mapping query with 2 input types. 45 | /// This returns a single type, combined from the raw types via . 46 | /// 47 | /// The first type in the recordset. 48 | /// The second type in the recordset. 49 | /// The combined type to return. 50 | /// The transaction to query on. 51 | /// The SQL to execute for this query. 52 | /// The function to map row types to the return type. 53 | /// The parameters to use for this query. 54 | /// Whether to buffer the results in memory. 55 | /// The field we should split and read the second object from (default: "Id"). 56 | /// Number of seconds before command execution timeout. 57 | /// Is it a stored proc or a batch? 58 | /// An enumerable of . 59 | public static IEnumerable Query(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 60 | { 61 | return InternalGetConnection.GetConnection(transaction).Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 62 | } 63 | 64 | /// 65 | /// Perform a multi-mapping query with 3 input types. 66 | /// This returns a single type, combined from the raw types via . 67 | /// 68 | /// The first type in the recordset. 69 | /// The second type in the recordset. 70 | /// The third type in the recordset. 71 | /// The combined type to return. 72 | /// The transaction to query on. 73 | /// The SQL to execute for this query. 74 | /// The function to map row types to the return type. 75 | /// The parameters to use for this query. 76 | /// Whether to buffer the results in memory. 77 | /// The field we should split and read the second object from (default: "Id"). 78 | /// Number of seconds before command execution timeout. 79 | /// Is it a stored proc or a batch? 80 | /// An enumerable of . 81 | public static IEnumerable Query(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 82 | { 83 | return InternalGetConnection.GetConnection(transaction).Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 84 | } 85 | 86 | 87 | /// 88 | /// Perform a multi-mapping query with 4 input types. 89 | /// This returns a single type, combined from the raw types via . 90 | /// 91 | /// The first type in the recordset. 92 | /// The second type in the recordset. 93 | /// The third type in the recordset. 94 | /// The fourth type in the recordset. 95 | /// The combined type to return. 96 | /// The transaction to query on. 97 | /// The SQL to execute for this query. 98 | /// The function to map row types to the return type. 99 | /// The parameters to use for this query. 100 | /// Whether to buffer the results in memory. 101 | /// The field we should split and read the second object from (default: "Id"). 102 | /// Number of seconds before command execution timeout. 103 | /// Is it a stored proc or a batch? 104 | /// An enumerable of . 105 | public static IEnumerable Query(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 106 | { 107 | return InternalGetConnection.GetConnection(transaction).Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 108 | } 109 | 110 | /// 111 | /// Perform a multi-mapping query with 5 input types. 112 | /// This returns a single type, combined from the raw types via . 113 | /// 114 | /// The first type in the recordset. 115 | /// The second type in the recordset. 116 | /// The third type in the recordset. 117 | /// The fourth type in the recordset. 118 | /// The fifth type in the recordset. 119 | /// The combined type to return. 120 | /// The transaction to query on. 121 | /// The SQL to execute for this query. 122 | /// The function to map row types to the return type. 123 | /// The parameters to use for this query. 124 | /// Whether to buffer the results in memory. 125 | /// The field we should split and read the second object from (default: "Id"). 126 | /// Number of seconds before command execution timeout. 127 | /// Is it a stored proc or a batch? 128 | /// An enumerable of . 129 | public static IEnumerable Query(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 130 | { 131 | return InternalGetConnection.GetConnection(transaction).Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 132 | } 133 | 134 | /// 135 | /// Perform a multi-mapping query with 6 input types. 136 | /// This returns a single type, combined from the raw types via . 137 | /// 138 | /// The first type in the recordset. 139 | /// The second type in the recordset. 140 | /// The third type in the recordset. 141 | /// The fourth type in the recordset. 142 | /// The fifth type in the recordset. 143 | /// The sixth type in the recordset. 144 | /// The combined type to return. 145 | /// The transaction to query on. 146 | /// The SQL to execute for this query. 147 | /// The function to map row types to the return type. 148 | /// The parameters to use for this query. 149 | /// Whether to buffer the results in memory. 150 | /// The field we should split and read the second object from (default: "Id"). 151 | /// Number of seconds before command execution timeout. 152 | /// Is it a stored proc or a batch? 153 | /// An enumerable of . 154 | public static IEnumerable Query(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 155 | { 156 | return InternalGetConnection.GetConnection(transaction).Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 157 | } 158 | 159 | /// 160 | /// Perform a multi-mapping query with 7 input types. If you need more types -> use Query with Type[] parameter. 161 | /// This returns a single type, combined from the raw types via . 162 | /// 163 | /// The first type in the recordset. 164 | /// The second type in the recordset. 165 | /// The third type in the recordset. 166 | /// The fourth type in the recordset. 167 | /// The fifth type in the recordset. 168 | /// The sixth type in the recordset. 169 | /// The seventh type in the recordset. 170 | /// The combined type to return. 171 | /// The transaction to query on. 172 | /// The SQL to execute for this query. 173 | /// The function to map row types to the return type. 174 | /// The parameters to use for this query. 175 | /// Whether to buffer the results in memory. 176 | /// The field we should split and read the second object from (default: "Id"). 177 | /// Number of seconds before command execution timeout. 178 | /// Is it a stored proc or a batch? 179 | /// An enumerable of . 180 | public static IEnumerable Query(this IDbTransaction transaction, string sql, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 181 | { 182 | return InternalGetConnection.GetConnection(transaction).Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 183 | } 184 | 185 | /// 186 | /// Perform a multi-mapping query with an arbitrary number of input types. 187 | /// This returns a single type, combined from the raw types via . 188 | /// 189 | /// The combined type to return. 190 | /// The transaction to query on. 191 | /// The SQL to execute for this query. 192 | /// Array of types in the recordset. 193 | /// The function to map row types to the return type. 194 | /// The parameters to use for this query. 195 | /// Whether to buffer the results in memory. 196 | /// The field we should split and read the second object from (default: "Id"). 197 | /// Number of seconds before command execution timeout. 198 | /// Is it a stored proc or a batch? 199 | /// An enumerable of . 200 | public static IEnumerable Query(this IDbTransaction transaction, string sql, Type[] types, Func map, object param = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) 201 | { 202 | return InternalGetConnection.GetConnection(transaction).Query(sql, types, map, param, transaction, buffered, splitOn, commandTimeout, commandType); 203 | } 204 | 205 | } 206 | } -------------------------------------------------------------------------------- /Dapper.Transaction.Shared/Helper/GetConnection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using System.Data.Common; 4 | 5 | namespace Dapper.Transaction 6 | { 7 | internal class InternalGetConnection 8 | { 9 | public static IDbConnection GetConnection(IDbTransaction transaction) 10 | { 11 | if (transaction.Connection == null) 12 | { 13 | throw new Exception("Oops! No connection has been found for the transaction."); 14 | } 15 | 16 | return transaction.Connection; 17 | } 18 | 19 | public static DbConnection GetConnection(DbTransaction transaction) 20 | { 21 | if (transaction.Connection == null) 22 | { 23 | throw new Exception("Oops! No connection has been found for the transaction."); 24 | } 25 | 26 | return transaction.Connection; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Dapper.Transaction.StrongName.Net461/Dapper.Transaction.StrongName.Net461.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B8C3B69D-F0D3-49D4-B121-F8765B7F2D23} 8 | Library 9 | Properties 10 | Dapper.Transaction 11 | Dapper.Transaction.StrongName 12 | v4.6.1 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | bin\Release\Dapper.Transaction.StrongName.xml 33 | 34 | 35 | true 36 | 37 | 38 | ..\Key.snk 39 | 40 | 41 | 42 | ..\packages\Dapper.StrongName.2.1.35\lib\net461\Dapper.StrongName.dll 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Dapper.Transaction.StrongName.Net461/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("Dapper.Transaction")] 5 | [assembly: AssemblyDescription("IDbTransaction extension methods for Dapper: A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite, SqlCE, Firebird etc..")] 6 | [assembly: AssemblyConfiguration("")] 7 | [assembly: AssemblyCompany("ZZZ Projects Inc.")] 8 | [assembly: AssemblyProduct("Dapper.Transaction")] 9 | [assembly: AssemblyCopyright("ZZZ Projects Inc.")] 10 | [assembly: AssemblyTrademark("")] 11 | [assembly: AssemblyCulture("")] 12 | [assembly: ComVisible(false)] 13 | [assembly: Guid("b95951e5-7167-4b34-9cf0-d33ac6178333")] 14 | 15 | [assembly: AssemblyVersion("2.1.35.0")] 16 | [assembly: AssemblyFileVersion("2.1.35.0")] -------------------------------------------------------------------------------- /Dapper.Transaction.StrongName.Net461/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Dapper.Transaction.StrongName.Net5/Dapper.Transaction.StrongName.Net5.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net5.0 5 | true 6 | ..\Key.snk 7 | Dapper.Transaction.StrongName 8 | Dapper.Transaction 9 | 2.1.35 10 | ZZZ Projects Inc. 11 | ZZZ Projects Inc. 12 | ZZZ Projects Inc. 13 | 14 | 15 | 16 | bin\Release\ 17 | bin\Release\Dapper.Transaction.StrongName.xml 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Dapper.Transaction.StrongName.Net7/Dapper.Transaction.StrongName.Net7.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0 5 | true 6 | ..\Key.snk 7 | Dapper.Transaction.StrongName 8 | Dapper.Transaction 9 | 2.1.35 10 | ZZZ Projects Inc. 11 | ZZZ Projects Inc. 12 | ZZZ Projects Inc. 13 | 14 | 15 | 16 | bin\Release\ 17 | bin\Release\Dapper.Transaction.StrongName.xml 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Dapper.Transaction.StrongName.NetStandard20/Dapper.Transaction.StrongName.NetStandard20.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | true 6 | ..\Key.snk 7 | 2.1.35 8 | Dapper.Transaction 9 | ZZZ Projects Inc. 10 | ZZZ Projects Inc. 11 | Dapper.Transaction.StrongName 12 | Dapper.Transaction 13 | IDbTransaction extension methods for Dapper: A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite, SqlCE, Firebird etc.. 14 | ZZZ Projects Inc. 15 | 16 | 17 | 18 | \bin\Release\netstandard2.0\Dapper.Transaction.StrongName.xml 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Dapper.Transaction.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29728.190 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.Transaction.NetStandard20", "Dapper.Transaction.NetStandard20\Dapper.Transaction.NetStandard20.csproj", "{CD7F87A2-BCF6-48C9-96AF-86F32F7AF318}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapper.Transaction.Net461", "Dapper.Transaction.Net461\Dapper.Transaction.Net461.csproj", "{B95951E5-7167-4B34-9CF0-D33AC6178333}" 9 | EndProject 10 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Dapper.Transaction.Shared", "Dapper.Transaction.Shared\Dapper.Transaction.Shared.shproj", "{F448FAEA-4A1D-4432-8343-99C346856DAB}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab", "Lab\Lab.csproj", "{31A63124-67D2-4427-8CF9-73FC1521F638}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapper.Transaction.StrongName.Net461", "Dapper.Transaction.StrongName.Net461\Dapper.Transaction.StrongName.Net461.csproj", "{B8C3B69D-F0D3-49D4-B121-F8765B7F2D23}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.Transaction.StrongName.NetStandard20", "Dapper.Transaction.StrongName.NetStandard20\Dapper.Transaction.StrongName.NetStandard20.csproj", "{D839949B-3985-4CAE-86D0-955471DC994D}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab.StrongName", "Lab.StrongName\Lab.StrongName.csproj", "{094C1B26-A616-4201-9858-B4A0DCBDE883}" 19 | EndProject 20 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.Transaction.Net5", "Dapper.Transaction.Net5\Dapper.Transaction.Net5.csproj", "{4D305E84-73B4-4548-94FA-0BA73511C777}" 21 | EndProject 22 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.Transaction.StrongName.Net5", "Dapper.Transaction.StrongName.Net5\Dapper.Transaction.StrongName.Net5.csproj", "{3D45C667-F5B5-4B53-B23D-EEED70889FBE}" 23 | EndProject 24 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.Transaction.Net7", "Dapper.Transaction.Net7\Dapper.Transaction.Net7.csproj", "{D3DA6451-306D-45F0-BDA2-E8678B5118C5}" 25 | EndProject 26 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.Transaction.StrongName.Net7", "Dapper.Transaction.StrongName.Net7\Dapper.Transaction.StrongName.Net7.csproj", "{F470239E-A298-4EEB-8820-43C5573C65F6}" 27 | EndProject 28 | Global 29 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 30 | Dapper.Transaction.Shared\Dapper.Transaction.Shared.projitems*{3d45c667-f5b5-4b53-b23d-eeed70889fbe}*SharedItemsImports = 5 31 | Dapper.Transaction.Shared\Dapper.Transaction.Shared.projitems*{4d305e84-73b4-4548-94fa-0ba73511c777}*SharedItemsImports = 5 32 | Dapper.Transaction.Shared\Dapper.Transaction.Shared.projitems*{b8c3b69d-f0d3-49d4-b121-f8765b7f2d23}*SharedItemsImports = 4 33 | Dapper.Transaction.Shared\Dapper.Transaction.Shared.projitems*{b95951e5-7167-4b34-9cf0-d33ac6178333}*SharedItemsImports = 4 34 | Dapper.Transaction.Shared\Dapper.Transaction.Shared.projitems*{cd7f87a2-bcf6-48c9-96af-86f32f7af318}*SharedItemsImports = 5 35 | Dapper.Transaction.Shared\Dapper.Transaction.Shared.projitems*{d3da6451-306d-45f0-bda2-e8678b5118c5}*SharedItemsImports = 5 36 | Dapper.Transaction.Shared\Dapper.Transaction.Shared.projitems*{d839949b-3985-4cae-86d0-955471dc994d}*SharedItemsImports = 5 37 | Dapper.Transaction.Shared\Dapper.Transaction.Shared.projitems*{f448faea-4a1d-4432-8343-99c346856dab}*SharedItemsImports = 13 38 | Dapper.Transaction.Shared\Dapper.Transaction.Shared.projitems*{f470239e-a298-4eeb-8820-43c5573c65f6}*SharedItemsImports = 5 39 | EndGlobalSection 40 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 41 | Debug|Any CPU = Debug|Any CPU 42 | Release|Any CPU = Release|Any CPU 43 | EndGlobalSection 44 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 45 | {CD7F87A2-BCF6-48C9-96AF-86F32F7AF318}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 46 | {CD7F87A2-BCF6-48C9-96AF-86F32F7AF318}.Debug|Any CPU.Build.0 = Debug|Any CPU 47 | {CD7F87A2-BCF6-48C9-96AF-86F32F7AF318}.Release|Any CPU.ActiveCfg = Release|Any CPU 48 | {CD7F87A2-BCF6-48C9-96AF-86F32F7AF318}.Release|Any CPU.Build.0 = Release|Any CPU 49 | {B95951E5-7167-4B34-9CF0-D33AC6178333}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 50 | {B95951E5-7167-4B34-9CF0-D33AC6178333}.Debug|Any CPU.Build.0 = Debug|Any CPU 51 | {B95951E5-7167-4B34-9CF0-D33AC6178333}.Release|Any CPU.ActiveCfg = Release|Any CPU 52 | {B95951E5-7167-4B34-9CF0-D33AC6178333}.Release|Any CPU.Build.0 = Release|Any CPU 53 | {31A63124-67D2-4427-8CF9-73FC1521F638}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 54 | {31A63124-67D2-4427-8CF9-73FC1521F638}.Debug|Any CPU.Build.0 = Debug|Any CPU 55 | {31A63124-67D2-4427-8CF9-73FC1521F638}.Release|Any CPU.ActiveCfg = Release|Any CPU 56 | {31A63124-67D2-4427-8CF9-73FC1521F638}.Release|Any CPU.Build.0 = Release|Any CPU 57 | {B8C3B69D-F0D3-49D4-B121-F8765B7F2D23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 58 | {B8C3B69D-F0D3-49D4-B121-F8765B7F2D23}.Debug|Any CPU.Build.0 = Debug|Any CPU 59 | {B8C3B69D-F0D3-49D4-B121-F8765B7F2D23}.Release|Any CPU.ActiveCfg = Release|Any CPU 60 | {B8C3B69D-F0D3-49D4-B121-F8765B7F2D23}.Release|Any CPU.Build.0 = Release|Any CPU 61 | {D839949B-3985-4CAE-86D0-955471DC994D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 62 | {D839949B-3985-4CAE-86D0-955471DC994D}.Debug|Any CPU.Build.0 = Debug|Any CPU 63 | {D839949B-3985-4CAE-86D0-955471DC994D}.Release|Any CPU.ActiveCfg = Release|Any CPU 64 | {D839949B-3985-4CAE-86D0-955471DC994D}.Release|Any CPU.Build.0 = Release|Any CPU 65 | {094C1B26-A616-4201-9858-B4A0DCBDE883}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 66 | {094C1B26-A616-4201-9858-B4A0DCBDE883}.Debug|Any CPU.Build.0 = Debug|Any CPU 67 | {094C1B26-A616-4201-9858-B4A0DCBDE883}.Release|Any CPU.ActiveCfg = Release|Any CPU 68 | {094C1B26-A616-4201-9858-B4A0DCBDE883}.Release|Any CPU.Build.0 = Release|Any CPU 69 | {4D305E84-73B4-4548-94FA-0BA73511C777}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 70 | {4D305E84-73B4-4548-94FA-0BA73511C777}.Debug|Any CPU.Build.0 = Debug|Any CPU 71 | {4D305E84-73B4-4548-94FA-0BA73511C777}.Release|Any CPU.ActiveCfg = Release|Any CPU 72 | {4D305E84-73B4-4548-94FA-0BA73511C777}.Release|Any CPU.Build.0 = Release|Any CPU 73 | {3D45C667-F5B5-4B53-B23D-EEED70889FBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 74 | {3D45C667-F5B5-4B53-B23D-EEED70889FBE}.Debug|Any CPU.Build.0 = Debug|Any CPU 75 | {3D45C667-F5B5-4B53-B23D-EEED70889FBE}.Release|Any CPU.ActiveCfg = Release|Any CPU 76 | {3D45C667-F5B5-4B53-B23D-EEED70889FBE}.Release|Any CPU.Build.0 = Release|Any CPU 77 | {D3DA6451-306D-45F0-BDA2-E8678B5118C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 78 | {D3DA6451-306D-45F0-BDA2-E8678B5118C5}.Debug|Any CPU.Build.0 = Debug|Any CPU 79 | {D3DA6451-306D-45F0-BDA2-E8678B5118C5}.Release|Any CPU.ActiveCfg = Release|Any CPU 80 | {D3DA6451-306D-45F0-BDA2-E8678B5118C5}.Release|Any CPU.Build.0 = Release|Any CPU 81 | {F470239E-A298-4EEB-8820-43C5573C65F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 82 | {F470239E-A298-4EEB-8820-43C5573C65F6}.Debug|Any CPU.Build.0 = Debug|Any CPU 83 | {F470239E-A298-4EEB-8820-43C5573C65F6}.Release|Any CPU.ActiveCfg = Release|Any CPU 84 | {F470239E-A298-4EEB-8820-43C5573C65F6}.Release|Any CPU.Build.0 = Release|Any CPU 85 | EndGlobalSection 86 | GlobalSection(SolutionProperties) = preSolution 87 | HideSolutionNode = FALSE 88 | EndGlobalSection 89 | GlobalSection(ExtensibilityGlobals) = postSolution 90 | SolutionGuid = {402C2F40-86A2-4001-A977-81B6E001A528} 91 | EndGlobalSection 92 | EndGlobal 93 | -------------------------------------------------------------------------------- /Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzzprojects/Dapper.Transaction/dae33ec93828180993aa484c32b56ea9d2c1ac5e/Key.snk -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Permission is hereby granted, free of charge, to any person obtaining a copy 3 | of this software and associated documentation files (the "Software"), to deal 4 | in the Software without restriction, including without limitation the rights 5 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6 | copies of the Software, and to permit persons to whom the Software is 7 | furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all 10 | copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | SOFTWARE. 19 | -------------------------------------------------------------------------------- /Lab.StrongName/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Lab.StrongName/Lab.StrongName.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {094C1B26-A616-4201-9858-B4A0DCBDE883} 8 | Exe 9 | Lab.StrongName 10 | Lab.StrongName 11 | v4.8 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\packages\Dapper.StrongName.2.0.35\lib\net461\Dapper.StrongName.dll 38 | 39 | 40 | ..\packages\Dapper.Transaction.StrongName.2.0.35.2\lib\net461\Dapper.Transaction.StrongName.dll 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Lab.StrongName/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.SqlClient; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Dapper; 8 | using Dapper.Transaction; 9 | 10 | namespace Lab.StrongName 11 | { 12 | class Program 13 | { 14 | static void Main(string[] args) 15 | { 16 | using (var connection = new SqlConnection("Server=localhost;Initial Catalog=Z.Dapper.Plus.Lab;Integrated Security=True;")) 17 | { 18 | var x1 = connection.ExecuteScalar("SELECT 1"); 19 | } 20 | 21 | using (var connection = new SqlConnection("Server=localhost;Initial Catalog=Z.Dapper.Plus.Lab;Integrated Security=True;")) 22 | { 23 | connection.Open(); 24 | var trans = connection.BeginTransaction(); 25 | var x1 = trans.ExecuteScalar("SELECT 1"); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Lab.StrongName/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Lab.StrongName")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Lab.StrongName")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("094c1b26-a616-4201-9858-b4a0dcbde883")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Lab.StrongName/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Lab/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Lab/Lab.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {31A63124-67D2-4427-8CF9-73FC1521F638} 8 | Exe 9 | Lab 10 | Lab 11 | v4.8 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\packages\Dapper.2.0.35\lib\net461\Dapper.dll 38 | 39 | 40 | ..\packages\Dapper.Transaction.2.0.35.2\lib\net461\Dapper.Transaction.dll 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Lab/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.SqlClient; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Dapper; 8 | using Dapper.Transaction; 9 | 10 | namespace Lab 11 | { 12 | class Program 13 | { 14 | static void Main(string[] args) 15 | { 16 | using (var connection = new SqlConnection("Server=localhost;Initial Catalog=Z.Dapper.Plus.Lab;Integrated Security=True;")) 17 | { 18 | var x1 = connection.ExecuteScalar("SELECT 1"); 19 | } 20 | 21 | using (var connection = new SqlConnection("Server=localhost;Initial Catalog=Z.Dapper.Plus.Lab;Integrated Security=True;")) 22 | { 23 | connection.Open(); 24 | var trans = connection.BeginTransaction(); 25 | var x1 = trans.ExecuteScalar("SELECT 1"); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Lab/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Lab")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Lab")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("31a63124-67d2-4427-8cf9-73fc1521f638")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Lab/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## What's Dapper Transaction? 2 | Dapper Transaction is exactly like Dapper but extend the IDbTransaction interface instead and use Dapper under the hood. 3 | 4 | It's a simple library to make it easier to work with a transaction. 5 | 6 | Everything Dapper support, Dapper Transaction support it as well. 7 | 8 | ```csharp 9 | using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools())) 10 | { 11 | connection.Open(); 12 | 13 | using (var transaction = connection.BeginTransaction()) 14 | { 15 | // Dapper 16 | var affectedRows1 = connection.Execute(sql, new {CustomerName = "Mark"}, transaction: transaction); 17 | 18 | // Dapper Transaction 19 | var affectedRows2 = transaction.Execute(sql, new {CustomerName = "Mark"}); 20 | 21 | transaction.Commit(); 22 | } 23 | } 24 | ``` 25 | 26 | Read more on our [Website](https://dappertutorial.net/dapper-transaction). 27 | 28 | ## Downloads 29 | 30 | ### Dapper.Transaction 31 | 32 | [![nuget](https://img.shields.io/nuget/v/Dapper.Transaction?logo=nuget&style=flat-square)](https://www.nuget.org/packages/Dapper.Transaction) 33 | [![nuget](https://img.shields.io/nuget/dt/Dapper.Transaction?logo=nuget&style=flat-square)](https://www.nuget.org/packages/Dapper.Transaction) 34 | 35 | ``` 36 | PM> NuGet\Install-Package Dapper.Transaction 37 | ``` 38 | 39 | ``` 40 | > dotnet add package Dapper.Transaction 41 | ``` 42 | 43 | ### Dapper.Transaction.StrongName 44 | 45 | [![nuget](https://img.shields.io/nuget/v/Dapper.Transaction.StrongName?logo=nuget&style=flat-square)](https://www.nuget.org/packages/Dapper.Transaction.StrongName) 46 | [![nuget](https://img.shields.io/nuget/dt/Dapper.Transaction.StrongName?logo=nuget&style=flat-square)](https://www.nuget.org/packages/Dapper.Transaction.StrongName) 47 | 48 | ## Sponsors 49 | 50 | ZZZ Projects owns and maintains **Dapper.Transaction** as part of our [mission](https://zzzprojects.com/mission) to add value to the .NET community 51 | 52 | Through [Dapper Plus](https://dapper-plus.net/?utm_source=zzzprojects&utm_medium=dappertransaction) and [Entity Framework Extensions](https://entityframework-extensions.net/?utm_source=zzzprojects&utm_medium=dappertransaction), we actively sponsor and help key open-source libraries grow. 53 | 54 | [![Dapper Plus](https://raw.githubusercontent.com/zzzprojects/Dapper.Transaction/master/dapper-plus-sponsor.png)](https://dapper-plus.net/bulk-insert?utm_source=zzzprojects&utm_medium=dappertransaction) 55 | 56 | [![Entity Framework Extensions](https://raw.githubusercontent.com/zzzprojects/Dapper.Transaction/master/entity-framework-extensions-sponsor.png)](https://entityframework-extensions.net/bulk-insert?utm_source=zzzprojects&utm_medium=dappertransaction) 57 | 58 | ## More Projects 59 | 60 | - Projects: 61 | - [EntityFramework Extensions](https://entityframework-extensions.net/) 62 | - [Dapper Plus](https://dapper-plus.net/) 63 | - [C# Eval Expression](https://eval-expression.net/) 64 | - Learn Websites 65 | - [Learn EF Core](https://www.learnentityframeworkcore.com/) 66 | - [Learn Dapper](https://www.learndapper.com/) 67 | - Online Tools: 68 | - [.NET Fiddle](https://dotnetfiddle.net/) 69 | - [SQL Fiddle](https://sqlfiddle.com/) 70 | - [ZZZ Code AI](https://zzzcode.ai/) 71 | - and much more! 72 | 73 | To view all our free and paid projects, visit our website [ZZZ Projects](https://zzzprojects.com/). 74 | -------------------------------------------------------------------------------- /dapper-plus-sponsor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzzprojects/Dapper.Transaction/dae33ec93828180993aa484c32b56ea9d2c1ac5e/dapper-plus-sponsor.png -------------------------------------------------------------------------------- /entity-framework-extensions-sponsor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzzprojects/Dapper.Transaction/dae33ec93828180993aa484c32b56ea9d2c1ac5e/entity-framework-extensions-sponsor.png --------------------------------------------------------------------------------