Exemple #1
0
 /// <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 T ExecuteScalarTo <T>(this MySqlConnection conn, string cmdText, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteScalarTo <T>(cmdText, null, CommandType.Text, transaction));
 }
Exemple #2
0
 /// <summary>
 /// Execute scalar to...
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static T ExecuteScalarTo <T>(this MySqlConnection conn, string cmdText, CommandType commandType)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteScalarTo <T>(cmdText, null, commandType, null));
 }
Exemple #3
0
 /// <summary>
 /// Execute scalar
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static Task <object> ExecuteScalarAsync(this MySqlConnection conn, string cmdText, CommandType commandType, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteScalarAsync(cmdText, null, commandType, transaction));
 }
Exemple #4
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));
 }
 /// <summary>
 /// Execute expando object
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static dynamic ExecuteExpandoObject(this MySqlConnection conn, string cmdText, CommandType commandType, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteExpandoObject(cmdText, null, commandType, transaction));
 }
Exemple #6
0
 /// <summary>
 /// Execute scalar
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="commandFactory"></param>
 /// <returns></returns>
 public static Task <object> ExecuteScalarAsync(this MySqlConnection conn, Action <MySqlCommand> commandFactory)
 {
     conn.CheckNull(nameof(conn));
     using var command = conn.CreateCommand(commandFactory);
     return(command.ExecuteScalarAsync());
 }
 /// <summary>
 /// Execute DataTable
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public static DataTable ExecuteDataTable(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteDataTable(cmdText, parameters, CommandType.Text, null));
 }
 /// <summary>
 /// Execute expando object
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static Task <dynamic> ExecuteExpandoObjectAsync(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteExpandoObjectAsync(cmdText, parameters, CommandType.Text, transaction));
 }
 /// <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());
 }
 /// <summary>
 /// Execute DataTable
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static DataTable ExecuteDataTable(this MySqlConnection conn, string cmdText, CommandType commandType, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteDataTable(cmdText, null, commandType, transaction));
 }
 /// <summary>
 /// Execute DataTable
 /// </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 DataTable
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static Task <DataTable> ExecuteDataTableAsync(this MySqlConnection conn, string cmdText, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteDataTableAsync(cmdText, null, CommandType.Text, transaction));
 }
Exemple #13
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));
 }
 /// <summary>
 /// Execute expando object
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="commandType"></param>
 /// <returns></returns>
 public static dynamic ExecuteExpandoObject(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, CommandType commandType)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteExpandoObject(cmdText, parameters, commandType, null));
 }
 /// <summary>
 /// Execute a set of entity
 /// </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 <IEnumerable <T> > ExecuteEntitiesAsync <T>(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, CommandType commandType)
     where T : new()
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteEntitiesAsync <T>(cmdText, parameters, commandType, null));
 }
 /// <summary>
 /// Execute expando object
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="commandType"></param>
 /// <returns></returns>
 public static Task <dynamic> ExecuteExpandoObjectAsync(this MySqlConnection conn, string cmdText, CommandType commandType)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteExpandoObjectAsync(cmdText, null, commandType, null));
 }
 /// <summary>
 /// Execute a set of entity
 /// </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 IEnumerable <T> ExecuteEntities <T>(this MySqlConnection conn, string cmdText, CommandType commandType, MySqlTransaction transaction) where T : new()
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteEntities <T>(cmdText, null, commandType, transaction));
 }
 /// <summary>
 /// Execute expando object
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <returns></returns>
 public static dynamic ExecuteExpandoObject(this MySqlConnection conn, string cmdText)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteExpandoObject(cmdText, null, CommandType.Text, null));
 }
Exemple #19
0
 /// <summary>
 /// Execute scalar to...
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="commandFactory"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static async Task <T> ExecuteScalarToAsync <T>(this MySqlConnection conn, Action <MySqlCommand> commandFactory)
 {
     conn.CheckNull(nameof(conn));
     using var command = conn.CreateCommand(commandFactory);
     return((await command.ExecuteScalarAsync()).CastTo <T>());
 }
Exemple #20
0
 /// <summary>
 /// Execute scalar
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="transaction"></param>
 /// <returns></returns>
 public static object ExecuteScalar(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, MySqlTransaction transaction)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteScalar(cmdText, parameters, CommandType.Text, transaction));
 }
Exemple #21
0
 /// <summary>
 /// Execute scalar to...
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static Task <T> ExecuteScalarToAsync <T>(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteScalarToAsync <T>(cmdText, parameters, CommandType.Text, null));
 }
Exemple #22
0
 /// <summary>
 /// Execute scalar
 /// </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 object ExecuteScalar(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());
 }
Exemple #23
0
 /// <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>());
 }
Exemple #24
0
 /// <summary>
 /// Execute scalar
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <param name="parameters"></param>
 /// <param name="commandType"></param>
 /// <returns></returns>
 public static Task <object> ExecuteScalarAsync(this MySqlConnection conn, string cmdText, MySqlParameter[] parameters, CommandType commandType)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteScalarAsync(cmdText, parameters, commandType, null));
 }
Exemple #25
0
 /// <summary>
 /// Execute DataSet
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="cmdText"></param>
 /// <returns></returns>
 public static Task <DataSet> ExecuteDataSetAsync(this MySqlConnection conn, string cmdText)
 {
     conn.CheckNull(nameof(conn));
     return(conn.ExecuteDataSetAsync(cmdText, null, CommandType.Text, null));
 }