Example #1
0
 /// <summary>
 /// Execute DataTable async
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <returns></returns>
 public static Task <DataTable> ExecuteDataTableAsync(this MySqlConnection conn, string cmdText, CommandType commandType)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteDataTableAsync(cmdText, null, commandType, null));
 }
 /// <summary>
 /// Execute Reader
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="commandType"></param>
 /// <returns></returns>
 public static Task <MySqlDataReader> ExecuteReaderAsync(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, CommandType commandType)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteReaderAsync(cmdText, parameters, commandType, null));
 }
 /// <summary>
 /// Execute Reader
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static MySqlDataReader ExecuteReader(this MySqlConnection conn, string cmdText, CommandType commandType, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteReader(cmdText, null, commandType, transaction));
 }
 /// <summary>
 /// Execute Scalar to...
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="commandFactory"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static T ExecuteScalarTo <T>(this MySqlConnection conn, Action <MySqlCommand> commandFactory)
 {
     conn.CheckNull(nameof(conn));
     using var command = conn.CreateCommand(commandFactory);
     return(command.ExecuteScalar().CastTo <T>());
 }
 /// <summary>
 /// Execute Scalar to...
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <param name="transaction"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static T ExecuteScalarTo <T>(this MySqlConnection conn, string cmdText, CommandType commandType, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteScalarTo <T>(cmdText, null, commandType, transaction));
 }
 /// <summary>
 /// Execute Scalar to...
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="transaction"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static T ExecuteScalarTo <T>(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteScalarTo <T>(cmdText, parameters, CommandType.Text, transaction));
 }
 /// <summary>
 /// Execute Scalar to...
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="transaction"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static Task <T> ExecuteScalarToAsync <T>(this MySqlConnection conn, string cmdText, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteScalarToAsync <T>(cmdText, null, CommandType.Text, transaction));
 }
 /// <summary>
 /// Execute NonQuery
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="commandFactory"></param>
 public static Task ExecuteNonQueryAsync(this MySqlConnection conn, Action <MySqlCommand> commandFactory)
 {
     conn.CheckNull(nameof(conn));
     using var command = conn.CreateCommand(commandFactory);
     return(command.ExecuteNonQueryAsync());
 }
 /// <summary>
 /// Execute NonQuery
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 public static Task ExecuteNonQueryAsync(this MySqlConnection conn, string cmdText)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteNonQueryAsync(cmdText, null, CommandType.Text, null));
 }
Example #10
0
 /// <summary>
 /// Execute DataSet
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static DataSet ExecuteDataSet(this MySqlConnection conn, string cmdText, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteDataSet(cmdText, null, CommandType.Text, transaction));
 }
Example #11
0
 /// <summary>
 /// Execute DataSet
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <returns></returns>
 public static DataSet ExecuteDataSet(this MySqlConnection conn, string cmdText, CommandType commandType)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteDataSet(cmdText, null, commandType, null));
 }
Example #12
0
 /// <summary>
 /// Execute DataSet async
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public static Task <DataSet> ExecuteDataSetAsync(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteDataSetAsync(cmdText, parameters, CommandType.Text, null));
 }
Example #13
0
 /// <summary>
 /// Execute DataTable
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <returns></returns>
 public static DataTable ExecuteDataTable(this MySqlConnection conn, string cmdText)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteDataTable(cmdText, null, CommandType.Text, null));
 }
Example #14
0
 /// <summary>
 /// Execute DataTable
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="commandFactory"></param>
 /// <returns></returns>
 public static DataTable ExecuteDataTable(this MySqlConnection conn, Action <MySqlCommand> commandFactory)
 {
     conn.CheckNull(nameof(conn));
     using var command = conn.CreateCommand(commandFactory);
     return(command.ExecuteFirstDataTable());
 }
