The default implementation of the IntroduceDependency(DependencyProperties, IAdviser<INamedType>) 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. |
IntroduceDependency(IAdviser<INamedType>) | The entry point of the DefaultDependencyInjectionStrategy. Orchestrates all steps: first calls Metalama.Extensions.DependencyInjection.Implementation.DefaultDependencyInjectionStrategy.TryIntroduceFieldOrProperty(Metalama.Framework.Advising.IAdviser{Metalama.Framework.Code.INamedType},Metalama.Framework.Code.IFieldOrProperty@,Metalama.Framework.Advising.AdviceOutcome@), then GetPullStrategy(IFieldOrProperty), then TryPullDependency(IAdviser<INamedType>, IFieldOrProperty, IPullStrategy). |
SuppressNonNullableFieldMustContainValue(IAdviser, 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(IAdviser<IFieldOrProperty>) | |
TryPullDependency(IAdviser<IConstructor>, IFieldOrProperty, IPullStrategy) | Pulls the dependency from a given constructor. |
TryPullDependency(IAdviser<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. |