DataModelCmdBuilder

DataModelCmdBuilder implements an IDataModelCmdBuilder that builds database commands for IDataModel objects.

Namespace:
Inetdev.Data
Type:
Class
Public:
Yes
Protected:
No
Sealed:
No
Abstract:
No
Inherits from:
System.Object
Implements:
Inetdev.Data.IDataModelCmdBuilder

Constructors

DataModelCmdBuilder

Default constructor

Signature:
public Void DataModelCmdBuilder()

Properties

CommandBuilder

Get or set the command builder object.

Signature:
public IDbCmdBuilder CommandBuilder { get; set; }

StatementPreparer

Get or set the statement preparer.

Signature:
public IDbStatementPreparer StatementPreparer { get; set; }

Methods

AddAutonumericPredicates

Adds a predicate that filters by the autonumeric field.

Signature:
protected Boolean AddAutonumericPredicates(statement, model, tsk, expectedTimestamp)
Returns

true if the predicates where added, otherwise false.

Parameters
Name Type Summary
statement Statement Statement to add the predicate to.
model IDataModel The target IDataModel.
tsk TimestampKind Timestamp configuration.
expectedTimestamp DateTime Expected timestamp value.
Exceptions
Type Summary
ArgumentNullException

Thrown when statement is null.

-or- model is null.

AddIdentityPredicates

Adds a predicate that filters by the identity field.

Signature:
protected Boolean AddIdentityPredicates(statement, model, tsk, expectedTimestamp)
Returns

true if the predicates where added, otherwise false.

Parameters
Name Type Summary
statement Statement Statement to add the predicate to.
model IDataModel The target IDataModel.
tsk TimestampKind Timestamp configuration.
expectedTimestamp DateTime Expected timestamp value.
Exceptions
Type Summary
ArgumentNullException

Thrown when statement is null.

-or- model is null.

AddPrimaryKeyPredicates

Adds predicates that filters by the primary key fields.

Signature:
protected Boolean AddPrimaryKeyPredicates(statement, model, tsk, expectedTimestamp)
Returns

true if the predicates where added, otherwise false.

Parameters
Name Type Summary
statement Statement Statement to add the predicate to.
model IDataModel The target IDataModel.
tsk TimestampKind Timestamp configuration.
expectedTimestamp DateTime Expected timestamp value.
Exceptions
Type Summary
ArgumentNullException

Thrown when statement is null.

-or- model is null.

BuildDelete

Builds a delete command for the model.

Signature:
public IDbCommand BuildDelete(model, timestampKind, expectedTimestamp)
Returns

A delete command to be executed.

Parameters
Name Type Summary
model IDataModel An IDataModel.
timestampKind TimestampKind Timestamp configuration.
expectedTimestamp DateTime The expected timestamp value.
Exceptions
Type Summary
ArgumentNullException Thrown when model is null.
MissingWhereClauseException Thrown when the WHERE clause could not be built.

BuildInsert

Builds an insert command for the model.

Signature:
public IDbCommand BuildInsert(model)
Returns

An insert command to be executed.

Parameters
Name Type Summary
model IDataModel An IDataModel.
Exceptions
Type Summary
ArgumentNullException Thrown when model is null.
FieldNotFoundException Thrown when the Field for an IDataProperty could not be found.

BuildUpdate

Builds an update command for the model.

Signature:
public IDbCommand BuildUpdate(model, timestampKind, expectedTimestamp)
Returns

An update command to be executed.

Parameters
Name Type Summary
model IDataModel An IDataModel.
timestampKind TimestampKind Timestamp configuration.
expectedTimestamp DateTime The expected timestamp value.
Exceptions
Type Summary
ArgumentNullException Thrown when model is null.
FieldNotFoundException Thrown when the Field for an IDataProperty could not be found.
MissingWhereClauseException Thrown when the WHERE clause could not be built.

EnsureObjectState

Check if the object state is valid for method execution.

Signature:
protected Void EnsureObjectState()
Exceptions
Type Summary
MissingRequiredPropertyException Thrown when a required property is not initialized.