C# Class Cedar.Core.EntLib.Data.DatabaseWrapper

Inheritance: Database
Show file Open project: Chinaccn/surfboard

Public Methods

Method Description
AddInParameter ( DbCommand command, string name, DbType dbType ) : void

Adds a new In T:System.Data.Common.DbParameter object to the given command.

This version of the method is used when you can have the same parameter object multiple times with different values.

AddInParameter ( DbCommand command, string name, DbType dbType, object value ) : void

Adds a new In T:System.Data.Common.DbParameter object to the given command.

AddInParameter ( DbCommand command, string name, DbType dbType, string sourceColumn, DataRowVersion sourceVersion ) : void

Adds a new In T:System.Data.Common.DbParameter object to the given command.

AddOutParameter ( DbCommand command, string name, DbType dbType, int size ) : void

Adds the out parameter.

AddParameter ( DbCommand command, string name, DbType dbType, ParameterDirection direction, string sourceColumn, DataRowVersion sourceVersion, object value ) : void

Adds a new instance of a T:System.Data.Common.DbParameter object to the command.

BuildParameterName ( string parameterName ) : string

Builds DBMS specific parameter name.

CreateConnection ( ) : DbConnection

Creates the connection.

DatabaseWrapper ( Func dataAccessor, string databaseName ) : System
DiscoverParameters ( DbCommand cmd ) : void

Discovers the parameters.

ExecuteDataSet ( DbCommand command, DbTransaction transaction = null ) : DataSet

Executes the data set.

ExecuteNonQuery ( CommandType commandType, string commandText ) : int

Executes the non query.

ExecuteNonQuery ( DbCommand command, DbTransaction transaction = null ) : int
ExecuteNonQuery ( DbTransaction transaction, string storedProcedureName ) : int

Executes the non query.

ExecuteNonQuery ( string storedProcedureName ) : int

Executes the non query.

ExecuteReader ( CommandType commandType, string commandText ) : IDataReader

Executes the reader.

ExecuteReader ( DbCommand command, DbTransaction transaction = null ) : IDataReader

Executes the reader.

ExecuteReader ( string storedProcedureName ) : IDataReader

Executes the reader.

ExecuteScalar ( CommandType commandType, string commandText ) : object

Executes the scalar.

ExecuteScalar ( DbCommand command ) : object

Executes the scalar.

ExecuteScalar ( DbCommand command, DbTransaction transaction ) : object

Executes the scalar.

GetDataAdapter ( ) : DbDataAdapter

Gets a DbDataAdapter with Standard update behavior.

GetParameterValue ( DbCommand command, string name ) : object

Gets the parameter value.

GetSqlStringCommand ( string query ) : DbCommand

Build a T:System.Data.Common.DbCommand based on the SQL text.

GetStoredProcCommand ( string procedureName ) : DbCommand

Gets the stored proc command.

GetStoredProcCommandWithSourceColumns ( string storedProcedureName ) : DbCommand

Wraps around a derived class's implementation of the GetStoredProcCommandWrapper method and adds functionality for using this method with UpdateDataSet. The GetStoredProcCommandWrapper method (above) that takes a params array expects the array to be filled with VALUES for the parameters. This method differs from the GetStoredProcCommandWrapper method in that it allows a user to pass in a string array. It will also dynamically discover the parameters for the stored procedure and set the parameter's SourceColumns to the strings that are passed in. It does this by mapping the parameters to the strings IN ORDER. Thus, order is very important.

SetParameterValue ( DbCommand command, string name, object value ) : void

Sets the parameter value.

Method Details

AddInParameter() public method

Adds a new In T:System.Data.Common.DbParameter object to the given command.
This version of the method is used when you can have the same parameter object multiple times with different values.
public AddInParameter ( DbCommand command, string name, DbType dbType ) : void
command System.Data.Common.DbCommand The command to add the in parameter.
name string The name of the parameter.
dbType DbType One of the values.
return void

AddInParameter() public method

Adds a new In T:System.Data.Common.DbParameter object to the given command.
public AddInParameter ( DbCommand command, string name, DbType dbType, object value ) : void
command System.Data.Common.DbCommand The commmand to add the parameter.
name string The name of the parameter.
dbType DbType One of the values.
value object The value of the parameter.
return void

AddInParameter() public method

Adds a new In T:System.Data.Common.DbParameter object to the given command.
public AddInParameter ( DbCommand command, string name, DbType dbType, string sourceColumn, DataRowVersion sourceVersion ) : void
command System.Data.Common.DbCommand The command to add the parameter.
name string The name of the parameter.
dbType DbType One of the values.
sourceColumn string The name of the source column mapped to the DataSet and used for loading or returning the value.
sourceVersion DataRowVersion One of the values.
return void

AddOutParameter() public method

Adds the out parameter.
public AddOutParameter ( DbCommand command, string name, DbType dbType, int size ) : void
command System.Data.Common.DbCommand The command.
name string The name.
dbType DbType Type of the db.
size int The size.
return void

AddParameter() public method

Adds a new instance of a T:System.Data.Common.DbParameter object to the command.

