編輯

共用方式為


ContractBasedImportDefinition Constructors

Definition

Initializes a new instance of the ContractBasedImportDefinition class.

Overloads

ContractBasedImportDefinition()

Initializes a new instance of the ContractBasedImportDefinition class.

ContractBasedImportDefinition(String, String, IEnumerable<KeyValuePair<String,Type>>, ImportCardinality, Boolean, Boolean, CreationPolicy)

Initializes a new instance of the ContractBasedImportDefinition class with the specified contract name, required type identity, required metadata, cardinality, and creation policy, and indicates whether the import definition is recomposable or a prerequisite.

ContractBasedImportDefinition(String, String, IEnumerable<KeyValuePair<String, Type>>, ImportCardinality, Boolean, Boolean, CreationPolicy, IDictionary<String, Object>)

Initializes a new instance of the ContractBasedImportDefinition class with the specified contract name, required type identity, required and optional metadata, cardinality, and creation policy, and indicates whether the import definition is recomposable or a prerequisite.

ContractBasedImportDefinition()

Source:
ContractBasedImportDefinition.cs
Source:
ContractBasedImportDefinition.cs
Source:
ContractBasedImportDefinition.cs

Initializes a new instance of the ContractBasedImportDefinition class.

protected:
 ContractBasedImportDefinition();
protected ContractBasedImportDefinition ();
Protected Sub New ()

Remarks

Note to inheritors

Derived types calling this constructor can optionally override the ContractName, RequiredTypeIdentity, RequiredMetadata, Cardinality, IsPrerequisite, IsRecomposable, and RequiredCreationPolicy properties.

Applies to

ContractBasedImportDefinition(String, String, IEnumerable<KeyValuePair<String,Type>>, ImportCardinality, Boolean, Boolean, CreationPolicy)

Source:
ContractBasedImportDefinition.cs
Source:
ContractBasedImportDefinition.cs
Source:
ContractBasedImportDefinition.cs

Initializes a new instance of the ContractBasedImportDefinition class with the specified contract name, required type identity, required metadata, cardinality, and creation policy, and indicates whether the import definition is recomposable or a prerequisite.

public:
 ContractBasedImportDefinition(System::String ^ contractName, System::String ^ requiredTypeIdentity, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, Type ^>> ^ requiredMetadata, System::ComponentModel::Composition::Primitives::ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System::ComponentModel::Composition::CreationPolicy requiredCreationPolicy);
public ContractBasedImportDefinition (string contractName, string? requiredTypeIdentity, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>>? requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy);
public ContractBasedImportDefinition (string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy);
new System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition : string * string * seq<System.Collections.Generic.KeyValuePair<string, Type>> * System.ComponentModel.Composition.Primitives.ImportCardinality * bool * bool * System.ComponentModel.Composition.CreationPolicy -> System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition
Public Sub New (contractName As String, requiredTypeIdentity As String, requiredMetadata As IEnumerable(Of KeyValuePair(Of String, Type)), cardinality As ImportCardinality, isRecomposable As Boolean, isPrerequisite As Boolean, requiredCreationPolicy As CreationPolicy)

Parameters

contractName
String

The contract name of the Export object required by the import definition.

requiredTypeIdentity
String

The type identity of the export type expected. Use the GetTypeIdentity(Type) method to generate a type identity for a given type. If no specific type is required, use null.

requiredMetadata
IEnumerable<KeyValuePair<String,Type>>

A collection of key/value pairs that contain the metadata names and types required by the import definition; or null to set the RequiredMetadata property to an empty IEnumerable<T> collection.

cardinality
ImportCardinality

One of the enumeration values that indicates the cardinality of the Export objects required by the import definition.

isRecomposable
Boolean

true to specify that the import definition can be satisfied multiple times throughout the lifetime of a ComposablePart; otherwise, false.

isPrerequisite
Boolean

true to specify that the import definition is required to be satisfied before a ComposablePart can start producing exported objects; otherwise, false.

requiredCreationPolicy
CreationPolicy

A value that indicates that the importer requires a specific creation policy for the exports used to satisfy this import. If no specific creation policy is needed, the default is Any.

Exceptions

contractName is null.

contractName is an empty string ("").

-or-

requiredMetadata contains an element that is null.

-or-

cardinality is not one of the ImportCardinality values.

Applies to

ContractBasedImportDefinition(String, String, IEnumerable<KeyValuePair<String, Type>>, ImportCardinality, Boolean, Boolean, CreationPolicy, IDictionary<String, Object>)

Source:
ContractBasedImportDefinition.cs
Source:
ContractBasedImportDefinition.cs
Source:
ContractBasedImportDefinition.cs

Initializes a new instance of the ContractBasedImportDefinition class with the specified contract name, required type identity, required and optional metadata, cardinality, and creation policy, and indicates whether the import definition is recomposable or a prerequisite.

public:
 ContractBasedImportDefinition(System::String ^ contractName, System::String ^ requiredTypeIdentity, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, Type ^>> ^ requiredMetadata, System::ComponentModel::Composition::Primitives::ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System::ComponentModel::Composition::CreationPolicy requiredCreationPolicy, System::Collections::Generic::IDictionary<System::String ^, System::Object ^> ^ metadata);
public ContractBasedImportDefinition (string contractName, string? requiredTypeIdentity, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>>? requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.Collections.Generic.IDictionary<string,object?> metadata);
public ContractBasedImportDefinition (string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.Collections.Generic.IDictionary<string,object> metadata);
new System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition : string * string * seq<System.Collections.Generic.KeyValuePair<string, Type>> * System.ComponentModel.Composition.Primitives.ImportCardinality * bool * bool * System.ComponentModel.Composition.CreationPolicy * System.Collections.Generic.IDictionary<string, obj> -> System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition
Public Sub New (contractName As String, requiredTypeIdentity As String, requiredMetadata As IEnumerable(Of KeyValuePair(Of String, Type)), cardinality As ImportCardinality, isRecomposable As Boolean, isPrerequisite As Boolean, requiredCreationPolicy As CreationPolicy, metadata As IDictionary(Of String, Object))

Parameters

contractName
String

The contract name of the Export object required by the import definition.

requiredTypeIdentity
String

The type identity of the export type expected. Use the GetTypeIdentity(Type) method to generate a type identity for a given type. If no specific type is required, use null.

requiredMetadata
IEnumerable<KeyValuePair<String,Type>>

A collection of key/value pairs that contain the metadata names and types required by the import definition; or null to set the RequiredMetadata property to an empty IEnumerable<T> collection.

cardinality
ImportCardinality

One of the enumeration values that indicates the cardinality of the Export objects required by the import definition.

isRecomposable
Boolean

true to specify that the import definition can be satisfied multiple times throughout the lifetime of a ComposablePart; otherwise, false.

isPrerequisite
Boolean

true to specify that the import definition is required to be satisfied before a ComposablePart can start producing exported objects; otherwise, false.

requiredCreationPolicy
CreationPolicy

A value that indicates that the importer requires a specific creation policy for the exports used to satisfy this import. If no specific creation policy is needed, the default is Any.

metadata
IDictionary<String,Object>

The metadata associated with this import.

Exceptions

contractName is null.

contractName is an empty string ("").

-or-

requiredMetadata contains an element that is null.

-or-

cardinality is not one of the ImportCardinality values.

Applies to