Interface ISessionExternalObjects
The objects of a session that something outside the workspace owns: an Excel Workbook, a Scripting.Dictionary.
public interface ISessionExternalObjects
Remarks
An external object is an opaque handle owned by its provider. The session knows it by the same identity as any other object
(VBRuntimeObjectId), so that references to it are counted, compared with Is and released by the machinery that already does those
things for the objects of the workspace; what stands behind the identity is the provider's own business, and nothing here looks inside it. Only arguments
and results ever cross to a provider, never an object graph.
⚖️RDCore provides implementations of this interface licensed under GPLv3.
Methods
Bind(VBRuntimeObjectId, IExternalObjectOwner, object)
Makes handle, which owner holds, what objectId stands for.
void Bind(VBRuntimeObjectId objectId, IExternalObjectOwner owner, object handle)
Parameters
objectIdVBRuntimeObjectIdThe identity of the object, minted by CreateObject().
ownerIExternalObjectOwnerThe provider that holds the handle, and is told when the object is let go of.
handleobjectWhatever the provider identifies the object by.
Release(VBRuntimeObjectId)
Lets go of the external object behind objectId, if it has one: its provider is told, and the object is no longer known here.
void Release(VBRuntimeObjectId objectId)
Parameters
objectIdVBRuntimeObjectIdThe identity of the object that has no reference left.
ReleaseAll()
Lets go of every external object: the objects of a program that ended, or of a session that is over.
void ReleaseAll()
TryBeginListening(VBRuntimeObjectId)
Records that the events of the external object behind objectId are now listened to.
bool TryBeginListening(VBRuntimeObjectId objectId)
Parameters
objectIdVBRuntimeObjectId
Returns
TryEndListening(VBRuntimeObjectId)
Records that the events of the external object behind objectId are no longer listened to.
bool TryEndListening(VBRuntimeObjectId objectId)
Parameters
objectIdVBRuntimeObjectId
Returns
TryFind(IExternalObjectOwner, object, out VBRuntimeObjectId)
Gets the object that handle is already bound to, if there is one: what makes two results that are the same external object the
same object to a program, which is what Is asks.
bool TryFind(IExternalObjectOwner owner, object handle, out VBRuntimeObjectId objectId)
Parameters
ownerIExternalObjectOwnerThe provider that holds the handle.
handleobjectThe handle, compared by reference.
objectIdVBRuntimeObjectIdThe identity of the object.
Returns
TryGet(VBRuntimeObjectId, out IExternalObjectOwner?, out object?)
Gets the provider and the handle behind an object, if it is an external one.
bool TryGet(VBRuntimeObjectId objectId, out IExternalObjectOwner? owner, out object? handle)
Parameters
objectIdVBRuntimeObjectIdThe identity of the object.
ownerIExternalObjectOwnerThe provider that holds the handle.
handleobjectThe handle.