MetalamaAPI documentationExtensions APIMetalama.​Extensions.​Dependency­InjectionDependency­Injection­ExtensionsTry­Introduce­Dependency
Open sandboxFocus

DependencyInjectionExtensions.TryIntroduceDependency Method

TryIntroduceDependency(IAspectBuilder, DependencyProperties, out IFieldOrProperty)

Tries to introduce a dependency into a specified type.

Declaration
public static bool TryIntroduceDependency(this IAspectBuilder aspectBuilder, DependencyProperties properties, out IFieldOrProperty dependencyFieldOrProperty)
Parameters
Type Name Description
IAspectBuilder aspectBuilder

An IAspectBuilder.

DependencyProperties properties

The properties of the dependency to introduce.

IFieldOrProperty dependencyFieldOrProperty

When the method succeeds, the field or dependency that represents the dependency.

Returns
Type Description
System.Boolean

true in case of success, otherwise false. When the field or property already exists, this method returns true and has no effect.