Skip to content

KeyedServiceRegistrationAttribute Constructors

ClassConstructors1 member
Attribute used to define the keyed service registration of a given type. Behaves the same as ServiceRegistrationAttribute except the resulting registration is a keyed service.
Constructor(object?, ServiceLifetime, Type[])Section titled Constructor(object?, ServiceLifetime, Type[])
Attribute used to define the keyed service registration of a given type. Behaves the same as ServiceRegistrationAttribute except the resulting registration is a keyed service.
public sealed class KeyedServiceRegistrationAttribute
{
public KeyedServiceRegistrationAttribute(
object? key,
ServiceLifetime lifetime,
params Type[] serviceTypes)
{
// ...
}
}
keyobject?
lifetimeServiceLifetime
serviceTypesType[]
Constructor to specify the key, service type including optional runtime