DataModelCmdBuilder

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

Namespace:
KpokPatagon.Data
Type:
Class
Public:
Yes
Protected:
No
Sealed:
No
Abstract:
No
Implements:
KpokPatagon.Data.IDataModelCmdBuilder

Properties

CommandBuilder

Gets or sets the command builder object.

Signature:
public IDbCmdBuilder CommandBuilder { get; set; }

Methods

AddConcurrencyPredicateIfNecessary

Adds a predicate that applies the concurrency check.

Signature:
protected Void AddConcurrencyPredicateIfNecessary(statement, model, timestampKind, expectedTimestamp, fields)
Returns

true if the predicates where added, otherwise false.

Parameters
Name Type Summary
statement Statement A Statement to add the predicate to.
model IDataModel An IDataModel.
timestampKind TimestampKind Kind of timestamp to apply.
expectedTimestamp DateTime Expected timestamp.
fields IDictionary<String, Field> A dictionay of fields.
Exceptions
Type Summary
ArgumentNullException

Thrown when statement is null.

-or-

When fields is null.

-or-

When model is null.

AddIdentityOrAutonumericPredicate

Adds a predicate that filters by the identity or autonumeric field.

Signature:
protected Boolean AddIdentityOrAutonumericPredicate(statement, model, fields)
Returns

true if the predicates where added, otherwise false.

Parameters
Name Type Summary
statement Statement A Statement to add the predicate to.
model IDataModel An IDataModel.
fields IDictionary<String, Field> A dictionay of fields.
Exceptions
Type Summary
ArgumentNullException

Thrown when statement is null.

-or-

When fields is null.

-or-

When model is null.

AddPrimaryKeyPredicates

Adds predicates that filters by the primary key fields.

Signature:
protected Boolean AddPrimaryKeyPredicates(statement, model, fields)
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.
fields IDictionary<String, Field> A dictionay of fields.
Exceptions
Type Summary
ArgumentNullException

Thrown when statement is null.

-or-

When fields is null.

-or-

When model is null.

BuildDelete

Builds a SQL delete command.

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

A delete command to be executed.

Parameters
Name Type Summary
dataService IDataService The data service for the model.
model IDataModel An IDataModel.
timestampKind TimestampKind Timestamp configuration.
expectedTimestamp DateTime The expected timestamp value.
Exceptions
Type Summary
ArgumentNullException

Thrown when dataService is null.

-o-

When model is null.

MissingWhereClauseException Thrown when the WHERE clause could not be built.

BuildInsert

Builds a SQL insert command.

Signature:
public IDbCommand BuildInsert(dataService, model, includeIdOutputParameter)
Returns

An insert command to be executed.

Parameters
Name Type Summary
dataService IDataService The data service for the model.
model IDataModel An IDataModel.
includeIdOutputParameter Boolean Whether the command must extract the generated Id as an output parameter.
Exceptions
Type Summary
ArgumentNullException

Thrown when dataService is null.

-o-

When model is null.

BuildUpdate

Builds a SQL update command.

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

An update command to be executed.

Parameters
Name Type Summary
dataService IDataService The data service for the model.
model IDataModel An IDataModel.
timestampKind TimestampKind Timestamp configuration.
expectedTimestamp DateTime The expected timestamp value.
Exceptions
Type Summary
ArgumentNullException

Thrown when dataService is null.

-o-

When model is null.

MissingWhereClauseException Thrown when the WHERE clause could not be built.

EnsureState

Check if the object state is valid.

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