Interface IDatabaseCommand
Provides an interface to send execution commands to the database. Can be either a query string, or a stored procedure name.
Namespace: Paradigm.ORM.Data.Database
Assembly: Paradigm.ORM.Data.dll
Syntax
public interface IDatabaseCommand : IDisposable
Properties
| Improve this Doc View SourceCommandText
Gets or sets the SQL statement, table name or stored procedure to execute at the data source.
Declaration
string CommandText { get; set; }
Property Value
Type | Description |
---|---|
System.String | The SQL statement or stored procedure to execute. The default is an empty string. |
CommandTimeout
Gets or sets the wait time before terminating the attempt to execute a command and generating an error.
Declaration
int CommandTimeout { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The time in seconds to wait for the command to execute. The default is 30 seconds. |
CommandType
Gets or sets a value indicating how the CommandText property is to be interpreted.
Declaration
CommandType CommandType { get; set; }
Property Value
Type | Description |
---|---|
CommandType | One of the |
Parameters
Gets the array of parameters of this command instance.
Declaration
IEnumerable<IDbDataParameter> Parameters { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IDbDataParameter> | The parameters of the SQL statement or stored procedure. The default is an empty collection. |
Methods
| Improve this Doc View SourceAddParameter(IDataParameter)
Adds an existing parameter to the command.
Declaration
IDataParameter AddParameter(IDataParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
IDataParameter | parameter | Parameter to add. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, DbType)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, DbType type)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
DbType | type | Parameter type. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, DbType, Boolean)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, DbType type, bool isNullable)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
DbType | type | Parameter type. |
System.Boolean | isNullable | Indicates if the parameter is nullable. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, DbType, Byte, Byte)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, DbType type, byte precision, byte scale)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
DbType | type | Parameter type. |
System.Byte | precision | Parameter precision. |
System.Byte | scale | Parameter scale. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, DbType, Byte, Byte, Boolean)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, DbType type, byte precision, byte scale, bool isNullable)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
DbType | type | Parameter type. |
System.Byte | precision | Parameter precision. |
System.Byte | scale | Parameter scale. |
System.Boolean | isNullable | Indicates if the parameter is nullable. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, DbType, Int32, Boolean)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, DbType type, int size, bool isNullable)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
DbType | type | Parameter type. |
System.Int32 | size | Parameter size. |
System.Boolean | isNullable | Indicates if the parameter is nullable. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, DbType, Int64)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, DbType type, long size)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
DbType | type | Parameter type. |
System.Int64 | size | Parameter size. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, DbType, Int64, Byte, Byte)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, DbType type, long size, byte precision, byte scale)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
DbType | type | Parameter type. |
System.Int64 | size | Parameter size. |
System.Byte | precision | Parameter precision. |
System.Byte | scale | Parameter scale. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, DbType, Int64, Byte, Byte, Boolean)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, DbType type, long size, byte precision, byte scale, bool isNullable)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
DbType | type | Parameter type. |
System.Int64 | size | Parameter size. |
System.Byte | precision | Parameter precision. |
System.Byte | scale | Parameter scale. |
System.Boolean | isNullable | Indicates if the parameter is nullable. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, Type)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, Type type)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
Type | type | Parameter type. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, Type, Byte, Byte)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, Type type, byte precision, byte scale)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
Type | type | Parameter type. |
System.Byte | precision | Parameter precision. |
System.Byte | scale | Parameter scale. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, Type, Int64)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, Type type, long size)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
Type | type | Parameter type. |
System.Int64 | size | Parameter size. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
AddParameter(String, Type, Int64, Byte, Byte)
Adds a new parameter to the command.
Declaration
IDataParameter AddParameter(string name, Type type, long size, byte precision, byte scale)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
Type | type | Parameter type. |
System.Int64 | size | Parameter size. |
System.Byte | precision | Parameter precision. |
System.Byte | scale | Parameter scale. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter recently added. |
ClearParameters()
Clears the parameters.
Declaration
void ClearParameters()
ExecuteNonQuery()
Executes a SQL statement against the connection and returns the number of rows affected.
Declaration
int ExecuteNonQuery()
Returns
Type | Description |
---|---|
System.Int32 | The number of rows affected. |
ExecuteNonQueryAsync()
Executes a SQL statement against the connection and returns the number of rows affected.
Declaration
Task<int> ExecuteNonQueryAsync()
Returns
Type | Description |
---|---|
Task<System.Int32> | The number of rows affected. |
ExecuteReader()
Sends the CommandText to the IDatabaseConnector and builds a IDatabaseReader.
Declaration
IDatabaseReader ExecuteReader()
Returns
Type | Description |
---|---|
IDatabaseReader | A database reader object. |
ExecuteReaderAsync()
Sends the CommandText to the IDatabaseConnector and builds a IDatabaseReader.
Declaration
Task<IDatabaseReader> ExecuteReaderAsync()
Returns
Type | Description |
---|---|
Task<IDatabaseReader> | A database reader object. |
ExecuteScalar()
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
Declaration
object ExecuteScalar()
Returns
Type | Description |
---|---|
System.Object | The first column of the first row in the result set, or a null reference if the result set is empty. |
ExecuteScalarAsync()
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
Declaration
Task<object> ExecuteScalarAsync()
Returns
Type | Description |
---|---|
Task<System.Object> | The first column of the first row in the result set, or a null reference if the result set is empty. |
GetParameter(Int32)
Gets a parameter by index.
Declaration
IDataParameter GetParameter(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Parameter index. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter. |
GetParameter(String)
Gets a parameter by name.
Declaration
IDataParameter GetParameter(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
Returns
Type | Description |
---|---|
IDataParameter | The reference of the parameter. |