本文整理汇总了C#中ICompositionElement类的典型用法代码示例。如果您正苦于以下问题:C# ICompositionElement类的具体用法?C# ICompositionElement怎么用?C# ICompositionElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICompositionElement类属于命名空间,在下文中一共展示了ICompositionElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: FromICompositionElement
public static ICompositionElement FromICompositionElement(ICompositionElement element)
{
if (element == null)
{ // Null is always serializable
return null;
}
ICompositionElement origin = FromICompositionElement(element.Origin);
// Otherwise, we need to create a serializable wrapper
return new SerializableCompositionElement(element.DisplayName, origin);
}
开发者ID:grothag,项目名称:pocketmef,代码行数:13,代码来源:SerializableCompositionElement.cs
示例17: CreateReflectionPartDefinition
private ReflectionComposablePartDefinition CreateReflectionPartDefinition(
Lazy<Type> partType,
bool requiresDisposal,
Func<IEnumerable<ImportDefinition>> imports,
Func<IEnumerable<ExportDefinition>>exports,
IDictionary<string, object> metadata,
ICompositionElement origin)
{
return (ReflectionComposablePartDefinition)ReflectionModelServices.CreatePartDefinition(partType, requiresDisposal,
new Lazy<IEnumerable<ImportDefinition>>(imports, false),
new Lazy<IEnumerable<ExportDefinition>>(exports, false),
metadata.AsLazy(), origin);
}
开发者ID:JackFong,项目名称:FreeRadical,代码行数:13,代码来源:ReflectionComposablePartDefinitionTests.cs
示例18: ReflectionImportDefinition
public ReflectionImportDefinition(
string contractName,
string requiredTypeIdentity,
IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
ImportCardinality cardinality,
bool isRecomposable,
bool isPrerequisite,
CreationPolicy requiredCreationPolicy,
ICompositionElement origin)
: base(contractName, requiredTypeIdentity, requiredMetadata, cardinality, isRecomposable, isPrerequisite, requiredCreationPolicy)
{
this._origin = origin;
}
开发者ID:Ginichen,项目名称:Silverlight-Player-for-PlayReady-with-Token-Auth,代码行数:13,代码来源:ReflectionImportDefinition.cs
示例19: CreateExportDefinition
public static ExportDefinition CreateExportDefinition(
LazyMemberInfo exportingMember,
string contractName,
Lazy<IDictionary<string, object>> metadata,
ICompositionElement origin)
{
Requires.NotNullOrEmpty(contractName, "contractName");
Requires.IsInMembertypeSet(exportingMember.MemberType, "exportingMember", MemberTypes.Field | MemberTypes.Property | MemberTypes.NestedType | MemberTypes.TypeInfo | MemberTypes.Method);
return new ReflectionMemberExportDefinition(
exportingMember,
new LazyExportDefinition(contractName, metadata),
origin);
}
开发者ID:grothag,项目名称:pocketmef,代码行数:14,代码来源:ReflectionModelServices.cs
示例20: ReflectionParameterImportDefinition
public ReflectionParameterImportDefinition(
Lazy<ParameterInfo> importingLazyParameter,
string contractName,
string requiredTypeIdentity,
IEnumerable<KeyValuePair<string,Type>> requiredMetadata,
ImportCardinality cardinality,
CreationPolicy requiredCreationPolicy,
ICompositionElement origin)
: base(contractName, requiredTypeIdentity, requiredMetadata, cardinality, false, true, requiredCreationPolicy, origin)
{
Assumes.NotNull(importingLazyParameter);
this._importingLazyParameter = importingLazyParameter;
}
开发者ID:nlhepler,项目名称:mono,代码行数:14,代码来源:ReflectionParameterImportDefinition.cs
注:本文中的ICompositionElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论