Class SqlConnectionExtensions
Inherited Members
Namespace: Estrelica.Utility
Assembly: Estrelica.Utility.dll
Syntax
[DoNotObfuscateType]
public static class SqlConnectionExtensions
Methods
AssertTableName(SqlConnection, string, SqlTransaction, bool)
Declaration
public static string AssertTableName(this SqlConnection conn, string tableName, SqlTransaction trans = null, bool returnNullIfInvalid = false)
Parameters
SqlConnection conn |
string tableName |
SqlTransaction trans |
bool returnNullIfInvalid |
Returns
string |
ColumnDataType(SqlConnection, string, string, SqlTransaction)
Declaration
public static SqlDbType? ColumnDataType(this SqlConnection conn, string tableName, string columnName, SqlTransaction trans = null)
Parameters
SqlConnection conn |
string tableName |
string columnName |
SqlTransaction trans |
Returns
SqlDbType? |
ColumnExists(SqlConnection, string, string, SqlTransaction, bool)
Declaration
public static bool ColumnExists(this SqlConnection conn, string tableName, string columnName, SqlTransaction trans = null, bool returnFalseIfTableInvalid = true)
Parameters
SqlConnection conn |
string tableName |
string columnName |
SqlTransaction trans |
bool returnFalseIfTableInvalid |
Returns
bool |
ColumnMetadata(SqlConnection, string, string, SqlTransaction)
Declaration
public static IDictionary<string, dynamic> ColumnMetadata(this SqlConnection conn, string tableName, string columnName, SqlTransaction trans = null)
Parameters
SqlConnection conn |
string tableName |
string columnName |
SqlTransaction trans |
Returns
IDictionary<string, dynamic> |
ExecuteNonQuery(SqlConnection, string, Action<SqlCommand>, SqlTransaction)
Declaration
public static int ExecuteNonQuery(this SqlConnection conn, string query, Action<SqlCommand> cmdSetup = null, SqlTransaction trans = null)
Parameters
SqlConnection conn |
string query |
Action<SqlCommand> cmdSetup |
SqlTransaction trans |
Returns
int |
ExecuteOperation<T>(SqlConnection, Func<SqlConnection, SqlTransaction, T>, SqlTransaction)
Declaration
public static T ExecuteOperation<T>(this SqlConnection conn, Func<SqlConnection, SqlTransaction, T> operation, SqlTransaction trans = null)
Parameters
SqlConnection conn |
Func<SqlConnection, SqlTransaction, T> operation |
SqlTransaction trans |
Returns
T |
Type Parameters
T |
ExecuteReader(SqlConnection, SqlTransaction, string, Action<SqlDataReader>, Action<SqlCommand>)
Declaration
public static void ExecuteReader(this SqlConnection connection, SqlTransaction trans, string query, Action<SqlDataReader> readerOperation, Action<SqlCommand> cmdSetup = null)
Parameters
SqlConnection connection |
SqlTransaction trans |
string query |
Action<SqlDataReader> readerOperation |
Action<SqlCommand> cmdSetup |
ExecuteReader<T>(SqlConnection, string, Func<SqlDataReader, T>, Action<SqlCommand>, SqlTransaction)
Declaration
public static T ExecuteReader<T>(this SqlConnection connection, string query, Func<SqlDataReader, T> readerOperation, Action<SqlCommand> cmdSetup = null, SqlTransaction trans = null)
Parameters
SqlConnection connection |
string query |
Func<SqlDataReader, T> readerOperation |
Action<SqlCommand> cmdSetup |
SqlTransaction trans |
Returns
T |
Type Parameters
T |
ExecuteScalar<T>(SqlConnection, string, Action<SqlCommand>, SqlTransaction)
Declaration
public static T ExecuteScalar<T>(this SqlConnection connection, string query, Action<SqlCommand> cmdSetup = null, SqlTransaction trans = null)
Parameters
SqlConnection connection |
string query |
Action<SqlCommand> cmdSetup |
SqlTransaction trans |
Returns
T |
Type Parameters
T |
IterateReader(SqlConnection, string, Action<SqlDataReader>, Action<SqlCommand>, SqlTransaction)
Declaration
public static void IterateReader(this SqlConnection conn, string query, Action<SqlDataReader> iterateOperation, Action<SqlCommand> cmdSetup = null, SqlTransaction trans = null)
Parameters
SqlConnection conn |
string query |
Action<SqlDataReader> iterateOperation |
Action<SqlCommand> cmdSetup |
SqlTransaction trans |
IterateReader<T>(SqlConnection, string, Func<SqlDataReader, T>, Action<SqlCommand>, SqlTransaction)
Declaration
public static IEnumerable<T> IterateReader<T>(this SqlConnection conn, string query, Func<SqlDataReader, T> iterateOperation = null, Action<SqlCommand> cmdSetup = null, SqlTransaction trans = null)
Parameters
SqlConnection conn |
string query |
Func<SqlDataReader, T> iterateOperation |
Action<SqlCommand> cmdSetup |
SqlTransaction trans |
Returns
IEnumerable<T> |
Type Parameters
T |
SingleOperation(SqlConnection, string, Action<SqlDataReader>, Action<SqlCommand>, SqlTransaction)
Declaration
public static void SingleOperation(this SqlConnection conn, string query, Action<SqlDataReader> readerOperation, Action<SqlCommand> cmdSetup = null, SqlTransaction trans = null)
Parameters
SqlConnection conn |
string query |
Action<SqlDataReader> readerOperation |
Action<SqlCommand> cmdSetup |
SqlTransaction trans |
SingleOperation<T>(SqlConnection, string, Func<SqlDataReader, T>, Action<SqlCommand>, SqlTransaction)
Declaration
public static T SingleOperation<T>(this SqlConnection conn, string query, Func<SqlDataReader, T> readerOperation, Action<SqlCommand> cmdSetup = null, SqlTransaction trans = null)
Parameters
SqlConnection conn |
string query |
Func<SqlDataReader, T> readerOperation |
Action<SqlCommand> cmdSetup |
SqlTransaction trans |
Returns
T |
Type Parameters
T |
TableMetadata(SqlConnection, string, SqlTransaction)
Declaration
public static IDictionary<string, IDictionary<string, dynamic>> TableMetadata(this SqlConnection conn, string tableName, SqlTransaction trans = null)
Parameters
SqlConnection conn |
string tableName |
SqlTransaction trans |
Returns
IDictionary<string, IDictionary<string, dynamic>> |