Introduction
Executor class is the main gate to access the database. It's the only one used by the engine and if you are planning to send raw sql commands to the current connection, is the one you have to use.
Methods
Here are the available method overloads, many of them taking
SqlPreCommand as a parameter:
public static class Executor
{
public static object ExecuteScalar(string sql)
public static object ExecuteScalar(string sql, List<SqlParameter> parameters)
public static object ExecuteScalar(this SqlPreCommandSimple preCommand)
public static int ExecuteNonQuery(string sql)
public static int ExecuteNonQuery(string sql, List<SqlParameter> parameters)
public static int ExecuteNonQuery(this SqlPreCommandSimple preCommand)
public static DataTable ExecuteDataTable(string sql)
public static DataTable ExecuteDataTable(string sql, List<SqlParameter> parameters)
public static DataTable ExecuteDataTable(this SqlPreCommandSimple preCommand)
public static DataSet ExecuteDataSet(string sql)
public static DataSet ExecuteDataSet(string sql, List<SqlParameter> parameters)
public static DataSet ExecuteDataSet(this SqlPreCommandSimple preCommand)
public static void ExecuteLeaves(this SqlPreCommand preCommand)
}
All the methods are self explanatory. The last one, ExecuteLeaves, just executes every SqlPreCommandSimple in the leaves of the SqlPreCommand tree independently.
Internally it uses
Connection class to access to the database - so it won't do anything when using MockConnection - but you can't sent commands to Connection class directly (they are internal).
Finally, if no available overloads satisfy your needs and you need to do more advanced ADO.Net code, you can access CurrentConnection and CurrentTransaction in
Transaction class.