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


C# ICompositionElement类代码示例

本文整理汇总了C#中ICompositionElement的典型用法代码示例。如果您正苦于以下问题:C# ICompositionElement类的具体用法?C# ICompositionElement怎么用?C# ICompositionElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TypeCatalog

        internal TypeCatalog(IEnumerable<Type> types, ICompositionElement definitionOrigin)
        {
            Requires.NotNull(types, "types");

            foreach (Type type in types)
            {
                if (type == null)
                {
                    throw ExceptionBuilder.CreateContainsNullElement("types");
                }
#if !SILVERLIGHT
                if (type.Assembly.ReflectionOnly)
                {
                    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.Argument_ElementReflectionOnlyType, "types"), "types");
                }
#endif
            }

            this._types = types.ToArray();
            this._definitionOrigin = definitionOrigin ?? this;
#if !SILVERLIGHT
            this._contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(this.CreateIndex, true);
#else
            this._contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(this.CreateIndex);
#endif

        }
开发者ID:ibratoev,项目名称:MEF.NET35,代码行数:27,代码来源:TypeCatalog.cs

示例2: CreateParameterImportDefinition

        public static ReflectionParameterImportDefinition CreateParameterImportDefinition(ParameterInfo parameter, ICompositionElement origin)
        {
            Requires.NotNull(parameter, "parameter");

            ReflectionParameter reflectionParameter = parameter.ToReflectionParameter();
            IAttributedImport attributedImport = AttributedModelDiscovery.GetAttributedImport(reflectionParameter, parameter);
            ImportType importType = new ImportType(reflectionParameter.ReturnType, attributedImport.Cardinality);

            if (importType.IsPartCreator)
            {
                return new PartCreatorParameterImportDefinition(
                    new Lazy<ParameterInfo>(() => parameter),
                    origin,
                    new ContractBasedImportDefinition(
                        attributedImport.GetContractNameFromImport(importType),
                        attributedImport.GetTypeIdentityFromImport(importType),
                        CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
                        attributedImport.Cardinality,
                        false,
                        true,
                        CreationPolicy.NonShared));
            }
            else
            {
                return new ReflectionParameterImportDefinition(
                    new Lazy<ParameterInfo>(() => parameter),
                    attributedImport.GetContractNameFromImport(importType),
                    attributedImport.GetTypeIdentityFromImport(importType),
                    CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
                    attributedImport.Cardinality,
                    attributedImport.RequiredCreationPolicy,
                    origin);
            }
        }
开发者ID:Ginichen,项目名称:Silverlight-Player-for-PlayReady-with-Token-Auth,代码行数:34,代码来源:AttributedModelDiscovery.cs

示例3: CreateMemberImportDefinition

        public static ReflectionMemberImportDefinition CreateMemberImportDefinition(MemberInfo member, ICompositionElement origin)
        {
            Requires.NotNull(member, "member");

            ReflectionWritableMember reflectionMember = member.ToReflectionWritableMember();
            IAttributedImport attributedImport = AttributedModelDiscovery.GetAttributedImport(reflectionMember, member);
            ImportType importType = new ImportType(reflectionMember.ReturnType, attributedImport.Cardinality);

            if (importType.IsPartCreator)
            {
                return new PartCreatorMemberImportDefinition(
                    new LazyMemberInfo(member),
                    origin,
                    new ContractBasedImportDefinition(
                        attributedImport.GetContractNameFromImport(importType),
                        attributedImport.GetTypeIdentityFromImport(importType),
                        CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
                        attributedImport.Cardinality,
                        attributedImport.AllowRecomposition,
                        false,
                        CreationPolicy.NonShared));
            }
            else
            {
                return new ReflectionMemberImportDefinition(
                    new LazyMemberInfo(member),
                    attributedImport.GetContractNameFromImport(importType),
                    attributedImport.GetTypeIdentityFromImport(importType),
                    CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
                    attributedImport.Cardinality,
                    attributedImport.AllowRecomposition,
                    attributedImport.RequiredCreationPolicy,
                    origin);
            }
        }
开发者ID:Ginichen,项目名称:Silverlight-Player-for-PlayReady-with-Token-Auth,代码行数:35,代码来源:AttributedModelDiscovery.cs

示例4: CreatePartDefinition

        public static ReflectionComposablePartDefinition CreatePartDefinition(Type type, PartCreationPolicyAttribute partCreationPolicy, bool ignoreConstructorImports, ICompositionElement origin)
        {
            Assumes.NotNull(type);

            AttributedPartCreationInfo creationInfo = new AttributedPartCreationInfo(type, partCreationPolicy, ignoreConstructorImports, origin);

            return new ReflectionComposablePartDefinition(creationInfo);
        }
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:AttributedModelDiscovery.cs

示例5: ApplicationCatalog

        public ApplicationCatalog(ReflectionContext reflectionContext, ICompositionElement definitionOrigin)
        {
            Requires.NotNull(reflectionContext, "reflectionContext");
            Requires.NotNull(definitionOrigin, "definitionOrigin");

            this._reflectionContext = reflectionContext;
            this._definitionOrigin = definitionOrigin;
        }
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:ApplicationCatalog.cs

