public static DataSet ExecuteDataSet(this IDbCommandExecutor executor, ExecuteReaderRequest request) { DataSet dataSet = null; executor.Execute(request.CreateCommandRequest, command => { dataSet = command.ExecuteDataSet(request.CancellationToken); }); return(dataSet); }
public static List <T> ExecuteReader <T>(this IDbCommandExecutor executor, ExecuteReaderRequest request, Func <IDataRecord, T> read) { List <T> rows = null; executor.ExecuteReader(request, dataReader => rows = dataReader.ReadResult(() => read(dataReader))); return(rows); }
public static DataTable ExecuteDataTable(this IDbCommandExecutor executor, ExecuteReaderRequest request) { Assert.IsNotNull(executor); DataTable dataTable = null; executor.Execute(request.CreateCommandRequest, command => { dataTable = command.ExecuteDataTable(request.CancellationToken); }); return(dataTable); }
public static void ExecuteReader(this IDbCommandExecutor executor, ExecuteReaderRequest request, Action <IDataReader> read) { executor.Execute(request.CreateCommandRequest, command => { using (var dataReader = command.ExecuteReader(request.CommandBehavior)) read(dataReader); }); }
public static ReadOnlySegmentLinkedList <T> ExecuteReader <T>(this DbProviderFactory dbProviderFactory, string connectionString, ExecuteReaderRequest request, int segmentLength, Func <IDataRecord, T> readRecord) { ReadOnlySegmentLinkedList <T> rows = null; dbProviderFactory.ExecuteReader(connectionString, request, dataReader => rows = dataReader.ReadResult(segmentLength, readRecord)); return(rows); }
public static Task ExecuteReaderAsync(this IDbCommandAsyncExecutor executor, ExecuteReaderRequest request, Func <DbDataReader, Task> readResults) { return(executor.ExecuteAsync( new ExecuteNonReaderRequest(request.CreateCommandRequest, request.CancellationToken), async command => { using (var dataReader = await command.ExecuteReaderAsync(request.CommandBehavior, request.CancellationToken)) await readResults(dataReader); })); }
public static void ExecuteReader(this IDbCommandExecutor executor, ExecuteReaderRequest request, Action <IDataReader> readResults) { Assert.IsNotNull(executor); Assert.IsNotNull(request); executor.Execute(request.CreateCommandRequest, command => { using (var dataReader = command.ExecuteReader(request.CommandBehavior)) readResults(dataReader); }); }
public static List <T> ExecuteReader <T>( this DbProviderFactory dbProviderFactory, string connectionString, ExecuteReaderRequest request, Func <IDataRecord, T> read) { List <T> rows = null; dbProviderFactory.ExecuteReader(connectionString, request, dataReader => rows = dataReader.ReadResult(read)); return(rows); }
public static void ExecuteReader( this DbProviderFactory dbProviderFactory, string connectionString, ExecuteReaderRequest request, Action <IDataReader> read) { using (var connection = dbProviderFactory.CreateConnection()) { connection.ConnectionString = connectionString; connection.Open(); var executor = connection.CreateCommandExecutor(); executor.ExecuteReader(request, read); } }
public static ExecuteReaderResponse <T1, T2, T3> ExecuteReader <T1, T2, T3>(this IDbCommandExecutor executor, ExecuteReaderRequest request, Func <IDataRecord, T1> read1, Func <IDataRecord, T2> read2, Func <IDataRecord, T3> read3) { ExecuteReaderResponse <T1, T2, T3> response = null; executor.ExecuteReader(request, dataReader => response = dataReader.Read(() => read1(dataReader), () => read2(dataReader), () => read3(dataReader))); return(response); }
public static async Task <ReadOnlySegmentLinkedList <T> > ExecuteReaderAsync <T>(this IDbCommandAsyncExecutor executor, ExecuteReaderRequest request, int segmentLength, Func <IDataRecord, T> read) { ReadOnlySegmentLinkedList <T> records = null; await executor.ExecuteReaderAsync( request, async dataReader => records = await dataReader.ReadResultAsync(segmentLength, read, request.CancellationToken)); return(records); }
public static async Task <ExecuteReaderResponse <T1, T2, T3> > ExecuteReaderAsync <T1, T2, T3>(this IDbCommandAsyncExecutor executor, ExecuteReaderRequest request, Func <IDataRecord, T1> read1, Func <IDataRecord, T2> read2, Func <IDataRecord, T3> read3) { ExecuteReaderResponse <T1, T2, T3> response = null; await executor.ExecuteReaderAsync( request, async dataReader => response = await dataReader.ReadAsync(read1, read2, read3, request.CancellationToken)); return(response); }
public static async Task <List <T> > ExecuteReaderAsync <T>(this IDbCommandAsyncExecutor executor, ExecuteReaderRequest request, Func <IDataRecord, T> read) { List <T> records = null; await executor.ExecuteReaderAsync( request, async dataReader => records = await dataReader.ReadAsync(read, request.CancellationToken)); return(records); }
public static ReadOnlySegmentLinkedList <T> ExecuteReader <T>(this IDbCommandExecutor executor, ExecuteReaderRequest request, int segmentLength, Func <IDataRecord, T> readRecord) { Assert.IsNotNull(executor); ReadOnlySegmentLinkedList <T> rows = null; executor.ExecuteReader(request, dataReader => rows = dataReader.ReadResult(segmentLength, readRecord)); return(rows); }