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

DependencyAttribute Class

Custom attribute that, when 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
System.Object
DependencyAttribute
Namespace: Metalama.Extensions.DependencyInjection
Assembly: Metalama.Extensions.DependencyInjection.dll
Syntax
public class DependencyAttribute : FieldOrPropertyAspect, IAspect<IFieldOrProperty>, IAspect, ICompileTimeSerializable, ITemplateProvider, IEligible<IFieldOrProperty>
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>)
ToProperties(IFieldOrProperty)