MetalamaAPI documentationExtensions APIMetalama.​Extensions.​Dependency­Injection.​ImplementationDefault­Dependency­Injection­Strategy
Open sandboxFocus

DefaultDependencyInjectionStrategy Class

The default implementation of the TryIntroduceDependency(DependencyProperties, IAspectBuilder<INamedType>, out IFieldOrProperty) interface method. It is designed to be easily extended and overwritten.

Inheritance
System.Object
DefaultDependencyInjectionStrategy
Namespace: Metalama.Extensions.DependencyInjection.Implementation
Assembly: Metalama.Extensions.DependencyInjection.dll
Syntax
[CompileTime]
public class DefaultDependencyInjectionStrategy : Object

Constructors

Name Description
DefaultDependencyInjectionStrategy(DependencyProperties)

Initializes a new instance of the DefaultDependencyInjectionStrategy class.

Properties

Name Description
Properties

Gets the DependencyProperties for which the current object was created.

Methods

Name Description
GetPullStrategy(IFieldOrProperty)

Gets an IPullStrategy, i.e. a strategy to pull a dependency field or property from constructors.

TryImplementDependency(IAspectBuilder<IFieldOrProperty>)
TryIntroduceDependency(IAspectBuilder<INamedType>, out IFieldOrProperty)

The entry point of the DefaultDependencyInjectionStrategy. Orchestrates all steps: first calls Metalama.Extensions.DependencyInjection.Implementation.DefaultDependencyInjectionStrategy.TryIntroduceFieldOrProperty(Metalama.Framework.Aspects.IAspectBuilder{Metalama.Framework.Code.INamedType},Metalama.Framework.Code.IFieldOrProperty@,System.Boolean@), then GetPullStrategy(IFieldOrProperty), then TryPullDependency(IAspectBuilder<INamedType>, IFieldOrProperty, IPullStrategy).

TryPullDependency(IAspectBuilder<INamedType>, IFieldOrProperty, IPullStrategy)

Pulls the dependency from all constructors, i.e. introduce a parameter to these constructors (according to an IPullStrategy), and assigns its value to the dependency property.

TryPullDependency(IAspectBuilder<INamedType>, IFieldOrProperty, IPullStrategy, IConstructor)

Pulls the dependency from a given constructor.