EntityBaseSaveAsync Method (IPredicate, Boolean, CancellationToken) |
Async variant of
Save(IPredicate, Boolean)
Saves the Entity class to the persistent storage. It updates or inserts the entity, which depends if the entity was originally read from the
database. If the entity is new, an insert is done and the updateRestriction is ignored. If the entity is not new, the updateRestriction
predicate is used to create an additional where clause (it will be added with AND) for the update query. This predicate can be used for
concurrency checks, like checks on timestamp column values.
Namespace:
SD.LLBLGen.Pro.ORMSupportClasses
Assembly:
SD.LLBLGen.Pro.ORMSupportClasses (in SD.LLBLGen.Pro.ORMSupportClasses.dll) Version: 5.11.0.0 (5.11.23.1114)
Syntax public virtual Task<bool> SaveAsync(
IPredicate updateRestriction,
bool recurse,
CancellationToken cancellationToken
)
Public Overridable Function SaveAsync (
updateRestriction As IPredicate,
recurse As Boolean,
cancellationToken As CancellationToken
) As Task(Of Boolean)
Parameters
- updateRestriction
- Type: SD.LLBLGen.Pro.ORMSupportClassesIPredicate
Predicate expression, meant for concurrency checks in an Update query. Will be ignored when the entity is
new. Overrules an optional set ConcurrencyPredicateFactory. - recurse
- Type: SystemBoolean
When true, it will save all dirty objects referenced (directly or indirectly) by this entity also. - cancellationToken
- Type: System.ThreadingCancellationToken
The cancellation token.
Return Value
Type:
TaskBoolean
true if all changed fields were successfully persisted to the database, false otherwise
Implements
IEntitySaveAsync(IPredicate, Boolean, CancellationToken)Exceptions Exception | Condition |
---|
ORMQueryExecutionException | When an exception is caught during the save process. The caught exception is set as the
inner exception. Encapsulation of database-related exceptions is necessary since these exceptions do not have a common exception framework
implemented. |
Remarks
Do not call this routine directly, use the overloaded version in a derived class as this version doesn't construct a
local transaction during recursive save, this is done in the overloaded version in a derived class.
See Also