C# Class Griffin.Data.Mapper.CommandBuilders.CommandBuilder

Base class for command builders
Creates SQL commands per the SQL92 standard. Inherit this class to customize different commands.
Inheritance: ICommandBuilder
Mostrar archivo Open project: jgauffin/Griffin.Framework Class Usage Examples

Public Methods

Method Description
CommandBuilder ( ICrudEntityMapper mapper ) : System

Initializes a new instance of the CommandBuilder class.

DeleteCommand ( IDbCommand command, object entity ) : void

Modifies the command to execute a DELETE statement

InsertCommand ( IDbCommand command, object entity ) : void

Generate an insert command, should end with a command that returns the insert identity.

Paging ( IDbCommand command, int pageNumber, int pageSize ) : void

Modify SQL statement so that the result is paged.

TruncateCommand ( IDbCommand command ) : void

Truncate all rows in a table

Will do a DELETE statement

UpdateCommand ( IDbCommand command, object entity ) : void

Create an update query from the entity.

Method Details

CommandBuilder() public method

Initializes a new instance of the CommandBuilder class.
mapper
public CommandBuilder ( ICrudEntityMapper mapper ) : System
mapper ICrudEntityMapper The mapper.
return System

DeleteCommand() public method

Modifies the command to execute a DELETE statement
/// command /// or /// entity ///
public DeleteCommand ( IDbCommand command, object entity ) : void
command IDbCommand Command that will be executed after this method call
entity object Only primary key properties are used in the WHERE clause
return void

InsertCommand() public method

Generate an insert command, should end with a command that returns the insert identity.
/// command /// or /// entity /// No values were added to the query for + entity
public InsertCommand ( IDbCommand command, object entity ) : void
command IDbCommand Command to add the query to
entity object Entity to store
return void

Paging() public method

Modify SQL statement so that the result is paged.
public Paging ( IDbCommand command, int pageNumber, int pageSize ) : void
command IDbCommand Command to modify
pageNumber int One based index
pageSize int Items per page.
return void

TruncateCommand() public method

Truncate all rows in a table
Will do a DELETE statement
command
public TruncateCommand ( IDbCommand command ) : void
command IDbCommand Command that will be executed after this method call
return void

UpdateCommand() public method

Create an update query from the entity.
/// command /// or /// entity /// /// At least one property (other than primary keys) must be specified. /// or ///
public UpdateCommand ( IDbCommand command, object entity ) : void
command IDbCommand Command to modify
entity object Entity to update
return void