Class RegisterServiceAttribute<TService>
When using the 'FastEndpoints.Generator' package, any concrete class can be decorated with this attribute to source generate extension methods
in the form of .RegisterServicesFrom{assembly-name}()
which can be used to automatically register services with a single call per assembly.
instead of multiple calls per each service you need registered in DI.
specify the service type with the TService
generic attribute argument. the service type would typically be an interface type.
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.Attributes.dll
Syntax
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public sealed class RegisterServiceAttribute<TService> : Attribute where TService : class
Type Parameters
Name | Description |
---|---|
TService | the type of the service you are registering. typically an interface type. |
Constructors
RegisterServiceAttribute(LifeTime)
mark a class for registration in DI using the 'FastEndpoints.Generator' package by specifying the service lifetime.
Declaration
public RegisterServiceAttribute(LifeTime serviceLifetime)
Parameters
Type | Name | Description |
---|---|---|
LifeTime | serviceLifetime | the service lifetime to use when registering in DI |