本文整理汇总了C#中System.ComponentModel.Composition.Primitives.ExportDefinition类的典型用法代码示例。如果您正苦于以下问题:C# ExportDefinition类的具体用法?C# ExportDefinition怎么用?C# ExportDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExportDefinition类属于System.ComponentModel.Composition.Primitives命名空间,在下文中一共展示了ExportDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CatalogExport
public CatalogExport(CatalogExportProvider catalogExportProvider,
ComposablePartDefinition partDefinition, ExportDefinition definition)
{
this._catalogExportProvider = catalogExportProvider;
this._partDefinition = partDefinition;
this._definition = definition;
}
开发者ID:JackFong,项目名称:FreeRadical,代码行数:7,代码来源:CatalogExportProvider.CatalogExport.cs
示例2: PartCreatorExport
public PartCreatorExport(CatalogExportProvider catalogExportProvider, ComposablePartDefinition partDefinition, ExportDefinition exportDefinition)
{
this._catalogExportProvider = catalogExportProvider;
this._partDefinition = partDefinition;
this._exportDefinition = exportDefinition;
this._partCreatorExportDefinition = new PartCreatorExportDefinition(this._exportDefinition);
}
开发者ID:grothag,项目名称:pocketmef,代码行数:7,代码来源:CatalogExportProvider.PartCreatorExport.cs
示例3: ExportingMember
public ExportingMember(ExportDefinition definition, ReflectionMember member)
{
Assumes.NotNull(definition, member);
this._definition = definition;
this._member = member;
}
开发者ID:Ginichen,项目名称:Silverlight-Player-for-PlayReady-with-Token-Auth,代码行数:7,代码来源:ExportingMember.cs
示例4: IsMatch
protected bool IsMatch(ExportDefinition exportDefinition)
{
// If the feature is not enabled don't allow it
if (exportDefinition.Metadata.ContainsKey("EnabledFeatures"))
{
if (!EnabledFeatures.IsEnabled((string)exportDefinition.Metadata["EnabledFeatures"]))
{
return false;
}
}
// If the feature is turned off in the options don't allow it
if (exportDefinition.Metadata.ContainsKey("FeatureEnabled"))
{
if (!OptionApi.GetBool((string)exportDefinition.Metadata["FeatureEnabled"]))
{
return false;
}
}
if (exportDefinition.Metadata.ContainsKey("SupportedApplication"))
{
var applicationType = ((ApplicationType)exportDefinition.Metadata["SupportedApplication"]);
return applicationType.HasFlag(_applicationType);
}
return false;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:28,代码来源:FilteredCatalog.cs
示例5: XElementExportProvider
/// <summary>
/// Initializes a new instance of the <see cref="XElementExportProvider"/> class.
/// Includes *.xml and *.config by default.
/// </summary>
/// <param name="path">The path. Defaults to Directory.GetCurrentDirectory()</param>
/// <param name="filters">A list of additional file filters to include.</param>
public XElementExportProvider(string path = null, IEnumerable<string> filters = null)
{
if (path == null)
{
path = Directory.GetCurrentDirectory();
}
List<string> include = new List<string>(new[] { "*.xml", "*.config" });
if (filters != null)
{
foreach (string filter in filters.Where(filter => !string.IsNullOrWhiteSpace(filter)).Where(filter => !include.Contains(filter)))
{
include.Add(filter);
}
}
List<string> xmlFiles = new List<string>(include.SelectMany(ext => Directory.GetFiles(path, ext)));
_exportsDictionary = xmlFiles.Select(filePath => new FileInfo(filePath)).ToDictionary(
fileInfo => fileInfo.Name,
fileInfo =>
{
ExportDefinition def = new ExportDefinition(fileInfo.Name, null);
Export e = new Export(def, () => XElement.Load(fileInfo.FullName));
return e;
});
}
开发者ID:huraken,项目名称:SharedWebComponentsMef,代码行数:32,代码来源:XElementExportProvider.cs
示例6: CreateCannotGetExportedValue
public static CompositionException CreateCannotGetExportedValue(ComposablePart part, ExportDefinition definition, Exception innerException)
{
Assumes.NotNull(part, definition, innerException);
return new CompositionException(
ErrorBuilder.CreateCannotGetExportedValue(part, definition, innerException));
}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:ExceptionBuilder.cs
示例7: WebScopedComposablePart
protected WebScopedComposablePart(ComposablePart composablePart)
{
_composablePart = composablePart;
_exportDef = composablePart.ExportDefinitions.First();
_key = ((string)_exportDef.Metadata["ExportTypeIdentity"]).Replace('.', '_');
}
开发者ID:timjroberts,项目名称:MefContrib,代码行数:7,代码来源:WebScopedComposablePart.cs
示例8: DecoratedExport
/// <summary>
/// Initializes the context from a part and the export.
/// </summary>
internal DecoratedExport(ComposablePartDefinition part, ExportDefinition export)
{
this.ExportDefinition = export;
this.ExportingMember = ReflectionModelServices.GetExportingMember(export);
this.ExportingType = ReflectionModelServices.GetPartType(part);
this.NewMetadata = new Dictionary<string, object>(export.Metadata);
}
开发者ID:NuPattern,项目名称:NuPattern,代码行数:10,代码来源:DecoratingReflectionCatalog.cs
示例9: IsConstraintSatisfiedBy
public override bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition)
{
if (!base.IsConstraintSatisfiedBy(exportDefinition))
{
return false;
}
return PartCreatorExportDefinition.IsProductConstraintSatisfiedBy(this._productImportDefinition, exportDefinition);
}
开发者ID:JackFong,项目名称:FreeRadical,代码行数:8,代码来源:PartCreatorParameterImportDefinition.cs
示例10: GetExportedObject
public override object GetExportedObject(ExportDefinition definition)
{
Guard.Against(!definition.Equals(_export.Definition),
Resources.Error_PartDoesNotContainAnExportForContract,
definition.ContractName);
return _export.GetExportedObject();
}
开发者ID:anurse,项目名称:MaVeriCk,代码行数:8,代码来源:SingleExportComposablePart.cs
示例11: 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
示例12: GetExportedObject_Guards_Against_Non_Matching_ExportDefinition
public void GetExportedObject_Guards_Against_Non_Matching_ExportDefinition()
{
object expected = new object();
Export export = new Export("Foo", new Dictionary<string, object>(), () => expected);
ExportDefinition nonMatching = new ExportDefinition("Bar", new Dictionary<string, object>());
ExceptionAssert.Guards(() => new SingleExportComposablePart(export).GetExportedObject(nonMatching),
TargetResources.Error_PartDoesNotContainAnExportForContract, nonMatching.ContractName);
}
开发者ID:anurse,项目名称:MaVeriCk,代码行数:8,代码来源:SingleExportComposablePartTests.cs
示例13: Constructor2_NullAsMetadataArgument_ShouldSetMetadataPropertyToReadOnlyDictionary
public void Constructor2_NullAsMetadataArgument_ShouldSetMetadataPropertyToReadOnlyDictionary()
{
var definition = new ExportDefinition("Contract", (IDictionary<string, object>)null);
ExceptionAssert.Throws<NotSupportedException>(() =>
{
definition.Metadata["Value"] = "Value";
});
}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:ExportDefinitionTests.cs
示例14: GetExportedValue
public override object GetExportedValue(ExportDefinition definition)
{
Requires.NotNull(definition, "definition");
if (definition != _export.Definition)
{
throw ExceptionBuilder.CreateExportDefinitionNotOnThisComposablePart("definition");
}
return _export.Value;
}
开发者ID:RudoCris,项目名称:Pinta,代码行数:11,代码来源:CompositionBatch.SingleExportComposablePart.cs
示例15: GetExportedValue
public override object GetExportedValue(ExportDefinition definition)
{
if (definition == null)
throw new ArgumentNullException("definition");
var rdef = (RubyExportDefinition)definition;
var instance = GetOrCreateInstance();
return rdef.GetExportedObject(instance);
}
开发者ID:JogoShugh,项目名称:IronRubyMef,代码行数:11,代码来源:RubyPart.cs
示例16: IsMatch
protected override bool IsMatch(ExportDefinition exportDefinition)
{
object bundle;
if (exportDefinition.Metadata.TryGetValue("Bundle", out bundle))
{
var bundleName = bundle as string;
if (bundleName != null)
return Bundles.Contains(bundleName, StringComparer.OrdinalIgnoreCase);
}
return base.IsMatch(exportDefinition);
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:11,代码来源:BundlesFilteredCatalog.cs
示例17: Constructor2_ValueAsContractNameArgument_ShouldSetContractNameProperty
public void Constructor2_ValueAsContractNameArgument_ShouldSetContractNameProperty()
{
var expectations = Expectations.GetContractNames();
foreach (var e in expectations)
{
var definition = new ExportDefinition(e, new Dictionary<string, object>());
Assert.AreEqual(e, definition.ContractName);
}
}
开发者ID:nlhepler,项目名称:mono,代码行数:11,代码来源:ExportDefinitionTests.cs
示例18: GetExportedValue
public override object GetExportedValue(ExportDefinition exportDefinition)
{
exportDefinition.ShouldNotBeNull("exportDefinition");
if (_values.ContainsKey(exportDefinition))
return _values[exportDefinition];
var value = InterceptedPart.GetExportedValue(exportDefinition);
var interceptingValue = _valueInterceptor.Intercept(value);
_values.Add(exportDefinition, interceptingValue);
return interceptingValue;
}
开发者ID:glennblock,项目名称:MefContrib,代码行数:12,代码来源:InterceptingComposablePart.cs
示例19: IsImportDependentOnPart
internal static bool IsImportDependentOnPart(this ImportDefinition import, ComposablePartDefinition part, ExportDefinition export, bool expandGenerics)
{
import = import.GetProductImportDefinition();
if (expandGenerics)
{
return part.GetExports(import).Any();
}
else
{
return TranslateImport(import, part).IsConstraintSatisfiedBy(export);
}
}
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:PrimitivesServices.cs
示例20: ApplicationSettingExportProvider
public ApplicationSettingExportProvider(IDictionary<string, string> settings)
{
exports = new List<Export>();
foreach (var key in settings.Keys)
{
var metadata = new Dictionary<string, object>();
metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, typeof(string).FullName);
var value = settings[key];
var exportDefinition = new ExportDefinition(key, metadata);
exports.Add(new Export(exportDefinition, () => value));
}
}
开发者ID:georgeslegros,项目名称:MEFSessionCode,代码行数:12,代码来源:ApplicationSettingExportProvider.xaml.cs
注:本文中的System.ComponentModel.Composition.Primitives.ExportDefinition类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论