mef

Are there reference implementations of hot-swapping in .NET?

时光毁灭记忆、已成空白 提交于 2019-12-03 13:34:06
问题 I'm looking for a good implementation of hot-swapping done in .NET. The things I need are: Being able to deploy DLLs in a particular folder and have a running system pick them up. Having the running system update corresponding references in the container. I've been looking into MEF and its directory loading mechanism, but it seems very unreliable. Maybe someone out there has an alternative implementation? 回答1: You can provide a custom event handler for AssemblyResolve by calling newAppDomain(

MEF and ASP.NET MVC

帅比萌擦擦* 提交于 2019-12-03 13:24:56
I want to use MEF with asp.net mvc. I wrote following controller factory: public class MefControllerFactory : DefaultControllerFactory { private CompositionContainer _Container; public MefControllerFactory(Assembly assembly) { _Container = new CompositionContainer(new AssemblyCatalog(assembly)); } protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) { if (controllerType != null) { var controllers = _Container.GetExports<IController>(); var controllerExport = controllers.Where(x => x.Value.GetType() == controllerType).FirstOrDefault(); if

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

佐手、 提交于 2019-12-03 11:56:31
问题 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

ASP.NET MVC: Views using a model type that is loaded by MEF can't be found by the view engine

巧了我就是萌 提交于 2019-12-03 11:10:45
I'm attempting to create a framework for allowing controllers and views to be dynamically imported into an MVC application. Here's how it works so far: I'm using .NET 4, ASP.NET MVC 3 RC and the Razor ViewEngine Controllers are exported and imported using MEF per project - I call a set of controllers and views from a given project a "Module" Assemblies discovered using MEF are dynamically referenced by the BuildManager using a pre-application start method and BuildManager.AddReferencedAssembly . Binaries (from exporting project) and Views are copied into the target project's folder structure

MEF: What if I have multiple exports but need only one import?

别来无恙 提交于 2019-12-03 10:59:50
I'm trying to wrap my mind around MEF. There is one thing I don't understand. Assume that I have an interface, named ISomething, which is a contract, and I have more than one assemblies in a folder that contains my application, and I have no idea how many ISomething implementations are in them, or which one contains one. If I create a host application in which I use MEF, and would like to get an ISomething, but only one, how does MEF decide which implementation it will give me? Or, similarly to a common IoC container, how do I tell it which implementation should it use? Thanks in advance for

Using MEF as an IoC

女生的网名这么多〃 提交于 2019-12-03 10:26:51
After reading some stuff such as this: http://mikehadlow.blogspot.com/2008/09/managed-extensibility-framework-why.html I understand that MEF has some featcures that I will not find in an IoC, and that MEF has some IoC stuff that is probaboly not as advanced as some other IoC systems can offer. I need the MEF stuff. Do I also need an IoC framework or would I be fine with what MEF has? Asher Depends on your requirements/existing code. If you have an existing code infrastructure built on an IoC container, you can in fact combine these with MEF. Recently I've been building an ASP.NET MVC+MEF

MEF: Where should I put the CompositionContainer?

不想你离开。 提交于 2019-12-03 08:58: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

MEF, why are identical duplicates of one and the same exported plugin created?

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: (1) Using the code below I get exactly 2 items in my containers of one and the same exported plugin and I wonder why: (2) Additional question which I really cannot implement: How can I extend the framework to handle different plugin types (such as having several imports of different types, or one import that stores all plugins in a dynamic IEnumerable or so). I want to provide in my static wrapper class one generic method that returns the discovered plugin as a function of type and matching meta data. The exported plugin (which

MEF GetExports<T, TMetaDataView> returning nothing with AllowMultiple = True

自闭症网瘾萝莉.ら 提交于 2019-12-03 08:34:06
I don't understand MEF very well, so hopefully this is a simple fix of how I think it works. I'm trying to use MEF to get some information about a class and how it should be used. I'm using the Metadata options to try to achieve this. My interfaces and attribute looks like this: public interface IMyInterface { } public interface IMyInterfaceInfo { Type SomeProperty1 { get; } double SomeProperty2 { get; } string SomeProperty3 { get; } } [MetadataAttribute] [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] public class ExportMyInterfaceAttribute : ExportAttribute, IMyInterfaceInfo {

Import property always null (MEF import issue)

感情迁移 提交于 2019-12-03 08:32:10
问题 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()