示例6: SerializableCompositionElement

        public SerializableCompositionElement(string displayName, ICompositionElement origin)
        {
#if FEATURE_SERIALIZATION
            Assumes.IsTrue(origin == null || origin.GetType().IsSerializable);
#endif
            this._displayName = displayName ?? string.Empty;
            this._origin = origin;
        }
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:SerializableCompositionElement.cs

示例7: AttributedPartCreationInfo

 public AttributedPartCreationInfo(Type type, PartCreationPolicyAttribute partCreationPolicy, bool ignoreConstructorImports, ICompositionElement origin)
 {
     Assumes.NotNull(type);
     this._type = type;
     this._ignoreConstructorImports = ignoreConstructorImports;
     this._partCreationPolicy = partCreationPolicy;
     this._origin = origin;
 }
开发者ID:JackFong,项目名称:FreeRadical,代码行数:8,代码来源:AttributedPartCreationInfo.cs

示例8: ReflectionMemberExportDefinition

        public ReflectionMemberExportDefinition(LazyMemberInfo member, ExportDefinition exportDefinition, ICompositionElement origin)
        {
            Assumes.NotNull(exportDefinition);

            this._member = member;
            this._exportDefinition = exportDefinition;
            this._origin = origin;
        }
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:ReflectionMemberExportDefinition.cs

示例9: SerializableCompositionElement

 public SerializableCompositionElement(string displayName, ICompositionElement origin)
 {
     //#if !SILVERLIGHT
     //            Assumes.IsTrue(origin == null); // || origin.GetType().IsSerializable);
     //#endif
     this._displayName = displayName ?? string.Empty;
     this._origin = origin;
 }
开发者ID:grothag,项目名称:pocketmef,代码行数:8,代码来源:SerializableCompositionElement.cs

示例10: DisposableWrapperPartDefinition

		public DisposableWrapperPartDefinition(ComposablePartDefinition innerPartDefinition, bool isNonSharedDisposable)
		{
			if (innerPartDefinition == null)
				throw new ArgumentNullException(nameof(innerPartDefinition));

			InnerPartDefinition = innerPartDefinition;

			_isNonSharedDisposable = isNonSharedDisposable;
			_compositionOrigin = innerPartDefinition as ICompositionElement;
		}
开发者ID:polewskm,项目名称:NCode.Composition.DisposableParts,代码行数:10,代码来源:DisposableWrapperPartDefinition.cs

示例11: PartCreatorMemberImportDefinition

 public PartCreatorMemberImportDefinition(
     LazyMemberInfo importingLazyMember,
     ICompositionElement origin,
     ContractBasedImportDefinition productImportDefinition)
     : base(importingLazyMember, CompositionConstants.PartCreatorContractName, CompositionConstants.PartCreatorTypeIdentity,
         productImportDefinition.RequiredMetadata, productImportDefinition.Cardinality, productImportDefinition.IsRecomposable, CreationPolicy.Any, origin)
 {
     Assumes.NotNull(productImportDefinition);
     this._productImportDefinition = productImportDefinition;
 }
开发者ID:Ginichen,项目名称:Silverlight-Player-for-PlayReady-with-Token-Auth,代码行数:10,代码来源:PartCreatorMemberImportDefinition.cs

示例12: CreatePartDefinitionIfDiscoverable

        public static ComposablePartDefinition CreatePartDefinitionIfDiscoverable(Type type, ICompositionElement origin)
        {
            AttributedPartCreationInfo creationInfo = new AttributedPartCreationInfo(type, null, false, origin);
            if (!creationInfo.IsPartDiscoverable())
            {
                return null;
            }

            return new ReflectionComposablePartDefinition(creationInfo);
        }
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:AttributedModelDiscovery.cs

示例13: AreEqual

        public static void AreEqual(ICompositionElement expected, ICompositionElement actual)
        {
            if (expected == null || actual == null)
            {
                Assert.AreEqual(expected, actual);
                return;
            }

            Assert.AreEqual(expected.DisplayName, actual.DisplayName);
            ElementAssert.AreEqual(expected.Origin, actual.Origin);
        }
开发者ID:JackFong,项目名称:FreeRadical,代码行数:11,代码来源:ElementAssert.cs

示例14: CreateImportDefinition

 public static ContractBasedImportDefinition CreateImportDefinition(
     Lazy<ParameterInfo> parameter,
     string contractName,
     string requiredTypeIdentity,
     IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
     ImportCardinality cardinality,
     CreationPolicy requiredCreationPolicy,
     bool isExportFactory,
     ICompositionElement origin)
 {
     return ReflectionModelServices.CreateImportDefinition(parameter, contractName, requiredTypeIdentity, requiredMetadata, cardinality, requiredCreationPolicy, isExportFactory, origin);
 }
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:ReflectionModelServicesEx.cs

示例15: CreateImportDefinition

 public static ContractBasedImportDefinition CreateImportDefinition(
     LazyMemberInfo importingMember,
     string contractName,
     string requiredTypeIdentity,
     IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
     ImportCardinality cardinality,
     bool isRecomposable,
     CreationPolicy requiredCreationPolicy,
     ICompositionElement origin)
 {
     return CreateImportDefinition(importingMember, contractName, requiredTypeIdentity, requiredMetadata, cardinality, isRecomposable, requiredCreationPolicy, false, origin);
 }
开发者ID:grothag,项目名称:pocketmef,代码行数:12,代码来源:ReflectionModelServices.cs


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