DataModelCmdBuilder implements an IDataModelCmdBuilder that builds database commands for IDataModel objects.
Default constructor
public Void DataModelCmdBuilder()
Get or set the command builder object.
public IDbCmdBuilder CommandBuilder { get; set; }
Get or set the statement preparer.
public IDbStatementPreparer StatementPreparer { get; set; }
Adds a predicate that filters by the autonumeric field.
protected Boolean AddAutonumericPredicates(statement, model, tsk, expectedTimestamp)
true if the predicates where added, otherwise false.
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. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when statement is null. -or- model is null. |
Adds a predicate that filters by the identity field.
protected Boolean AddIdentityPredicates(statement, model, tsk, expectedTimestamp)
true if the predicates where added, otherwise false.
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. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when statement is null. -or- model is null. |
Adds predicates that filters by the primary key fields.
protected Boolean AddPrimaryKeyPredicates(statement, model, tsk, expectedTimestamp)
true if the predicates where added, otherwise false.
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. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when statement is null. -or- model is null. |
Builds a delete command for the model.
public IDbCommand BuildDelete(model, timestampKind, expectedTimestamp)
A delete command to be executed.
Name | Type | Summary |
---|---|---|
model | IDataModel | An IDataModel. |
timestampKind | TimestampKind | Timestamp configuration. |
expectedTimestamp | DateTime | The expected timestamp value. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when model is null. |
MissingWhereClauseException | Thrown when the WHERE clause could not be built. |
Builds an insert command for the model.
public IDbCommand BuildInsert(model)
An insert command to be executed.
Name | Type | Summary |
---|---|---|
model | IDataModel | An IDataModel. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when model is null. |
FieldNotFoundException | Thrown when the Field for an IDataProperty could not be found. |
Builds an update command for the model.
public IDbCommand BuildUpdate(model, timestampKind, expectedTimestamp)
An update command to be executed.
Name | Type | Summary |
---|---|---|
model | IDataModel | An IDataModel. |
timestampKind | TimestampKind | Timestamp configuration. |
expectedTimestamp | DateTime | The expected timestamp value. |
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. |
Check if the object state is valid for method execution.
protected Void EnsureObjectState()
Type | Summary |
---|---|
MissingRequiredPropertyException | Thrown when a required property is not initialized. |