Reference > Utilities > dbex
dbex.BuildAssignmentsFor
The dbex.BuildAssignmentsFor
method is used to build assignment expressions for entities to be used in an UPDATE statement. An assignment is simply the expression that sets a field value to a new value in the database. The method compares the instances of two entities, and returns a list of the differences as EntityFieldAssignment
(s).
Syntax
dbex.BuildAssignmentsFor({entity_expression})
.From({original})
.To({updated})
Arguments
- entity_expression
- – The table entity that correlates to entities of type `TEntity`.
- original
- – An instance of `TEntity`, this is the "old" state of the entity.
- updated
- – An instance of `TEntity`, this is the "new" state of the entity. When an *UPDATE* query is executed, the database values will be the values of this entity.
Returns
IEnumerable<EntityFieldAssignment>
A list of elements that can be used in an update query.
When an UPDATE query is executed using the field assignments from this method, the database values will be the values of {updated}
.
syntax examples