Table of Contents

TObjectManager.Merge<E> Method

Merges a transient entity into the manager, returning the corresponding persistent instance.

Remarks

If a persistent object with the same identifier already exists in the manager, its properties are overwritten with those of Entity. If no persistent object is found in memory, Aurelius loads it from the database. If no record with that identifier exists in the database, an exception is raised; use Replicate to insert in that case. If Entity has no identifier, a new instance is created internally and saved. The passed Entity remains transient; the returned reference points to the persistent instance. To persist changes to the database, call Flush after merging. Cascade options with TCascadeType.Merge are applied to associated objects.

Syntax

Unit: Aurelius.Engine.ObjectManager

function TObjectManager.Merge(Entity: E): E;

Parameters

<-> Parameter Type Description
Entity E The transient entity whose values are merged into the managed instance.

Returns

The persistent managed instance updated with the values of Entity.

Type Parameters

Type Parameter Description
E The entity class type.

See also