mef

PRISM + MEF + MVVM — Not sure where to really start?

假如想象 提交于 2019-12-03 01:27:53
What I'm using: Visual Studio 2010 Microsoft .NET Framework 4 Prism v4 What I am trying to figure out is how to get started with Prism + MEF while maintaining the MVVM pattern. When I go into the Prism Quickstarts, it has a Prism + MEF, but the comments in the project specifically state that the Quickstart example does not implement MVVM. I'm not really sure what to mix/match so that my shell itself follows MVVM (and regions). Basically, I want to use MEF to be able to load Assemblies (Modules) at run-time. And, I want to setup regions in my Shell and have the Shell use MVVM (so I can databind

Is MEF a dependency injection framework?

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The recently announced managed extensibility framework (MEF) of .NET 4.0 - is it a dependency injection framework? Will Microsoft Unity from Patterns and Practices be obsolete in 4.0 ? How does MEF compare to a framework like Unity? 回答1: Specifically addressed in the PDC 2008 2nd Keynote by Scott Guthrie, MEF has a lot more to do with things like extending Visual Studio 2008 and other applications, without having to use all the COM and older technologies... A very good demonstration of extending the text edition in VS2008 was shown among

Compose exported value with MEF 2

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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. Also, I have found documentation very poor and out of

How do I populate a MEF plugin with data that is not hard coded into the assembly?

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am working on a program that will communicate with various pieces of hardware. Because of the varied nature of the items it communicates and controls, I need to have a different "driver" for each different piece of hardware. This made me think that MEF would be a great way to make those drivers as plugins that can be added even after the product has been released. I've looked at a lot of examples of how to use MEF, but the question that I haven't been able to find an answer to is how to populate a MEF plugin with external data

MEF: Where should I put the CompositionContainer?

孤街浪徒 提交于 2019-12-03 00:31:26
I have been using the Windsor IoC Container for my web-based application, to resolve the data access layer implementation the application should use. The web application's UI will consist of pages, and each page consists of small units called portlets. (Their concept is somewhat similar to widgets.) These so-called portlets are basically web controls and can be configured in runtime for every page invidually. The application will ship with some of these built-in, but I would like to enable extending it easily. I figured out that this mechanism is exactly what MEF is built for. So I decided to

How to use resource dictionary in prism modules at design time?

梦想的初衷 提交于 2019-12-03 00:29:32
I am using prism framework in a silverlight app with multiple modules in separate XAPs. I have a resource dictionary defined in my in my shell project. In my modules I can use the resources fine, but since the modules are decoupled from the shell until they are loaded at runtime the designer does not show them or recognize them. Is there a way to make the modules aware of my resources at design time without merging my resource file in every view xaml? My resource files are in a "common" project. I think I have definitely solution for design-time resources. Benefits: It works in any module

Import property always null (MEF import issue)

好久不见. 提交于 2019-12-02 22:22:01
I try for some time to get things done using MEF but now, I run into a problem i need help. Description: I have 2 DLL and one EXE file. ClassLibrary1 (LoggerImpl.cs, SomeClass.cs) ClassLibrary2 (ILogger.cs) WindowsApplicationForms1 (WindowsApplicaitonForms1.cs, Program.cs) I need any help or direction why this doesn't work ? // ClassLibrary1.dll //SomeClass.cs public class SomeClass { [Import("Logging", typeof(ILogger))] public ILogger Log { get; set; } <-- ALWAYS NULL ??? public void Print() { Log.Print(); } } // ClassLibrary1.dll // LoggerImpl.cs namespace ClassLibrary1 { [Export("Logging",

MEF Dependencies and versioning

自作多情 提交于 2019-12-02 22:20:15
I have a system that uses MEF to load parts. Each of these parts rely on a core library. When I build the project, I add a version number to the .dll files like this: part1-1.0.0.0.dll part2-1.0.0.0.dll Also, there is an application that performs MEF composition. It also uses the core library. I've found that I can just deploy the "part" dlls, and composition works fine because the application has already loaded the core library that the parts rely on. So my file system looks something like this: /parts/part1-v1.dll /parts/part2-v1.dll composer-v1.exe core-v1.exe The trouble I'm having is how

C# 轻量级系统基础架构 (MVP MEF + EF6)

匿名 (未验证) 提交于 2019-12-02 22:06:11
0 综述 1 MVP各模块规范 1.1 实体模块规范 1.1.1 命名规范 1.1.2 架构规范 1 namespace TestProj.DataEntity 2 { 3 public interface ITestProjEntity<T> : IEquatable<T> 4 where T : ITestProjEntity<T> 5 { 6 } 7 } public class Patient : IOpenTCMEntity<Patient> { public string ID { get; set; } //主键ID public string Name { get; set; } //姓名 public bool Equals(Patient other) { if (other == null) { return false; } if (other == this) { return true; } bool res = other.ID == ID && other.Name == Name; return res; } } 1.2 数据库访问接口 1.2.1 命名规范 1.2.2 架构规范 1 public interface IBaseDAO<E> 2 where E : IOpenTCMEntity<E> 3 { 4 /// <summary> 5 //

MEF 插件式开发 - DotNetCore 初体验

匿名 (未验证) 提交于 2019-12-02 22:06:11
Ŀ¼ 在传统的基于 .Net Framework 框架下进行的 MEF 开发,大多是使用 MEF 1 ,对应的命名空间是 System.ComponentModel.Composition 。在 DotNet Core 中,微软为了伟大的跨平台策略,引入了 MEF 2 ,其对应的命名空间是 System.Composition ,这个需要开发者自己在 Nuget 上进行下载安装 Microsoft.Composition 。2 与 1 相比,无论是在支持平台上还是性能上都有改进,值得我们探讨一下。 首先,我们创建一个 DotNet Core 控制台应用程序,然后为其添加 MEF2 对应的 Package:Microsoft.Composition; 然后,我们创建一个示例接口: public interface IMessageSender { void Send(string message); } 接着,我们再创建一个示例类来实现该接口,并尝试将其导出: [Export(typeof(IMessageSender))] public class EmailSender : IMessageSender { public void Send(string message) { Console.WriteLine(message); } } 最后,我们在主程序中进行调用: