当前位置: 首页>>代码示例>>C#>>正文


C# CompositionContract.Equals方法代码示例

本文整理汇总了C#中CompositionContract.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# CompositionContract.Equals方法的具体用法?C# CompositionContract.Equals怎么用?C# CompositionContract.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CompositionContract的用法示例。


在下文中一共展示了CompositionContract.Equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetExportDescriptors

            public override IEnumerable<ExportDescriptorPromise> GetExportDescriptors(CompositionContract contract, DependencyAccessor descriptorAccessor)
            {
                if (!contract.Equals(_supportedContract))
                    return NoExportDescriptors;

                var implementations = descriptorAccessor.ResolveDependencies("test for existing", contract, false);
                if (implementations.Any())
                    return NoExportDescriptors;

                return new[] { new ExportDescriptorPromise(contract, "test metadataProvider", false, NoDependencies, _ => ExportDescriptor.Create((c, o) => DefaultObject, NoMetadata)) };
            }
开发者ID:ChuangYang,项目名称:corefx,代码行数:11,代码来源:ExportDescriptorProviderTests.cs

示例2: GetExportDescriptors

        public override IEnumerable<ExportDescriptorPromise> GetExportDescriptors(CompositionContract contract, DependencyAccessor definitionAccessor)
        {
            if (!contract.Equals(s_currentScopeContract))
                return NoExportDescriptors;

            return new[] { new ExportDescriptorPromise(
                contract,
                typeof(CompositionContext).Name,
                true,
                NoDependencies,
                _ => ExportDescriptor.Create((c, o) => c, NoMetadata)) };
        }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:12,代码来源:CurrentScopeExportDescriptorProvider.cs

示例3: IsSupportedContract

        protected bool IsSupportedContract(CompositionContract contract)
        {
            if (contract.ContractType != contractType || contract.ContractName != contractName)
                return false;

            if (contract.MetadataConstraints != null) {
                var subsetOfConstraints = contract.MetadataConstraints.Where(c => metadata.ContainsKey(c.Key)).ToDictionary(c => c.Key, c => metadata[c.Key]);
                var constrainedSubset = new CompositionContract(contract.ContractType, contract.ContractName,
                    subsetOfConstraints.Count == 0 ? null : subsetOfConstraints);

                if (!contract.Equals(constrainedSubset))
                    return false;
            }

            return true;
        }
开发者ID:viciousviper,项目名称:PowerShellCloudProvider,代码行数:16,代码来源:SinglePartExportDescriptionProvider.cs

示例4: AContractWithConstraintIsNotEqualToAContractWithoutConstraint

 public void AContractWithConstraintIsNotEqualToAContractWithoutConstraint()
 {
     var first = new CompositionContract(typeof(string), null, new Dictionary<string, object> { { "A", 1 } });
     var second = new CompositionContract(typeof(string));
     Assert.False(first.Equals(second));
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:6,代码来源:ContractTests.cs

示例5: ConstraintsWithEquivalentKeysAndValuesAreEqual

 public void ConstraintsWithEquivalentKeysAndValuesAreEqual()
 {
     var mcd1 = new CompositionContract(s_defaultContractType, null, new Dictionary<string, object> { { "A", new[] { "B" } } });
     var mcd2 = new CompositionContract(s_defaultContractType, null, new Dictionary<string, object> { { "A", new[] { "B" } } });
     Assert.True(mcd1.Equals(mcd2));
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:6,代码来源:ContractTests.cs

示例6: DiscoverConstrainedParts

        // If the contract has metadata constraints, look for exports with matching metadata.
        private void DiscoverConstrainedParts(CompositionContract contract)
        {
            if (contract.MetadataConstraints != null)
            {
                var unconstrained = new CompositionContract(contract.ContractType, contract.ContractName);
                DiscoverGenericParts(unconstrained);

                ICollection<DiscoveredExport> forKey;
                if (_discoveredParts.TryGetValue(unconstrained, out forKey))
                {
                    foreach (var export in forKey)
                    {
                        var subsettedConstraints = contract.MetadataConstraints.Where(c => export.Metadata.ContainsKey(c.Key)).ToDictionary(c => c.Key, c => export.Metadata[c.Key]);
                        if (subsettedConstraints.Count != 0)
                        {
                            var constrainedSubset = new CompositionContract(unconstrained.ContractType, unconstrained.ContractName, subsettedConstraints);

                            if (constrainedSubset.Equals(contract))
                                AddDiscoveredExport(export, contract);
                        }
                    }
                }
            }
        }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:25,代码来源:TypedPartExportDescriptorProvider.cs


注:本文中的CompositionContract.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。