ACRef<T> is a generic class. The type T describes the type of object to be referencing.
The most important feature of an ACRef<T> is the state "IsAttached", which describes whether the referenced object is detached or attached. In detached state , the ACRef does not hold any . NET reference to the encapsulated object or to an instance of generic type T. Accessing the ValueT or Value property immediately reattaches the object to be rereferenced.
To ensure that an ACRef<T> in a detached state, knows which object it was connected to, either the ACUrl or the EntityKey is saved.
Essential Properties:
Parameter | Description |
---|
T ValueT | Referenced object (component or entity object). By accessing this Property the referenced object will automatically attached if its in detached state. |
---|
object value | ValueT as object. |
---|
bool IsObjLoaded | Tests if ValueT is not null. By accessing this Property the referenced object will automatically attached if its in detached state. |
---|
bool IsAttached | Tests if object is referenced (attached). |
---|
bool IsWeakReference | A weak reference is a reference that does not protect the referenced object from collection by the iPlus-GarbageCollector. |
---|
RefInitMode Mode | Behaviour for automatic start and stop of the referenced component. public enum RefInitMode : short { NoInstantiation = 0, AutoStart = 1, AutoStop = 2, AutoStartStop = 3, } |
---|
IACObject ParentACObject | Reference to the parent component that holds or owns this smart-pointer. |
---|
string ACUrl | ACUrl if a ACComponent or IACObject is referenced. |
---|
EntityKey EntityKey | If the referenced object is a EntityObject the EntityKey is saved. |
---|
Essential Methods:
Methode | Description |
---|
void Attach() | Attaches the referenced object if its in detached state. |
---|
void Detach(bool detachFromContext = false) | Detaches the Reference to the T-Object and stores the Reference-Information into ACUrl or EntityKey-Property. If parameter "detachFromContext" is set to true the referenced Entity-Object will be detached from its database-context as well. |
---|
void AttachTo(IACObject parentACObject) | Attaches this ACRef-Instance to the Parent-Object that holds/owns this Smart-Pointer. For entity-objects pass the database-context instead of a ACComponent. |
---|