| File: System\ComponentModel\Composition\ReflectionModel\PartCreatorParameterImportDefinition.cs | Web Access |
| Project: src\runtime\src\libraries\System.ComponentModel.Composition\src\System.ComponentModel.Composition.csproj (System.ComponentModel.Composition) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel.Composition.Hosting; using System.ComponentModel.Composition.Primitives; using System.Linq.Expressions; using System.Reflection; using System.Text; namespace System.ComponentModel.Composition.ReflectionModel { internal sealed class PartCreatorParameterImportDefinition : ReflectionParameterImportDefinition, IPartCreatorImportDefinition { private readonly ContractBasedImportDefinition _productImportDefinition; public PartCreatorParameterImportDefinition( Lazy<ParameterInfo> importingLazyParameter, ICompositionElement? origin, ContractBasedImportDefinition productImportDefinition) : base(importingLazyParameter, CompositionConstants.PartCreatorContractName, CompositionConstants.PartCreatorTypeIdentity, productImportDefinition.RequiredMetadata, productImportDefinition.Cardinality, CreationPolicy.Any, MetadataServices.EmptyMetadata, origin) { ArgumentNullException.ThrowIfNull(productImportDefinition); _productImportDefinition = productImportDefinition; } public ContractBasedImportDefinition ProductImportDefinition { get { return _productImportDefinition; } } public override bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition) { if (!base.IsConstraintSatisfiedBy(exportDefinition)) { return false; } return PartCreatorExportDefinition.IsProductConstraintSatisfiedBy(_productImportDefinition, exportDefinition); } public override Expression<Func<ExportDefinition, bool>> Constraint { get { return ConstraintServices.CreatePartCreatorConstraint(base.Constraint, _productImportDefinition); } } public override string ToString() { return "\n\tExportFactory of: " + ProductImportDefinition.ToString(); } } }