OptionalDependencyAttribute Class

An DependencyResolutionAttribute used to mark a dependency as optional - the container will try to resolve it, and return null if the resolution fails rather than throw.

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

Syntax

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

Inheritance Hierarchy

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

See Also

OptionalDependencyAttribute Members

Microsoft.Practices.Unity Namespace