81 references to ImportCardinality
System.ComponentModel.Composition (81)
System\ComponentModel\Composition\AttributedModelServices.cs (2)
293public static bool Imports(this ComposablePartDefinition part, Type contractType, ImportCardinality importCardinality) 310public static bool Imports<T>(this ComposablePartDefinition part, ImportCardinality importCardinality)
System\ComponentModel\Composition\ExportServices.cs (2)
158private static ExportCardinalityCheckResult MatchCardinality(EnumerableCardinality actualCardinality, ImportCardinality importCardinality) 163if (importCardinality == ImportCardinality.ExactlyOne)
System\ComponentModel\Composition\Hosting\AggregateExportProvider.cs (1)
160if (definition.Cardinality == ImportCardinality.ZeroOrMore)
System\ComponentModel\Composition\Hosting\CompositionServices.cs (5)
605/// <see cref="ImportCardinality.ZeroOrOne"/> or 606/// <see cref="ImportCardinality.ExactlyOne"/>. 608internal static bool IsAtMostOne(this ImportCardinality cardinality) 610return cardinality == ImportCardinality.ZeroOrOne || cardinality == ImportCardinality.ExactlyOne;
System\ComponentModel\Composition\Hosting\ExportProvider.cs (12)
52/// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ExactlyOne"/> and 58/// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or 59/// <see cref="ImportCardinality.ExactlyOne"/> and there are more than one <see cref="Export"/> 86/// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ExactlyOne"/> and 92/// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or 93/// <see cref="ImportCardinality.ExactlyOne"/> and there are more than one <see cref="Export"/> 133/// <see cref="ImportCardinality.ZeroOrOne"/> or <see cref="ImportCardinality.ZeroOrMore"/> and 136/// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or 137/// <see cref="ImportCardinality.ExactlyOne"/> and there is exactly one <see cref="Export"/> 169/// if <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ExactlyOne"/> 221definition.Cardinality == ImportCardinality.ZeroOrOne)
System\ComponentModel\Composition\Hosting\ExportProvider.GetExportOverrides.cs (11)
263IEnumerable<Export> exports = GetExportsCore(type, metadataViewType, contractName, ImportCardinality.ZeroOrMore); 528return GetExportedValueCore<T>(contractName, ImportCardinality.ExactlyOne); 628return GetExportedValueCore<T>(contractName, ImportCardinality.ZeroOrOne); 713IEnumerable<Export> exports = GetExportsCore(typeof(T), (Type?)null, contractName, ImportCardinality.ZeroOrMore); 723private T? GetExportedValueCore<T>(string? contractName, ImportCardinality cardinality) 737IEnumerable<Export> exports = GetExportsCore(typeof(T), (Type?)null, contractName, ImportCardinality.ZeroOrMore); 749IEnumerable<Export> exports = GetExportsCore(typeof(T), typeof(TMetadataView), contractName, ImportCardinality.ZeroOrMore); 761Export? export = GetExportsCore(typeof(T), typeof(TMetadataView), contractName, ImportCardinality.ExactlyOne).SingleOrDefault(); 768Export? export = GetExportsCore(typeof(T), null, contractName, ImportCardinality.ExactlyOne).SingleOrDefault(); 773private IEnumerable<Export> GetExportsCore(Type type, Type? metadataViewType, string? contractName, ImportCardinality cardinality) 794private static ContractBasedImportDefinition BuildImportDefinition(Type type, Type metadataViewType, string contractName, ImportCardinality cardinality)
System\ComponentModel\Composition\Hosting\FilteredCatalog.Traversal.cs (2)
19return IncludeDependencies(i => i.Cardinality == ImportCardinality.ExactlyOne); 42return IncludeDependents(i => i.Cardinality == ImportCardinality.ExactlyOne);
System\ComponentModel\Composition\Hosting\ImportEngine.cs (1)
761return import.Cardinality == ImportCardinality.ExactlyOne;
System\ComponentModel\Composition\Hosting\ImportSourceImportDefinitionHelpers.cs (1)
63public override ImportCardinality Cardinality
System\ComponentModel\Composition\Hosting\ScopingExtensions.cs (1)
67public static bool Imports(this ComposablePartDefinition part, string contractName, ImportCardinality importCardinality)
System\ComponentModel\Composition\IAttributedImport.cs (1)
14ImportCardinality Cardinality { get; }
System\ComponentModel\Composition\ImportAttribute.cs (3)
182ImportCardinality IAttributedImport.Cardinality 188return ImportCardinality.ZeroOrOne; 190return ImportCardinality.ExactlyOne;
System\ComponentModel\Composition\ImportManyAttribute.cs (2)
160ImportCardinality IAttributedImport.Cardinality 162get { return ImportCardinality.ZeroOrMore; }
System\ComponentModel\Composition\Primitives\ComposablePart.cs (3)
188/// <see cref="ImportCardinality.ExactlyOne"/>. 193/// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or 194/// <see cref="ImportCardinality.ExactlyOne"/>.
System\ComponentModel\Composition\Primitives\ContractBasedImportDefinition.cs (6)
67/// One of the <see cref="ImportCardinality"/> values indicating the 98/// <paramref name="cardinality"/> is not one of the <see cref="ImportCardinality"/> 102ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, CreationPolicy requiredCreationPolicy) 128/// One of the <see cref="ImportCardinality"/> values indicating the 160/// <paramref name="cardinality"/> is not one of the <see cref="ImportCardinality"/> 164ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, CreationPolicy requiredCreationPolicy, IDictionary<string, object?> metadata)
System\ComponentModel\Composition\Primitives\ImportDefinition.cs (14)
20private readonly ImportCardinality _cardinality = ImportCardinality.ExactlyOne; 60/// One of the <see cref="ImportCardinality"/> values indicating the 78/// <paramref name="cardinality"/> is not one of the <see cref="ImportCardinality"/> 81public ImportDefinition(Expression<Func<ExportDefinition, bool>> constraint, string? contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite) 89public ImportDefinition(Expression<Func<ExportDefinition, bool>> constraint, string? contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, IDictionary<string, object?>? metadata) 97internal ImportDefinition(string? contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, IDictionary<string, object?>? metadata) 100(cardinality != ImportCardinality.ExactlyOne) && 101(cardinality != ImportCardinality.ZeroOrMore) && 102(cardinality != ImportCardinality.ZeroOrOne) 105throw new ArgumentException(SR.Format(SR.ArgumentOutOfRange_InvalidEnum, nameof(cardinality), cardinality, nameof(ImportCardinality)), nameof(cardinality)); 173/// One of the <see cref="ImportCardinality"/> values indicating the 176/// <see cref="ImportCardinality.ExactlyOne"/> 178public virtual ImportCardinality Cardinality
System\ComponentModel\Composition\ReflectionModel\ImportingItem.cs (1)
35if (Definition.Cardinality == ImportCardinality.ZeroOrMore)
System\ComponentModel\Composition\ReflectionModel\ImportingMember.cs (1)
41if (Definition.Cardinality != ImportCardinality.ZeroOrMore)
System\ComponentModel\Composition\ReflectionModel\ImportType.cs (2)
35public ImportType(Type type, ImportCardinality cardinality) 42if (cardinality == ImportCardinality.ZeroOrMore)
System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePart.cs (2)
322if (definition.Cardinality == ImportCardinality.ZeroOrMore && !import.ImportType.IsAssignableCollectionType) 488if (definition.Cardinality == ImportCardinality.ExactlyOne)
System\ComponentModel\Composition\ReflectionModel\ReflectionImportDefinition.cs (1)
17ImportCardinality cardinality,
System\ComponentModel\Composition\ReflectionModel\ReflectionMemberImportDefinition.cs (1)
19ImportCardinality cardinality,
System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs (5)
166ImportCardinality cardinality, 179ImportCardinality cardinality, 205ImportCardinality cardinality, 252ImportCardinality cardinality, 264ImportCardinality cardinality,
System\ComponentModel\Composition\ReflectionModel\ReflectionParameterImportDefinition.cs (1)
21ImportCardinality cardinality,