99 references to CreationPolicy
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
StubVsServiceExporter`1.cs (1)
16[PartCreationPolicy(CreationPolicy.NonShared)]
StubVsServiceExporter`2.cs (1)
23[PartCreationPolicy(CreationPolicy.NonShared)]
System.ComponentModel.Composition (92)
System\ComponentModel\Composition\AttributedModel\AttributedModelDiscovery.cs (2)
91CreationPolicy.NonShared, 128CreationPolicy.NonShared,
System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs (1)
174private CreationPolicy CreationPolicy
System\ComponentModel\Composition\ConstraintServices.cs (5)
23public static Expression<Func<ExportDefinition, bool>> CreateConstraint(string contractName, string? requiredTypeIdentity, IEnumerable<KeyValuePair<string, Type>> requiredMetadata, CreationPolicy requiredCreationPolicy) 45if (requiredCreationPolicy != CreationPolicy.Any) 84private static BinaryExpression CreateCreationPolicyConstraint(CreationPolicy policy, ParameterExpression parameter) 88if (policy == CreationPolicy.Any) 100CreateMetadataValueEqualsExpression(parameter, CreationPolicy.Any, CompositionConstants.PartCreationPolicyMetadataName)),
System\ComponentModel\Composition\CreationPolicy.cs (4)
13/// Let the <see cref="Hosting.CompositionContainer"/> choose the most appropriate <see cref="CreationPolicy"/> 14/// for the part given the current context. This is the default <see cref="CreationPolicy"/>, with 15/// the <see cref="Hosting.CompositionContainer"/> choosing <see cref="CreationPolicy.Shared"/> by default 16/// unless the <see cref="Primitives.ComposablePart"/> or importer requests <see cref="CreationPolicy.NonShared"/>.
System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogExport.cs (12)
63ComposablePartDefinition partDefinition, ExportDefinition definition, CreationPolicy importCreationPolicy) 65CreationPolicy partPolicy = partDefinition.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName); 78private static bool ShouldUseSharedPart(CreationPolicy partPolicy, CreationPolicy importPolicy) 88case CreationPolicy.Any: 90if (importPolicy == CreationPolicy.Any || 91importPolicy == CreationPolicy.Shared) 98case CreationPolicy.NonShared: 100if (importPolicy == CreationPolicy.Shared) 109if (partPolicy != CreationPolicy.Shared || importPolicy == CreationPolicy.NonShared)
System\ComponentModel\Composition\Hosting\CatalogExportProvider.cs (2)
327CreationPolicy importPolicy = definition.GetRequiredCreationPolicy(); 343private Export CreateExport(ComposablePartDefinition partDefinition, ExportDefinition exportDefinition, bool isExportFactory, CreationPolicy importPolicy)
System\ComponentModel\Composition\Hosting\CatalogExportProvider.ScopeFactoryExport.cs (1)
56Export? export = childContainer.CatalogExportProvider.CreateExport(_scopeFactoryExport.UnderlyingPartDefinition, _scopeFactoryExport.UnderlyingExportDefinition, false, CreationPolicy.Any);
System\ComponentModel\Composition\Hosting\CatalogExportProvider.ScopeManager.cs (3)
94case CreationPolicy.NonShared: 106CreationPolicy.Any, 110case CreationPolicy.Any:
System\ComponentModel\Composition\Hosting\CompositionContainer.cs (4)
384/// under a <see cref="CreationPolicy.NonShared" /> context. Release in this context means walking 387/// was constructed under a <see cref="CreationPolicy.Shared" /> context the 413/// under a <see cref="CreationPolicy.NonShared" /> context. Release in this context means walking 416/// was constructed under a <see cref="CreationPolicy.Shared" /> context the
System\ComponentModel\Composition\Hosting\CompositionServices.cs (4)
185internal static IDictionary<string, object?> GetPartMetadataForType(this Type type, CreationPolicy creationPolicy) 189if (creationPolicy != CreationPolicy.Any) 593internal static CreationPolicy GetRequiredCreationPolicy(this ImportDefinition definition) 600return CreationPolicy.Any;
System\ComponentModel\Composition\Hosting\ExportProvider.GetExportOverrides.cs (1)
809return new ContractBasedImportDefinition(contractName, requiredTypeIdentity, requiredMetadata, cardinality, false, true, CreationPolicy.Any, metadata);
System\ComponentModel\Composition\Hosting\ImportSourceImportDefinitionHelpers.cs (1)
108public override CreationPolicy RequiredCreationPolicy
System\ComponentModel\Composition\IAttributedImport.cs (1)
13CreationPolicy RequiredCreationPolicy { get; }
System\ComponentModel\Composition\ImportAttribute.cs (6)
152/// <see cref="CreationPolicy"/> for the exports used to satisfy this import. T 155/// <see cref="CreationPolicy.Any"/> - default value, used if the importer doesn't 156/// require a specific <see cref="CreationPolicy"/>. 158/// <see cref="CreationPolicy.Shared"/> - Requires that all exports used should be shared 161/// <see cref="CreationPolicy.NonShared"/> - Requires that all exports used should be 164public CreationPolicy RequiredCreationPolicy { get; set; }
System\ComponentModel\Composition\ImportManyAttribute.cs (6)
130/// <see cref="CreationPolicy"/> for the exports used to satisfy this import. T 133/// <see cref="CreationPolicy.Any"/> - default value, used if the importer doesn't 134/// require a specific <see cref="CreationPolicy"/>. 136/// <see cref="CreationPolicy.Shared"/> - Requires that all exports used should be shared 139/// <see cref="CreationPolicy.NonShared"/> - Requires that all exports used should be 142public CreationPolicy RequiredCreationPolicy { get; set; }
System\ComponentModel\Composition\PartCreationPolicyAttribute.cs (5)
12internal static readonly PartCreationPolicyAttribute Default = new PartCreationPolicyAttribute(CreationPolicy.Any); 13internal static readonly PartCreationPolicyAttribute Shared = new PartCreationPolicyAttribute(CreationPolicy.Shared); 18public PartCreationPolicyAttribute(CreationPolicy creationPolicy) 29/// <see cref="System.ComponentModel.Composition.CreationPolicy.Any"/>. 31public CreationPolicy CreationPolicy { get; }
System\ComponentModel\Composition\Primitives\ContractBasedImportDefinition.cs (21)
26private readonly CreationPolicy _requiredCreationPolicy = CreationPolicy.Any; 82/// A value indicating that the importer requires a specific <see cref="CreationPolicy"/> for 83/// the exports used to satisfy this import. If no specific <see cref="CreationPolicy"/> is needed 84/// pass the default <see cref="CreationPolicy.Any"/>. 102ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, CreationPolicy requiredCreationPolicy) 143/// A value indicating that the importer requires a specific <see cref="CreationPolicy"/> for 144/// the exports used to satisfy this import. If no specific <see cref="CreationPolicy"/> is needed 145/// pass the default <see cref="CreationPolicy.Any"/>. 164ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, CreationPolicy requiredCreationPolicy, IDictionary<string, object?> metadata) 238/// <see cref="CreationPolicy"/> for the exports used to satisfy this import. T 241/// <see cref="CreationPolicy.Any"/> - default value, used if the importer doesn't 242/// require a specific <see cref="CreationPolicy"/>. 244/// <see cref="CreationPolicy.Shared"/> - Requires that all exports used should be shared 247/// <see cref="CreationPolicy.NonShared"/> - Requires that all exports used should be 250public virtual CreationPolicy RequiredCreationPolicy 350if (RequiredCreationPolicy == CreationPolicy.Any) 355CreationPolicy exportPolicy = definition.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName); 356return exportPolicy == CreationPolicy.Any || 366if (_requiredCreationPolicy != CreationPolicy.Any)
System\ComponentModel\Composition\ReflectionModel\GenericSpecializationPartCreationInfo.cs (2)
314CreationPolicy.NonShared, 357CreationPolicy.NonShared,
System\ComponentModel\Composition\ReflectionModel\PartCreatorParameterImportDefinition.cs (1)
21productImportDefinition.RequiredMetadata, productImportDefinition.Cardinality, CreationPolicy.Any, MetadataServices.EmptyMetadata, origin)
System\ComponentModel\Composition\ReflectionModel\ReflectionImportDefinition.cs (1)
20CreationPolicy requiredCreationPolicy,
System\ComponentModel\Composition\ReflectionModel\ReflectionMemberImportDefinition.cs (1)
22CreationPolicy requiredCreationPolicy,
System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs (7)
168CreationPolicy requiredCreationPolicy, 181CreationPolicy requiredCreationPolicy, 208CreationPolicy requiredCreationPolicy, 228CreationPolicy.NonShared, 253CreationPolicy requiredCreationPolicy, 265CreationPolicy requiredCreationPolicy, 285CreationPolicy.NonShared,
System\ComponentModel\Composition\ReflectionModel\ReflectionParameterImportDefinition.cs (1)
22CreationPolicy requiredCreationPolicy,
System.ComponentModel.Composition.Registration (5)
System\ComponentModel\Composition\Registration\ImportBuilder.cs (2)
18private CreationPolicy _requiredCreationPolicy; 59public ImportBuilder RequiredCreationPolicy(CreationPolicy requiredCreationPolicy)
System\ComponentModel\Composition\Registration\PartBuilder.cs (3)
17private CreationPolicy _creationPolicy; 38_creationPolicy = CreationPolicy.Any; 206public PartBuilder SetCreationPolicy(CreationPolicy creationPolicy)