DependencyAttribute Class

This attribute is used to mark properties and parameters as targets for injection.

Namespace:  Microsoft.Practices.Unity
Assembly:  Microsoft.Practices.Unity (in Microsoft.Practices.Unity.dll)

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Parameter, AllowMultiple := False,  _
    Inherited := True)> _
Public NotInheritable Class DependencyAttribute _
    Inherits DependencyResolutionAttribute
[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Parameter, AllowMultiple = false, 
    Inherited = true)]
public sealed class DependencyAttribute : DependencyResolutionAttribute
[AttributeUsageAttribute(AttributeTargets::Property|AttributeTargets::Parameter, AllowMultiple = false, 
    Inherited = true)]
public ref class DependencyAttribute sealed : public DependencyResolutionAttribute
public final class DependencyAttribute extends DependencyResolutionAttribute

Remarks

For properties, this attribute is necessary for injection to happen. For parameters, it's not needed unless you want to specify additional information to control how the parameter is resolved.

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.Practices.Unity.DependencyResolutionAttribute
      Microsoft.Practices.Unity.DependencyAttribute

See Also

DependencyAttribute Members

Microsoft.Practices.Unity Namespace