mef

MEF parts list sometimes empty

随声附和 提交于 2019-12-11 02:45:11
问题 I'm currently using MEF and a DirectoryCatalog to load some parts from some extension DLLs. It works for me, and most of the people that use the program, but some users experience the parts not being loaded at all. Collecting some debug information, it seems that MEF does load the DLLs (catalog.LoadedFiles lists them), but that no parts are listed in catalog.Parts. One user is on XP sp3 and one is on Windows 7, so I don't think that the OS is the problem. Does anyone have some idea of why

Entity Framework and abstract class

主宰稳场 提交于 2019-12-11 02:43:32
问题 I'm new to Entity Framework and would like to know if, what I want to do, is possible. I have a class named ' Monitor ' which contains a List of ' MonitorField '. Each ' MonitorField ' have a List of an abstract class called 'AMonitoringTool'** AMonitoringTool is provide to allow another developer to create his own kind of field, by inheriting from AMonitoringTool in an external DLL. The main issue is that the application do not know the real type in ' MonitorField ', preventing from saving

In C# 3.0 we use “var” what is its alternative in C# 2.0?

心已入冬 提交于 2019-12-11 02:22:28
问题 I am learning plug able architecture in .Net using Managed Extensibility Framework (MEF.) I saw sample code on the net, but when I tried to implement it I got stuck at one point. The code was using: var catalog = new AttributedAssemblyPartCatalog(Assembly.GetExecutingAssembly()); var container = new CompositionContainer(catalog.CreateResolver()); This var is available on C# 3.0 where as I am coding in C# 2.0. What is the alternative of above two statements? How can I make them work in c# 2.0

Silverlight + Galasoft MVVM Light + MEF loading XAP

一笑奈何 提交于 2019-12-11 02:21:42
问题 I have an application wich has some "modules" so to speak. Each user has permissions to see each module, some don't see all some see all. I want to load XAP files and load those view models(with views) in my application. How do I do that with Galasoft MVVM light and DeploymentCatalogService? Reference: http://mvvmlight.codeplex.com/ http://codebetter.com/glennblock/2010/03/08/building-hello-mef-part-iv-deploymentcatalog/ Is it even posible or am I wasting my time here? How to initialize this

How to apply styles in a resource dictionary that is programmatically added to the App.Current.Resources.MergedDictionaries collection?

夙愿已清 提交于 2019-12-11 01:31:03
问题 I am working with a very large Silverlight 5 application that needs to implement theming. Unfortunately I can't use the C1 (Component One) or Silverlight Toolkit theme mechanisms due to the enormity of xaml and code changes I would have to implement. I am forced to do something a bit out of the box. As a starting point I created a demo project by referencing a post on Stack Overflow Using Mef to Import a WPF DataTemplate written by @Scott Whitlock. The post described how to dynamically load a

Activating views in regions in Prism

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 01:08:21
问题 I have problem that I don't seem to be able to solve. I have a created a test project, using MEF and Prism4. I've created a test project where I have 2 views and each of them register themselves inside a region, and also a button in another region. When the button is clicked, I want the view of change to the correct view. The code I think is wrong is below, anyone have any ideas what I am doing wrong here ? public void Initialize() { regionManager.RegisterViewWithRegion(RegionNames.MainRegion

MEF 2: import many

拥有回忆 提交于 2019-12-11 00:35:15
问题 I'm use attribute-free approach to configuring MEF. I'm read following articles: http://msdn.microsoft.com/en-us/magazine/jj133818.aspx http://blogs.microsoft.co.il/blogs/bnaya/archive/2013/01/12/mef-2-0-mini-series-part-4-fluent-import.aspx Test code (console application project, .NET 4.5): using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; using System.ComponentModel.Composition.Registration; using System

How to initialize viewModel using MEF?

冷暖自知 提交于 2019-12-11 00:29:05
问题 I have a Module called ModuleMenu. In this module I have a UserControl called MenuView and a Corresponding ViewModel called UserControlViewModel. I also have a class called Module. All the code is as given below: MenuView.xmal <UserControl ..............> <ListBox ItemsSource="{Binding MenuItems, Converter={StaticResource dummy}}" DisplayMemberPath="MenuItemName" SelectedItem="{Binding SelectedMenuItem}" > <ListBox.ItemsPanel> <ItemsPanelTemplate> <StackPanel IsItemsHost="True" Orientation=

MEF Object Lifecycle

心不动则不痛 提交于 2019-12-11 00:13:43
问题 I have a single class called Foo: using System; using System.ComponentModel.Composition; namespace MefTest { [Export] internal class Foo { public Foo() { Console.WriteLine("created foo"); } ~Foo() { Console.WriteLine("Dead"); } } } It's created as such: using System; using System.ComponentModel.Composition.Hosting; using System.Reflection; namespace MefTest { internal class Program { public static void Main() { var catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog

Compose exported value with MEF 2

自古美人都是妖i 提交于 2019-12-10 22:12:00
问题 With MEF 1 it was possible to compose an existing object to the container with the ComposeExportedValue(...)-Method ( container.ComposeExportedValue... ). How can this be done with Microsoft.Composition (MEF 2)? I can't find any Method for this purpose. 回答1: I will have a shot at this one. Granted, I am only about a week in on learning MEF 2 myself, after having some limited exposure to MEF 1. So, please take that in consideration with the following answer as it could be completely wrong.