MetalamaAPI documentationExtensions APIMetalama.​Extensions.​Dependency­InjectionIntroduce­Dependency­Attribute
Open sandboxFocus

IntroduceDependencyAttribute Class

Custom attribute that, when be applied to a field or automatic property of an aspect, means that this field or property is a service dependency that introduced into the target type and handled by a dependency injection framework. Contrarily to DependencyAttribute that can be used in user code, this attribute can be used only in an aspect.

Inheritance
IntroduceDependencyAttribute
Implements
IAdviceAttribute
Namespace: Metalama.Extensions.DependencyInjection
Assembly: Metalama.Extensions.DependencyInjection.dll
Syntax
public class IntroduceDependencyAttribute : DeclarativeAdviceAttribute, IAdviceAttribute
Remarks

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

Constructors

Name Description
IntroduceDependencyAttribute()

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
BuildAdvice(IMemberOrNamedType, String, IAspectBuilder<IDeclaration>)
ToProperties(IFieldOrProperty, INamedType)