Table of Contents

Interface ISessionExternalObjects

Namespace
RDCore.SDK.Runtime.Abstract.Execution
Assembly
RDCore.SDK.dll

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

objectId VBRuntimeObjectId

The identity of the object, minted by CreateObject().

owner IExternalObjectOwner

The provider that holds the handle, and is told when the object is let go of.

handle object

Whatever 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

objectId VBRuntimeObjectId

The 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

objectId VBRuntimeObjectId

Returns

bool

true when they were not, and the caller is the one to start listening.

TryEndListening(VBRuntimeObjectId)

Records that the events of the external object behind objectId are no longer listened to.

bool TryEndListening(VBRuntimeObjectId objectId)

Parameters

objectId VBRuntimeObjectId

Returns

bool

true when they were, and the caller is the one to stop listening.

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

owner IExternalObjectOwner

The provider that holds the handle.

handle object

The handle, compared by reference.

objectId VBRuntimeObjectId

The identity of the object.

Returns

bool

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

objectId VBRuntimeObjectId

The identity of the object.

owner IExternalObjectOwner

The provider that holds the handle.

handle object

The handle.

Returns

bool