The method is designed for attaching an entity instance to the data context and storing it in the object cache
procedure Attach(Entity: TMappedEntity);
The method attaches an entity instance created with TCustomEntityContext.CreateEntity to the data context and places it to the object cache. As a result of this method execution, several aims are reached:
Existence of separate TCustomEntityContext.CreateEntity and TCustomEntityContext.Attach methods is due to the check of uniqueness of the entity primary key value on saving it to the object cache, therefore it is expedient to use the method in case when the primary key value of an entity is unknown at the moment of its creation (or there is no confidence in its uniqueness).
If the primary key value of an entity is definitely known at the moment of its creation, then the TCustomEntityContext.CreateAttachedEntity method can be used.