public partial int ReturnViaReturn(global::System.Data.Common.DbConnection connection, int id, string inputOutput, global::System.DateTime output) { // locals global::System.Data.Common.DbCommand?__dapper__command = null; bool __dapper__close = false; try { // prepare connection if (connection !.State == global::System.Data.ConnectionState.Closed) { connection !.Open(); __dapper__close = true; } // prepare command (excluding parameter values) if ((__dapper__command = global::System.Threading.Interlocked.Exchange(ref s___dapper__command_Samples_Sync_Parameters_input_cs_ReturnViaReturn_9, null)) is null) { __dapper__command = __dapper__CreateCommand(connection !); } else { __dapper__command.Connection = connection; } // assign parameter values #pragma warning disable CS0618 __dapper__command.Parameters[0].Value = global::Dapper.Internal.InternalUtilities.AsValue(id); __dapper__command.Parameters[1].Value = global::Dapper.Internal.InternalUtilities.AsValue(inputOutput); __dapper__command.Parameters[2].Value = global::Dapper.Internal.InternalUtilities.AsValue(output); #pragma warning restore CS0618 // execute non-query __dapper__command.ExecuteNonQuery(); // TODO: post-process parameters } finally { // cleanup if (__dapper__command is not null) { __dapper__command.Connection = default; __dapper__command = global::System.Threading.Interlocked.Exchange(ref s___dapper__command_Samples_Sync_Parameters_input_cs_ReturnViaReturn_9, __dapper__command); __dapper__command?.Dispose(); } if (__dapper__close) { connection?.Close(); } }
public async partial global::System.Threading.Tasks.Task TaskAsync(global::System.Data.Common.DbConnection connection, int id, string name) { // locals global::System.Data.Common.DbCommand?__dapper__command = null; bool __dapper__close = false; try { // prepare connection if (connection !.State == global::System.Data.ConnectionState.Closed) { await connection !.OpenAsync(global::System.Threading.CancellationToken.None).ConfigureAwait(false); __dapper__close = true; } // prepare command (excluding parameter values) if ((__dapper__command = global::System.Threading.Interlocked.Exchange(ref s___dapper__command_Samples_Async_NonQuery_input_cs_TaskAsync_8, null)) is null) { __dapper__command = __dapper__CreateCommand(connection !); } else { __dapper__command.Connection = connection; } // assign parameter values #pragma warning disable CS0618 __dapper__command.Parameters[0].Value = global::Dapper.Internal.InternalUtilities.AsValue(id); __dapper__command.Parameters[1].Value = global::Dapper.Internal.InternalUtilities.AsValue(name); #pragma warning restore CS0618 // execute non-query await __dapper__command.ExecuteNonQueryAsync(global::System.Threading.CancellationToken.None).ConfigureAwait(false); // TODO: post-process parameters } finally { // cleanup if (__dapper__command is not null) { __dapper__command.Connection = default; __dapper__command = global::System.Threading.Interlocked.Exchange(ref s___dapper__command_Samples_Async_NonQuery_input_cs_TaskAsync_8, __dapper__command); __dapper__command?.Dispose(); } if (__dapper__close) { connection?.Close(); } }
protected override void Dispose(bool disposing) { if (disposing) { if (reader != null) { reader.Dispose(); } reader = null; if (cmd != null) { cmd.Dispose(); } cmd = null; } base.Dispose(disposing); }
public partial void Abstract(global::System.Data.Common.DbConnection connection) { // locals global::System.Data.Common.DbCommand?__dapper__command = null; bool __dapper__close = false; try { // prepare connection if (connection !.State == global::System.Data.ConnectionState.Closed) { connection !.Open(); __dapper__close = true; } // prepare command (excluding parameter values) if ((__dapper__command = global::System.Threading.Interlocked.Exchange(ref s___dapper__command_Samples_Transactions_input_cs_Abstract_9, null)) is null) { __dapper__command = __dapper__CreateCommand(connection !); } else { __dapper__command.Connection = connection; } // execute non-query __dapper__command.ExecuteNonQuery(); // TODO: post-process parameters } finally { // cleanup if (__dapper__command is not null) { __dapper__command.Connection = default; __dapper__command = global::System.Threading.Interlocked.Exchange(ref s___dapper__command_Samples_Transactions_input_cs_Abstract_9, __dapper__command); __dapper__command?.Dispose(); } if (__dapper__close) { connection?.Close(); } }
public partial global::System.Collections.Generic.IEnumerable <global::SomeType> Sequence(global::System.Data.Common.DbConnection connection, int id, string name) { // locals global::System.Data.Common.DbCommand? __dapper__command = null; global::System.Data.Common.DbDataReader?__dapper__reader = null; bool __dapper__close = false; int[]? __dapper__tokenBuffer = null; try { // prepare connection if (connection !.State == global::System.Data.ConnectionState.Closed) { connection !.Open(); __dapper__close = true; } // prepare command (excluding parameter values) if ((__dapper__command = global::System.Threading.Interlocked.Exchange(ref s___dapper__command_Samples_Sync_Sequence_input_cs_Sequence_7, null)) is null) { __dapper__command = __dapper__CreateCommand(connection !); } else { __dapper__command.Connection = connection; } // assign parameter values #pragma warning disable CS0618 __dapper__command.Parameters[0].Value = global::Dapper.Internal.InternalUtilities.AsValue(id); __dapper__command.Parameters[1].Value = global::Dapper.Internal.InternalUtilities.AsValue(name); #pragma warning restore CS0618 // execute reader const global::System.Data.CommandBehavior __dapper__behavior = global::System.Data.CommandBehavior.SequentialAccess | global::System.Data.CommandBehavior.SingleResult | global::System.Data.CommandBehavior.SingleRow; __dapper__reader = __dapper__command.ExecuteReader(__dapper__close ? (__dapper__behavior | global::System.Data.CommandBehavior.CloseConnection) : __dapper__behavior); __dapper__close = false; // performed via CommandBehavior // process multiple rows if (__dapper__reader.HasRows) { var __dapper__parser = global::Dapper.TypeReader.TryGetReader <global::SomeType>() !; global::System.Span <int> __dapper__tokens = __dapper__reader.FieldCount <= global::Dapper.TypeReader.MaxStackTokens ? stackalloc int[__dapper__reader.FieldCount] : global::Dapper.TypeReader.RentSpan(ref __dapper__tokenBuffer, __dapper__reader.FieldCount); __dapper__parser.IdentifyFieldTokensFromSchema(__dapper__reader, __dapper__tokens); while (__dapper__reader.Read()) { yield return(__dapper__parser.Read(__dapper__reader, __dapper__tokens)); } } // consume additional results (ensures errors from the server are observed) while (__dapper__reader.NextResult()) { } // TODO: post-process parameters } finally { // cleanup global::Dapper.TypeReader.Return(ref __dapper__tokenBuffer); __dapper__reader?.Dispose(); if (__dapper__command is not null) { __dapper__command.Connection = default; __dapper__command = global::System.Threading.Interlocked.Exchange(ref s___dapper__command_Samples_Sync_Sequence_input_cs_Sequence_7, __dapper__command); __dapper__command?.Dispose(); } if (__dapper__close) { connection?.Close(); } }
static async global::System.Collections.Generic.IAsyncEnumerable <global::SomeType> __dapper__SequenceAsync(global::System.Data.Common.DbConnection connection, int id, string name, [global::System.Runtime.CompilerServices.EnumeratorCancellationAttribute] global::System.Threading.CancellationToken __dapper__cancellation) { // locals global::System.Data.Common.DbCommand? __dapper__command = null; global::System.Data.Common.DbDataReader?__dapper__reader = null; bool __dapper__close = false; int[]? __dapper__tokenBuffer = null; try { // prepare connection if (connection !.State == global::System.Data.ConnectionState.Closed) { await connection !.OpenAsync(__dapper__cancellation).ConfigureAwait(false); __dapper__close = true; } // prepare command (excluding parameter values) if ((__dapper__command = global::System.Threading.Interlocked.Exchange(ref s___dapper__command_Samples_Async_Sequence_input_cs_SequenceAsync_8, null)) is null) { __dapper__command = __dapper__CreateCommand(connection !); } else { __dapper__command.Connection = connection; } // assign parameter values #pragma warning disable CS0618 __dapper__command.Parameters[0].Value = global::Dapper.Internal.InternalUtilities.AsValue(id); __dapper__command.Parameters[1].Value = global::Dapper.Internal.InternalUtilities.AsValue(name); #pragma warning restore CS0618 // execute reader const global::System.Data.CommandBehavior __dapper__behavior = global::System.Data.CommandBehavior.SequentialAccess | global::System.Data.CommandBehavior.SingleResult | global::System.Data.CommandBehavior.SingleRow; __dapper__reader = await __dapper__command.ExecuteReaderAsync(__dapper__close?(__dapper__behavior | global::System.Data.CommandBehavior.CloseConnection) : __dapper__behavior, __dapper__cancellation).ConfigureAwait(false); __dapper__close = false; // performed via CommandBehavior // process multiple rows if (__dapper__reader.HasRows) { var __dapper__parser = global::Dapper.TypeReader.TryGetReader <global::SomeType>() !; var __dapper__tokens = global::Dapper.TypeReader.RentSegment(ref __dapper__tokenBuffer, __dapper__reader.FieldCount); __dapper__parser.IdentifyFieldTokensFromSchema(__dapper__reader, __dapper__tokens); while (await __dapper__reader.ReadAsync(__dapper__cancellation).ConfigureAwait(false)) { yield return(await __dapper__parser.ReadAsync(__dapper__reader, __dapper__tokens, __dapper__cancellation).ConfigureAwait(false)); } } // consume additional results (ensures errors from the server are observed) while (await __dapper__reader.NextResultAsync(__dapper__cancellation).ConfigureAwait(false)) { } // TODO: post-process parameters } finally { // cleanup global::Dapper.TypeReader.Return(ref __dapper__tokenBuffer); __dapper__reader?.Dispose(); if (__dapper__command is not null) { __dapper__command.Connection = default; __dapper__command = global::System.Threading.Interlocked.Exchange(ref s___dapper__command_Samples_Async_Sequence_input_cs_SequenceAsync_8, __dapper__command); __dapper__command?.Dispose(); } if (__dapper__close) { connection?.Close(); } } }