Skip to content

Interface IDependencyService

Namespace: Void.Proxy.Api.Plugins.Dependencies
Assembly: Void.Proxy.Api.dll

Manages plugin dependency registrations, activation, and player-scoped service providers.

public interface IDependencyService : IEventListener, IServiceProvider

Implements

IEventListener, IServiceProvider

Methods

ActivatePlayerScope(IPlayerContext)

Creates and eagerly activates registered scoped services for a player context.

void ActivatePlayerScope(IPlayerContext context)

Parameters

context IPlayerContext

The player context whose scopes are activated.

CreateInstance<TService>(CancellationToken, params object[])

Resolves or constructs an instance of TService.

TService CreateInstance<TService>(CancellationToken cancellationToken = default, params object[] parameters)

Parameters

cancellationToken CancellationToken

A token associated with event-listener registration when the created instance is a listener.

parameters object[]

Explicit constructor arguments used when the service is not already registered.

Returns

TService

The resolved or constructed service instance.

Type Parameters

TService

The service type to create.

CreateInstance<TService>(Type, CancellationToken, params object[])

Resolves or constructs a runtime service type and casts it to TService.

TService CreateInstance<TService>(Type serviceType, CancellationToken cancellationToken = default, params object[] parameters)

Parameters

serviceType Type

The runtime service type to resolve or construct.

cancellationToken CancellationToken

A token associated with event-listener registration when the created instance is a listener.

parameters object[]

Explicit constructor arguments used when the service is not already registered.

Returns

TService

The resolved or constructed instance cast to TService.

Type Parameters

TService

The type expected by the caller.

Exceptions

InvalidOperationException

The created instance cannot be cast to TService.

CreateInstance(Type, CancellationToken, params object[])

Resolves or constructs an instance of a runtime service type.

object CreateInstance(Type serviceType, CancellationToken cancellationToken = default, params object[] parameters)

Parameters

serviceType Type

The runtime service type to resolve or construct.

cancellationToken CancellationToken

A token associated with event-listener registration when the created instance is a listener.

parameters object[]

Explicit constructor arguments used when the service is not already registered.

Returns

object

The resolved or constructed service instance.

DisposePlayerScope(IPlayerContext)

Unregisters scoped event listeners and disposes all plugin scopes associated with a player context.

void DisposePlayerScope(IPlayerContext context)

Parameters

context IPlayerContext

The player context whose scopes are disposed.

GetEntryPoint(IPlayer, Assembly?)

Creates a composite provider that searches a player’s scoped services before root services.

IServiceProvider GetEntryPoint(IPlayer player, Assembly? preferredAssembly = null)

Parameters

player IPlayer

The player whose scopes are included.

preferredAssembly Assembly?

An optional plugin assembly whose registrations should receive resolution priority.

Returns

IServiceProvider

A composite service provider for player-scoped and root resolution.

GetEntryPoint(Assembly?)

Creates a composite provider for root service resolution.

IServiceProvider GetEntryPoint(Assembly? preferredAssembly = null)

Parameters

preferredAssembly Assembly?

An optional plugin assembly whose registrations should receive resolution priority.

Returns

IServiceProvider

A composite root service provider.

GetService<TService>()

Resolves an optional service from the composite provider associated with its assembly.

TService? GetService<TService>()

Returns

TService?

The resolved service, or null when no registration can supply it.

Type Parameters

TService

The service type to resolve.

IsInPlayerScope(IPlayer, object)

Determines whether a service instance belongs to a player’s active scope.

bool IsInPlayerScope(IPlayer player, object service)

Parameters

player IPlayer

The player whose scope is inspected.

service object

The service instance to locate by reference identity.

Returns

bool

true when the exact instance is present in the player’s scope; otherwise, false.

Register(Action<ServiceCollection>, bool)

Adds service registrations for a plugin assembly and optionally activates non-transient services immediately.

void Register(Action<ServiceCollection> configure, bool activate = true)

Parameters

configure Action<ServiceCollection>

A callback that adds descriptors to a temporary service collection.

activate bool

true to resolve singleton services and existing-player scoped services immediately; otherwise, false.

TryGetServiceReuse(Type, out ServiceLifetime)

Attempts to determine the registered lifetime of a service type.

bool TryGetServiceReuse(Type serviceType, out ServiceLifetime reuse)

Parameters

serviceType Type

The service type to inspect.

reuse ServiceLifetime

When this method returns, the mapped service lifetime; unregistered services produce .

Returns

bool

true when the service has a registration; otherwise, false.