Freigeben über


ConstructorSelectorPolicy<TInjectionConstructorMarkerAttribute> Class

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Unity Application Block information can be found at the Unity Application Block site.

An implementation of IConstructorSelectorPolicy that chooses constructors based on these criteria: first, pick a constructor marked with the TInjectionConstructorMarkerAttribute attribute. If there isn't one, then choose the constructor with the longest parameter list. If that is ambiguous, then throw.

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

Syntax

'Declaration
Public Class ConstructorSelectorPolicy(Of TInjectionConstructorMarkerAttribute As Attribute) _
    Inherits ConstructorSelectorPolicyBase(Of TInjectionConstructorMarkerAttribute)
public class ConstructorSelectorPolicy<TInjectionConstructorMarkerAttribute> : ConstructorSelectorPolicyBase<TInjectionConstructorMarkerAttribute>
where TInjectionConstructorMarkerAttribute : Attribute
generic<typename TInjectionConstructorMarkerAttribute>
where TInjectionConstructorMarkerAttribute : Attribute
public ref class ConstructorSelectorPolicy : public ConstructorSelectorPolicyBase<TInjectionConstructorMarkerAttribute>
JScript does not support generic types or methods.

Type Parameters

  • TInjectionConstructorMarkerAttribute
    Attribute used to mark the constructor to call.

Exceptions

Exception Condition
System.InvalidOperationException Thrown when the constructor to choose is ambiguous.

Inheritance Hierarchy

System.Object
  Microsoft.Practices.ObjectBuilder2.ConstructorSelectorPolicyBase<TInjectionConstructorMarkerAttribute>
    Microsoft.Practices.ObjectBuilder2.ConstructorSelectorPolicy<TInjectionConstructorMarkerAttribute>

See Also

ConstructorSelectorPolicy<TInjectionConstructorMarkerAttribute> Members

Microsoft.Practices.ObjectBuilder2 Namespace