ContractBasedImportDefinition Constructor (String, String, IEnumerable(KeyValuePair(String, Type)), ImportCardinality, Boolean, Boolean, CreationPolicy)

ContractBasedImportDefinition Constructor (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, a value that indicates if the import definition is recomposable, a value that indicates if the import definition is a prerequisite, and a value that indicates the required creation policy.

Namespace:  System.ComponentModel.Composition.Primitives
Assembly:  System.ComponentModel.Composition (in System.ComponentModel.Composition.dll)

public ContractBasedImportDefinition(
	string contractName,
	string requiredTypeIdentity,
	IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
	ImportCardinality cardinality,
	bool isRecomposable,
	bool isPrerequisite,
	CreationPolicy requiredCreationPolicy
)

Parameters

contractName
Type: System.String
A string that contains the contract name of the Export object required by the ContractBasedImportDefinition.
requiredTypeIdentity
Type: System.String
The type identity of the export type expected. Use the GetTypeIdentity method to generate a type identity for a given type. If no specific type is required, use null.
requiredMetadata
Type: System.Collections.Generic.IEnumerable<KeyValuePair<String, Type>>
A collection of key/value pairs containing the metadata names and types required by the ContractBasedImportDefinition; or null to set the RequiredMetadata property to an empty IEnumerable<T> collection.
cardinality
Type: System.ComponentModel.Composition.Primitives.ImportCardinality
One of the ImportCardinality values that indicates the cardinality of the Export objects required by the ContractBasedImportDefinition.
isRecomposable
Type: System.Boolean
true to specify that the ContractBasedImportDefinition can be satisfied multiple times throughout the lifetime of a ComposablePart; otherwise, false.
isPrerequisite
Type: System.Boolean
true to specify that the ContractBasedImportDefinition is required to be satisfied before a ComposablePart can start producing exported objects; otherwise, false.
requiredCreationPolicy
Type: System.ComponentModel.Composition.CreationPolicy
A value that indicates that the importer requires a specific CreationPolicy for the exports used to satisfy this import. If no specific CreationPolicy is needed, the default is Any.

ExceptionCondition
ArgumentNullException

contractName is null.

ArgumentException

contractName is an empty string ("").

-or-

requiredMetadata contains an element that is null.

-or-

cardinality is not one of the ImportCardinality values.

Silverlight

Supported in: 5, 4

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2016 Microsoft