Metalama 1.0 / / Metalama Documentation / Extensions API / Metalama.​Extensions.​Dependency­Injection / Dependency­Attribute

Class DependencyAttribute

Custom attribute that, when be applied to a field or automatic property in user code, means that this field or property is a service dependency that must be pulled from the dependency injection framework. Contrarily to IntroduceDependencyAttribute that must be used in aspect code, this attribute must be used in user code.

Inheritance
DependencyAttribute
Namespace: Metalama.Extensions.DependencyInjection
Assembly: Metalama.Extensions.DependencyInjection.dll
Syntax
public class DependencyAttribute : FieldOrPropertyAspect, IAspect<IFieldOrProperty>, IAspect, ICompileTimeSerializable, IEligible<IFieldOrProperty>, IDependencyAttribute
Remarks

The implementation of this custom attribute depends on the selected dependency injection framework.

Constructors

Name Description
DependencyAttribute()

Properties

Name Description
IsLazy

Gets or sets a value indicating whether the dependency should be pulled from the container lazily, i.e. upon first use.

IsRequired

Gets or sets a value indicating whether the dependency is required.

Methods

Name Description
BuildAspect(IAspectBuilder<IFieldOrProperty>)

Explicit Interface Implementations

Name Description
IDependencyAttribute.GetIsLazy()

Gets the value of the IsLazy if it has been assigned, or null if it has not been assigned.

IDependencyAttribute.GetIsRequired()

Gets the value of the IsRequired if it has been assigned, or null if it has not been assigned.