//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// An IDbConnection extension method that executes the reader asynchronous operation. /// </summary> /// /// <remarks> Msacli, 22.04.2019. </remarks> /// /// <param name="connection"> The connection to act on. </param> /// <param name="sql"> The SQL. </param> /// <param name="commandType"> (Optional) Type of the command. </param> /// <param name="transaction"> (Optional) The transaction. </param> /// <param name="parameters"> A variable-length parameters list containing parameters. </param> /// /// <returns> An asynchronous result that yields the execute reader. </returns> //////////////////////////////////////////////////////////////////////////////////////////////////// public static Task <IDataReader> ExecuteReaderAsync(this IDbConnection connection, string sql, CommandType commandType = CommandType.Text, IDbTransaction transaction = null, params object[] parameters) { var resultTask = Task.Factory.StartNew(() => { return(DxConnectionOperationExtensionV2.ExecuteReader(connection, sql, commandType, transaction, parameters)); }); return(resultTask); }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> An IDbConnection extension method that first as dynamic asynchronous. </summary> /// /// <remarks> Msacli, 22.04.2019. </remarks> /// /// <param name="connection"> The connection to act on. </param> /// <param name="sqlText"> The SQL text. </param> /// <param name="commandType"> (Optional) Type of the command. </param> /// <param name="transaction"> (Optional) The transaction. </param> /// <param name="parameters"> A variable-length parameters list containing parameters. </param> /// /// <returns> An asynchronous result that yields the first as dynamic. </returns> //////////////////////////////////////////////////////////////////////////////////////////////////// public static Task <ExpandoObject> FirstAsDynamicAsync(this IDbConnection connection, string sqlText, CommandType commandType = CommandType.Text, IDbTransaction transaction = null, params object[] parameters) { var resultTask = Task.Factory.StartNew(() => { return(DxConnectionOperationExtensionV2.FirstAsDynamic(connection, sqlText, commandType, transaction, parameters)); }); return(resultTask); }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> An IDbConnection extension method that last asynchronous. </summary> /// /// <remarks> Msacli, 22.04.2019. </remarks> /// /// <typeparam name="T"> Generic type parameter. </typeparam> /// <param name="connection"> The connection to act on. </param> /// <param name="sqlText"> The SQL text. </param> /// <param name="commandType"> (Optional) Type of the command. </param> /// <param name="transaction"> (Optional) The transaction. </param> /// <param name="parameters"> A variable-length parameters list containing parameters. </param> /// /// <returns> An asynchronous result that yields a T. </returns> //////////////////////////////////////////////////////////////////////////////////////////////////// public static Task <T> LastAsync <T>(this IDbConnection connection, string sqlText, CommandType commandType = CommandType.Text, IDbTransaction transaction = null, params object[] parameters) where T : class { var resultTask = Task.Factory.StartNew(() => { return(DxConnectionOperationExtensionV2.Last <T>(connection, sqlText, commandType, transaction, parameters)); }); return(resultTask); }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// An IDbConnection extension method that gets dynamic result set with paging asynchronous. /// </summary> /// /// <remarks> Msacli, 22.04.2019. </remarks> /// /// <param name="connection"> The connection to act on. </param> /// <param name="sql"> The SQL. </param> /// <param name="commandType"> Type of the command. </param> /// <param name="transaction"> (Optional) The transaction. </param> /// <param name="pageNumber"> (Optional) The page number. </param> /// <param name="pageItemCount"> (Optional) Number of page ıtems. </param> /// <param name="parameters"> A variable-length parameters list containing parameters. </param> /// /// <returns> An asynchronous result that yields the dynamic result set with paging. </returns> //////////////////////////////////////////////////////////////////////////////////////////////////// public static Task <List <ExpandoObject> > GetDynamicResultSetWithPagingAsync(this IDbConnection connection, string sql, CommandType commandType, IDbTransaction transaction = null, uint pageNumber = 1, uint pageItemCount = 10, params object[] parameters) { var resultTask = Task.Factory.StartNew(() => { return(DxConnectionOperationExtensionV2.GetDynamicResultSetWithPaging(connection, sql, commandType, transaction, pageNumber: pageNumber, pageItemCount: pageItemCount, parameters: parameters)); }); return(resultTask); }