Table of Contents

TObjectManager.AddOwnership Method

Transfers ownership of an entity to the manager so it will be destroyed with the manager, regardless of the outcome of subsequent persistence operations.

Remarks

Normally an entity is owned by the manager only after a successful Save or Merge call. If the operation fails, the entity is not destroyed and the caller must free it manually. Calling AddOwnership before the operation ensures the entity is always destroyed with the manager, even if the persistence operation raises an exception.

Syntax

Unit: Aurelius.Engine.ObjectManager

procedure TObjectManager.AddOwnership(Entity: TObject);

Parameters

<-> Parameter Type Description
Entity TObject The entity whose lifetime should be managed by this manager.

See also