Table of Contents

Interface IDependencyScope

Namespace
LfrlAnvil.Dependencies
Assembly
LfrlAnvil.Dependencies.dll

Represents a dependency scope.

public interface IDependencyScope : IDependencyScopeFactory
Inherited Members

Properties

Container

IDependencyContainer associated with this scope.

IDependencyContainer Container { get; }

Property Value

IDependencyContainer

IsDisposed

Specifies whether this scope has been disposed.

bool IsDisposed { get; }

Property Value

bool

IsRoot

Specifies whether this scope is a root scope.

[MemberNotNullWhen(false, "ParentScope")]
bool IsRoot { get; }

Property Value

bool

Level

Depth of this scope. Equal to 0 when this scope is a root scope.

int Level { get; }

Property Value

int

Locator

Non-keyed dependency locator associated with this scope.

IDependencyLocator Locator { get; }

Property Value

IDependencyLocator

Name

Optional name of this scope. If it is not null then this scope can be retrieved by invoking the GetScope(string) method.

string? Name { get; }

Property Value

string

OriginalThreadId

Specifies the CurrentManagedThreadId of the Thread that created this scope.

int OriginalThreadId { get; }

Property Value

int

ParentScope

Parent scope of this scope or null when this scope is a root scope.

IDependencyScope? ParentScope { get; }

Property Value

IDependencyScope

Methods

GetChildren()

Retrieves all child scopes created by this scope.

[Pure]
IDependencyScope[] GetChildren()

Returns

IDependencyScope[]

Collection of child scopes created by this scope.

GetKeyedLocator<TKey>(TKey)

Gets the keyed locator associated with this scope by its key.

[Pure]
IDependencyLocator<TKey> GetKeyedLocator<TKey>(TKey key) where TKey : notnull

Parameters

key TKey

Locator's key.

Returns

IDependencyLocator<TKey>

IDependencyLocator<TKey> instance associated with this scope and the provided key.

Type Parameters

TKey

Locator's key type.

GetTypeErasedKeyedLocator(object)

Gets the keyed locator associated with this scope by its key.

[Pure]
IDependencyLocator GetTypeErasedKeyedLocator(object key)

Parameters

key object

Locator's key.

Returns

IDependencyLocator

IDependencyLocator instance associated with this scope and the provided key.