Table of Contents

Proxy<T> Record

A lightweight record wrapper that enables lazy loading of an associated entity or collection.

Remarks

Proxy<T> is used as the field type for associations declared with TAssociationProp.Lazy. When Aurelius loads the owning entity it installs an IProxyController on the proxy but does not yet query the database for the associated object. The first read of the Value property triggers the actual load. For many-to-one associations, declare the field as Proxy<TRelatedEntity> and expose it through a typed property that returns FArtist.Value. For one-to-many associations, declare the field as Proxy<TList<TChildEntity>>, create the list in the constructor using SetInitialValue, and free it in the destructor using DestroyValue. Do not access Value directly inside the constructor or destructor.

Syntax

Unit: Aurelius.Types.Proxy

Proxy<T> = record;

Methods

Name Description
DestroyValue Frees the object currently held by the proxy.
Load Forces an immediate load of the proxied object if it has not been loaded yet.
SetInitialValue Sets the initial value of the proxy without marking it as loaded.

Operators

Name Description
Equality Adapts the = operator so it returns true when both instances have the same values.
Inequality Adapts the <> operator so it returns true when both instances have different values.

Properties

Name Description
Available Indicates whether the proxied value is already available without requiring a database load.
Key Returns the primary-key value that identifies the proxied object in the database.
Value Gets or sets the proxied object, triggering a database load on first read if necessary.