Table of Contents

Class DependencyServiceAttribute

Namespace
JobFlow.Core.Infrastructure.Configuration.Attributes
Assembly
JobFlow.Core.dll

Indicate a class is a dependency injection component service.

public class DependencyServiceAttribute : Attribute
Inheritance
DependencyServiceAttribute
Derived
Extension Methods

Remarks

All classes with this attribute are automatically added to the dependency injection container when the assembly is added to the TypeScanner. This is generally accomplished by called one of the AddDependencyAssembly overloads on BaseJobFlowConfigurationBuilder (see JobFlowConfigurationBuilderExtensions for information about the overloads).

Constructors

DependencyServiceAttribute(ManagerLifetime)

public DependencyServiceAttribute(ManagerLifetime lifetime)

Parameters

lifetime ManagerLifetime

Properties

AsSelf

Include the class itself as a service implementation.

public bool AsSelf { get; set; }

Property Value

bool

Remarks

For example, when adding a scoped service, this would be similar to the following:

services.AddScoped<MyService>()

or, to be more explicit:

services.AddScoped<MyService, MyService>()

IncludeInterfaces

Whether to include the classes interfaces as service types.

public bool IncludeInterfaces { get; set; }

Property Value

bool

Remarks

This defaults to true and would be similar to the following, assuming the current class implements IMyService:

services.AddScoped<MyService, IMyService>()

Lifetime

Indicate service lifetime.

public ManagerLifetime Lifetime { get; }

Property Value

ManagerLifetime