Bagikan melalui


CustomFactoryAttribute 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.

Specifies what type to use to build instances of the type this attribute is bound to. This class cannot be inherited.

Namespace:  Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder
Assembly:  Microsoft.Practices.EnterpriseLibrary.Common (in Microsoft.Practices.EnterpriseLibrary.Common.dll)

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Interface, AllowMultiple := False,  _
    Inherited := False)> _
PublicNotInheritableClassCustomFactoryAttribute _
    Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = false, 
    Inherited = false)]
publicsealedclassCustomFactoryAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Interface, AllowMultiple = false, 
    Inherited = false)]
publicref classCustomFactoryAttributesealed : public Attribute
publicfinalclass CustomFactoryAttribute extends Attribute

Remarks

This attribute is used when building objects through ObjectBuilder. The ConfiguredObjectStrategy will query the requested type for this attribute, and will use an instance of the specified factory type to build the requested instance. The specified type must implement the ICustomFactory interface. The attribute needs to be bound only to the types that will be requested to ObjectBuilder; it is not necessary to bind the attribute to subclasses or implementations of interfaces.

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.CustomFactoryAttribute

See Also

CustomFactoryAttribute Members

Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder Namespace

Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ICustomFactory

Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy

Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory

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.