mef

MissingMethodException after extracting base interface

£可爱£侵袭症+ 提交于 2019-12-12 23:12:15
问题 I split an interface, inside a Nuget package library, into a simpler base interface (without one property from the original), and made the original derive from the new base interface. Instantiation in consuming applications happens through Managed Extensibility Framework (MEF), using property injection with [Import] attributes, and implementations with [Export(typeof(IFooConfigurations))] This shouldn't be a breaking change, for applications using the old interface and implementation. But in

Implementing a Language Service By Using the Managed Package Framework

╄→гoц情女王★ 提交于 2019-12-12 17:05:31
问题 I've followed the steps listed in the walk through (http://msdn.microsoft.com/en-us/library/bb166360.aspx) for implementing and registering a LanguageService and I simply can't get it to work. My package loads correctly, I can add functioning menu items and option pages, but I cannot open files registered to my service. When I attach a debugger, I can see my VSPackage being constructed, loaded, and having its FDoIdle method called twice. After that, experimental Visual Studio session goes off

Can a MEF application built on .NET 4 import types built against .NET 3.5?

依然范特西╮ 提交于 2019-12-12 16:43:46
问题 I am developing a host application using Managed Extensibility Framework and it's built against .NET 4 and the System.ComponentModel.Composition assembly that is built into the framework. I would like to support the ability to develop parts using .NET 3.5 and export them declaratively. Since the export attributes are new in .NET 4 and thus cannot be referenced by the .NET 3.5 assembly, I'm not sure the best way to go about exporting parts. Is there an easy way to do this without implementing

Prism ServiceLocator GetInstance and MEF

十年热恋 提交于 2019-12-12 13:46:48
问题 I'm trying to use Microsoft.Practices.ServiceLocation.ServiceLocator and MEF. Interface IServiceLocator defines method GetInstance with two parameters. First parameter is serviceType and second paremeter is key. I have two classes which implement interface IMyInterface and they have Export attribute: [Export(typeof(IMyInterface)), PartCreationPolicy(CreationPolicy.Shared)] public class Class1 : IMyInterface {} [Export(typeof(IMyInterface)), PartCreationPolicy(CreationPolicy.Shared)] public

Using MEF in controls instantiated from XAML

自古美人都是妖i 提交于 2019-12-12 10:49:24
问题 I have a UserControl I've created which imports several parts using the [Import] attribute. public class MyUserControl : UserControl, IPartImportsSatisfiedNotification { [Import] public IService Service { get; set; } public MyUserControl() { } public void OnImportsSatisfied() { // Do something with Service. } } This UserControl is instantiated from XAML, so its imports aren't being satisfied and OnImportsSatisfied isn't being called. <local:MyUserControl /> My question is how can I satisfy my

SatisfyImportsOnce vs ComposeParts

青春壹個敷衍的年華 提交于 2019-12-12 09:31:55
问题 Can someone please explain the difference between SatisfyImportsOnce and ComposeParts and why one would work where the other doesn't? Specifically I have a MVC Web application that I am using MEF in. Below is some code (from that application) that works when I use SatisfyImportsOnce but doesn't when I use ComposeParts . My understanding is that ComposeParts creates composable parts from an array of attributed objects and composes them in the specified composition container and that

How do I get the version number of each DLL that has my MEF plugins?

▼魔方 西西 提交于 2019-12-12 07:55:54
问题 I've got a number of classes which implement IDessertPlugin . These are found in various DLLs which I use MEF to spin up instances of them to use as plug-in functionality in my application. So what I'm wanting to do is display the version number of the DLLs from which I've loaded plugins using MEF. One or more plugins are defined in one or more DLLs which I load up in my application. Right now I do something like so: var catalog = new AggregateCatalog(); catalog.Catalogs.Add( new

How does MEF determine the order of its imports?

断了今生、忘了曾经 提交于 2019-12-12 07:11:09
问题 MEF allows you to import multiple parts via the use of the ImportMany attribute. How does it determine the order in which it retrieves the relevant exports and adds them to the enumerable you are populating? For example, how would I import multiple IRules that had to fire in a particular order? The only way I can think of is to have an OrderValue property in IRule and sort manually: public class Engine { [ImportMany] public IEnumerable<IRule> Rules { get; set; } public void Run() { // ... //

Caliburn.Micro HelloWindowManager Sample - View location not working

ぃ、小莉子 提交于 2019-12-12 06:58:58
问题 The HelloWindowManager Caliburn.Micro sample demonstrates displaying a Window (View) as Modal, Modeless or Popup and works just fine. However it has the views and Viewmodels in the project root so I wanted to tidy it up and have it use the default convention for view and view model locations, so I made the following changes: Created a Views folder and moved both the ShellView.xaml and DialogView.xaml within it Created a ViewModels folder and moved the matching View Models Adjusted the

How to register Views for Navigation

微笑、不失礼 提交于 2019-12-12 04:31:50
问题 I have the project structure as follows: Modules --- ModuleA ---ViewA ---ViewModelA ---Module --- ModuleB ---ViewB ---ViewModelB ---Module MyApplication ---Shell.xaml ---Bootstrapper MyApplication.Infrastructure --- --- Now, In ModuleA.Module: [ModuleExport(typeof(Module), InitializationMode = InitializationMode.WhenAvailable)] [PartCreationPolicy(CreationPolicy.NonShared)] public class Module : IModule { IRegionManager _regionManager; [ImportingConstructor] public Module(IRegionManager