本文整理汇总了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
}
示例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);
}
示例5: ApplicationCatalog
public ApplicationCatalog(ReflectionContext reflectionContext, ICompositionElement definitionOrigin)
{
Requires.NotNull(reflectionContext, "reflectionContext");
Requires.NotNull(definitionOrigin, "definitionOrigin");
this._reflectionContext = reflectionContext;
this._definitionOrigin = definitionOrigin;
}
示例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;
}
示例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;
}
示例8: ReflectionMemberExportDefinition
public ReflectionMemberExportDefinition(LazyMemberInfo member, ExportDefinition exportDefinition, ICompositionElement origin)
{
Assumes.NotNull(exportDefinition);
this._member = member;
this._exportDefinition = exportDefinition;
this._origin = origin;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}