Table of Contents

Interface IFoundryServices

Namespace
WorkflowForge.Abstractions
Assembly
WorkflowForge.dll

Foundry-scoped services and extension-owned objects with explicit lease lifetime. Values are disposed when the foundry lease ends, unlike Properties which holds execution data only.

public interface IFoundryServices

Methods

ContainsKey(string)

Returns whether a key is registered.

bool ContainsKey(string key)

Parameters

key string

Returns

bool

DisposeAll()

Disposes every registered service and empties the collection. Called by the foundry when its lease ends.

void DisposeAll()

Set(string, object)

Stores a service, disposing any previous value registered under the same key when it implements IDisposable.

void Set(string key, object value)

Parameters

key string
value object

TryAdd(string, object)

Adds a service if the key is not already present. A rejected value is not disposed and remains owned by the caller.

bool TryAdd(string key, object value)

Parameters

key string
value object

Returns

bool

True if the value was added; false if the key already existed.

TryGet<T>(string, out T?)

Attempts to get a service by key.

bool TryGet<T>(string key, out T? value) where T : class

Parameters

key string
value T

Returns

bool

Type Parameters

T

TryRemove(string, out object?)

Removes a service, disposing it when it implements IDisposable. The removed instance is returned already disposed.

bool TryRemove(string key, out object? removed)

Parameters

key string
removed object

Returns

bool