Example #15
0
 /// <summary>
 /// Execute a set of expando object
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="commandType"></param>
 /// <returns></returns>
 public static Task <IEnumerable <dynamic> > ExecuteExpandoObjectsAsync(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, CommandType commandType)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteExpandoObjectsAsync(cmdText, parameters, commandType, null));
 }
 /// <summary>
 /// Execute NonQuery
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="commandType"></param>
 /// <param name="transaction"></param>
 public static void ExecuteNonQuery(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, CommandType commandType, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     using var command = conn.CreateCommand(cmdText, commandType, transaction, parameters);
     command.ExecuteNonQuery();
 }
Example #17
0
 /// <summary>
 /// Execute a set of expando object
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static IEnumerable <dynamic> ExecuteExpandoObjects(this MySqlConnection conn, string cmdText, CommandType commandType, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteExpandoObjects(cmdText, null, commandType, transaction));
 }
 /// <summary>
 /// Execute NonQuery
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <param name="transaction"></param>
 public static Task ExecuteNonQueryAsync(this MySqlConnection conn, string cmdText, CommandType commandType, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteNonQueryAsync(cmdText, null, commandType, transaction));
 }
 /// <summary>
 /// Execute Scalar to...
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="commandType"></param>
 /// <param name="transaction"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static T ExecuteScalarTo <T>(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, CommandType commandType, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     using var command = conn.CreateCommand(cmdText, commandType, transaction, parameters);
     return(command.ExecuteScalar().CastTo <T>());
 }
 /// <summary>
 /// Execute NonQuery
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="transaction"></param>
 public static Task ExecuteNonQueryAsync(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteNonQueryAsync(cmdText, parameters, CommandType.Text, transaction));
 }
 /// <summary>
 /// Execute Scalar to...
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="commandType"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static Task <T> ExecuteScalarToAsync <T>(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, CommandType commandType)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteScalarToAsync <T>(cmdText, parameters, commandType, null));
 }
 /// <summary>
 /// Execute NonQuery
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="commandFactory"></param>
 public static void ExecuteNonQuery(this MySqlConnection conn, Action <MySqlCommand> commandFactory)
 {
     conn.CheckNull(nameof(conn));
     using var command = conn.CreateCommand(commandFactory);
     command.ExecuteNonQuery();
 }
 /// <summary>
 /// Execute Scalar to...
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static T ExecuteScalarTo <T>(this MySqlConnection conn, string cmdText)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteScalarTo <T>(cmdText, null, CommandType.Text, null));
 }
 /// <summary>
 /// Execute NonQuery
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <param name="transaction"></param>
 public static void ExecuteNonQuery(this MySqlConnection conn, string cmdText, CommandType commandType, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     conn.ExecuteNonQuery(cmdText, null, commandType, transaction);
 }
 /// <summary>
 /// Execute Reader
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static Task <MySqlDataReader> ExecuteReaderAsync(this MySqlConnection conn, string cmdText, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteReaderAsync(cmdText, null, CommandType.Text, transaction));
 }
 /// <summary>
 /// Execute NonQuery
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 public static void ExecuteNonQuery(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters)
 {
     conn.CheckNull(nameof(conn));
     conn.ExecuteNonQuery(cmdText, parameters, CommandType.Text, null);
 }
 /// <summary>
 /// Execute Reader
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="commandFactory"></param>
 /// <returns></returns>
 public static MySqlDataReader ExecuteReader(this MySqlConnection conn, Action <MySqlCommand> commandFactory)
 {
     conn.CheckNull(nameof(conn));
     using var command = conn.CreateCommand(commandFactory);
     return(command.ExecuteReader());
 }
Example #28
0
 /// <summary>
 /// Execute a set of expando object
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static Task <IEnumerable <dynamic> > ExecuteExpandoObjectsAsync(this MySqlConnection conn, string cmdText, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteExpandoObjectsAsync(cmdText, null, CommandType.Text, transaction));
 }
 /// <summary>
 /// Execute Reader
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public static MySqlDataReader ExecuteReader(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteReader(cmdText, parameters, CommandType.Text, null));
 }
Example #30
0
 /// <summary>
 /// Execute DataTable
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="commandType"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static DataTable ExecuteDataTable(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, CommandType commandType, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     using var command = conn.CreateCommand(cmdText, commandType, transaction, parameters);
     return(command.ExecuteFirstDataTable());
 }