The default implementation of the TryIntroduceDependency(DependencyProperties, IAspectBuilder<INamedType>, out IFieldOrProperty?) interface method. It is designed to be easily extended and overwritten.
Namespace: Metalama.Extensions.DependencyInjection.Implementation
Assembly: Metalama.Extensions.DependencyInjection.dll
Syntax
[CompileTime]
public class DefaultDependencyInjectionStrategy
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. |
SuppressNonNullableFieldMustContainValue(IAspectBuilder, IFieldOrProperty) | Suppresses the warning CS8618 ("Non-nullable variable must contain a non-null value when exiting constructor.") for a member that is being introduced, if necessary. This is useful for design-time diagnostics. |
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. |