C# Class Griffin.Data.UnitOfWorkExtensions

Expose DbCommand in the UoW.
ファイルを表示 Open project: jgauffin/Griffin.Framework

Public Methods

Method Description
CreateDbCommand ( this unitOfWork ) : DbCommand

Create a Dbcommand

The async methods in ADO.NET is only exposed in the ADO.NET base classes (i.e. DbCommand) and not in the interfaces. We'll therefore have to violate Liskovs Substitution Principle to be able to access them. You should however be fine if you seperate data from business and just do integration tests for your data layer.

ExecuteNonQuery ( this unitOfWork, string sql, object parameters = null ) : void

Execute a query directly

Do note that the query must be using table column names and not class properties. No mapping is being made.

null is automatically replaced by DBNull.Value for the parameters

ExecuteScalar ( this unitOfWork, string sql, object parameters = null ) : object

Execute a scalar query.

Do note that the query must be using table column names and not class properties. No mapping is being made.

null is automatically replaced by DBNull.Value for the parameters

Method Details

CreateDbCommand() public static method

Create a Dbcommand

The async methods in ADO.NET is only exposed in the ADO.NET base classes (i.e. DbCommand) and not in the interfaces. We'll therefore have to violate Liskovs Substitution Principle to be able to access them. You should however be fine if you seperate data from business and just do integration tests for your data layer.

public static CreateDbCommand ( this unitOfWork ) : DbCommand
unitOfWork this
return System.Data.Common.DbCommand

ExecuteNonQuery() public static method

Execute a query directly

Do note that the query must be using table column names and not class properties. No mapping is being made.

null is automatically replaced by DBNull.Value for the parameters

public static ExecuteNonQuery ( this unitOfWork, string sql, object parameters = null ) : void
unitOfWork this Unit of work to execute query in
sql string sql query
parameters object parameters used in the query
return void

ExecuteScalar() public static method

Execute a scalar query.

Do note that the query must be using table column names and not class properties. No mapping is being made.

null is automatically replaced by DBNull.Value for the parameters

public static ExecuteScalar ( this unitOfWork, string sql, object parameters = null ) : object
unitOfWork this Unit of work to execute query in
sql string sql query
parameters object parameters used in the query
return object