public AddParameter ( DbCommand command, string name, DbType dbType, ParameterDirection direction, string sourceColumn, DataRowVersion sourceVersion, object value ) : void
command System.Data.Common.DbCommand The command to add the parameter.
name string The name of the parameter.
dbType DbType One of the values.
direction ParameterDirection One of the values.
sourceColumn string The name of the source column mapped to the DataSet and used for loading or returning the .
sourceVersion DataRowVersion One of the values.
value object The value of the parameter.
return void

BuildParameterName() public method

Builds DBMS specific parameter name.
public BuildParameterName ( string parameterName ) : string
parameterName string The parameter name without any prefix symbol.
return string

CreateConnection() public method

Creates the connection.
public CreateConnection ( ) : DbConnection
return System.Data.Common.DbConnection

DatabaseWrapper() public method

public DatabaseWrapper ( Func dataAccessor, string databaseName ) : System
dataAccessor Func
databaseName string
return System

DiscoverParameters() public method

Discovers the parameters.
public DiscoverParameters ( DbCommand cmd ) : void
cmd System.Data.Common.DbCommand The command.
return void

ExecuteDataSet() public method

Executes the data set.
public ExecuteDataSet ( DbCommand command, DbTransaction transaction = null ) : DataSet
command System.Data.Common.DbCommand The command.
transaction System.Data.Common.DbTransaction The transaction.
return System.Data.DataSet

ExecuteNonQuery() public method

Executes the non query.
public ExecuteNonQuery ( CommandType commandType, string commandText ) : int
commandType CommandType Type of the command.
commandText string The command text.
return int

ExecuteNonQuery() public method

public ExecuteNonQuery ( DbCommand command, DbTransaction transaction = null ) : int
command System.Data.Common.DbCommand
transaction System.Data.Common.DbTransaction
return int

ExecuteNonQuery() public method

Executes the non query.
public ExecuteNonQuery ( DbTransaction transaction, string storedProcedureName ) : int
transaction System.Data.Common.DbTransaction The transaction.
storedProcedureName string Name of the stored procedure.
return int

ExecuteNonQuery() public method

Executes the non query.
public ExecuteNonQuery ( string storedProcedureName ) : int
storedProcedureName string Name of the stored procedure.
return int

ExecuteReader() public method

Executes the reader.
public ExecuteReader ( CommandType commandType, string commandText ) : IDataReader
commandType CommandType Type of the command.
commandText string The command text.
return IDataReader

ExecuteReader() public method

Executes the reader.
public ExecuteReader ( DbCommand command, DbTransaction transaction = null ) : IDataReader
command System.Data.Common.DbCommand The command.
transaction System.Data.Common.DbTransaction The transaction.
return IDataReader

ExecuteReader() public method

Executes the reader.
public ExecuteReader ( string storedProcedureName ) : IDataReader
storedProcedureName string Name of the stored procedure.
return IDataReader

ExecuteScalar() public method

Executes the scalar.
public ExecuteScalar ( CommandType commandType, string commandText ) : object
commandType CommandType Type of the command.
commandText string The command text.
return object

ExecuteScalar() public method

Executes the scalar.
public ExecuteScalar ( DbCommand command ) : object
command System.Data.Common.DbCommand The command.
return object

ExecuteScalar() public method

Executes the scalar.
public ExecuteScalar ( DbCommand command, DbTransaction transaction ) : object
command System.Data.Common.DbCommand The command.
transaction System.Data.Common.DbTransaction The transaction.
return object

GetDataAdapter() public method

Gets a DbDataAdapter with Standard update behavior.
public GetDataAdapter ( ) : DbDataAdapter
return System.Data.Common.DbDataAdapter

GetParameterValue() public method

Gets the parameter value.
public GetParameterValue ( DbCommand command, string name ) : object
command System.Data.Common.DbCommand The command.
name string The name.
return object

GetSqlStringCommand() public method

Build a T:System.Data.Common.DbCommand based on the SQL text.
public GetSqlStringCommand ( string query ) : DbCommand
query string The SQL text.
return System.Data.Common.DbCommand

GetStoredProcCommand() public method

Gets the stored proc command.
public GetStoredProcCommand ( string procedureName ) : DbCommand
procedureName string Name of the procedure.
return System.Data.Common.DbCommand

GetStoredProcCommandWithSourceColumns() public method

Wraps around a derived class's implementation of the GetStoredProcCommandWrapper method and adds functionality for using this method with UpdateDataSet. The GetStoredProcCommandWrapper method (above) that takes a params array expects the array to be filled with VALUES for the parameters. This method differs from the GetStoredProcCommandWrapper method in that it allows a user to pass in a string array. It will also dynamically discover the parameters for the stored procedure and set the parameter's SourceColumns to the strings that are passed in. It does this by mapping the parameters to the strings IN ORDER. Thus, order is very important.
public GetStoredProcCommandWithSourceColumns ( string storedProcedureName ) : DbCommand
storedProcedureName string The name of the stored procedure.
return System.Data.Common.DbCommand

SetParameterValue() public method

Sets the parameter value.
public SetParameterValue ( DbCommand command, string name, object value ) : void
command System.Data.Common.DbCommand The command.
name string The name.
value object The value.
return void