Skip to content

FromServicesAttribute

Forces a parameter to resolve from dependency injection services.

[AttributeUsage(AttributeTargets.Parameter)]
public sealed class FromServicesAttribute : Attribute

Creates an attribute that resolves from the default service registration.

public FromServicesAttribute()

Creates an attribute that resolves from a keyed service registration.

public FromServicesAttribute(string key)

Gets the optional keyed service identifier.

public string? Key { get; }

string