-
Notifications
You must be signed in to change notification settings - Fork 18
Update Command Builder
The command performs an update using the provided model.
The parameter object must contain the primary key(s) necessary to locate the record. The keys are normally read from the database, but you can override this behavior to use properties on the object that use the Key attribute.
The remaining properties on the parameter object are used to construct the UPDATE statment. If a property is marked with the IgnoreOnUpdate attribute, it will not participate in this step. This attribute is usually applied to columns that should never be changed such as CretedBy/CreatedDate.
If you use the ChangedPropertiesOnly option, only properties marked as changed by IPropertyChangeTracking.ChangedProperties()
will be used. This interface is found in the Tortuga.Anchor.ComponentModel
namespace.
Alternately, a parameter dictionary of type IReadonlyDictionary<string, object>
may be used. Again, the primary keys will be read from database metadata.
If the materializer desires columns, this echos back the inserted/updated row.
This command is meant to operate on one row at a time. Set-based operations need to be performed using a SQL or Procedure command.
Implementation of the delete varies by database.
SQL Server uses an UPDATE statement with an optional OUTPUT clause.
SQLite uses a separate UPDATE and optional SELECT statement.