Click here to Skip to main content
15,888,216 members
Everything / MEF

MEF

MEF

Great Reads

by wells cheung
Angular Single-Page Application, MEF, Privilege Control, WCF Restful Service, ui-router,
by Dean Oliver
How we can harness the power of MEF and extend it by way of generics.
by Shuqian Ying
The source code and a simple demo program for a plug-in in Microsoft Managed Extensibility Framework (MEF) that provides visual display of email messages.
by Sau002
This article takes you through a step by step journey of building a fairly large console application which is modular and also extensible by using the principles of Managed Extensibility Framework.

Latest Articles

by Nicolas DESCARTES
How to build a plugin architecture in C# ?
by Sau002
This article takes you through a step by step journey of building a fairly large console application which is modular and also extensible by using the principles of Managed Extensibility Framework.
by GerVenson
An introduction into the Managed Service Extensibility Framework (MSEF)
by marceloarguello700
Load a Rhinoceros plugin through MEF

All Articles

Sort by Updated

MEF 

1 Jun 2011 by #realJSOP
Like this?Creating WCF Service Extensibility through MEF (Managed Extensibility Framework)[^]
10 Sep 2014 by #realJSOP
VS2013, Win7 (32-bit)I'm writing a WPF app that utilizes MEF, and one of the modules (the one I'm testing) uses interop services. When I run the app to test the module, the app shuts down with no indication that anything is wrong. I've put try/catch blocks around the code where it stops, and...
17 Dec 2019 by ahmed_sa
i read on some sites bout mef framework and not understand any thing can you tell me why using export and import attributes and what is befit ? please show me any simple example ? What I have tried: using System.ComponentModel.Composition; using MefShared.Interfaces; namespace...
1 Mar 2016 by Akhil Mittal
Resolve dependency of dependencies using Inversion of Control and dependency injection in Asp.net Web APIs with Unity Container and Managed Extensibility Framework (MEF).
30 Nov 2011 by alexis.coles
Should the attribute not go above the class ? Just a guess..namespace MEFProgram{ public string GetMessage {get;set;} [Import (typeof(IMessage))] class Program {
12 Feb 2015 by Amal E S
What is the basic difference between Prism and MEF in MVVM (silverlight).
27 May 2015 by Arup Banerjee
The project is a simple Temperature Converter WPF Application which will allow user to convert from Celsius to Fahrenheit and vice versa. The objective however is to demonstrate techniques that are important when building large-scale front-end enterprise software.
28 Mar 2014 by ashok rathod
I am getting below Error while using MEF as a part of my project.What Could be the issue?The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition error. The root cause is provided below. Review the...
28 Mar 2014 by ashok rathod
The Problem was that i had many parts which needs to be included in container and for that I have to use ImportMany instead of Import[ImportMany] IEnumerable> operations;instead of [Import] IEnumerable
22 Apr 2017 by bling
Understand than ANY approach you take is vulnerable to reverse engineering. The most you can hope for is to make it difficult but not impossible for someone to break your licensing mechanism. The best way to enforce licensing is to run everything on a server - forcing the clients to connect to...
29 May 2018 by Boris Zinchenko
I have an assembly dynamically loaded through MEF. Inside the assembly I have dynamic objects reconstructed from JSON by Newtonsoft.Jnon like follows. JObject jObject = (JObject)JsonConvert.DeserializeObject(data); long id = jObject.id; This code compiles and runs fine on several machines...
6 Jul 2018 by canard29
Hi, I want first to thank @Graeme_Grant for his great suppport in this article https://www.codeproject.com/Questions/1250791/Load-usercontrol-by-reflection I copied the code, added the reference and everything is working well ! I have an additional question. I want to have access to the...
7 Apr 2011 by Cr3at0rX
I´m trying to inject an existing instance of a class into my view, but the view only receive a default instance of my class.Here is my export in a view model class[Export("BLA", typeof(vmObject))] public vmObject VMObject { get { ...
5 Jan 2013 by Daniele Fusi
Hi all, I've been googling a lot about this but it seems there is no up-to-date solution (e.g. see here[^]). Basically I'd like to build an MVC 4 web app acting as a host for plugins. Each plugin should expose controllers (exported via MEF into their DLL) plus content files (views and the like),...
4 Feb 2016 by Dave Kreskowiak
I seriously doubt you'll ever find one that covers all those topics in one plan.You'll stuff that covers sections of those topics, for example, Introduction to the .NET Framework, Introduction to C#, Unit Testing for Beginners, but you'll never anything that covers all of this stuff advanced...
28 May 2012 by db7uk
A composite (Prism 4) WPF application using Bing Maps to display earthquakes from around the world.
2 Feb 2012 by Dean Oliver
How we can harness the power of MEF and extend it by way of generics.
18 Apr 2012 by Dean Oliver
A short guide to what to look forward to in the next release of MEF.
8 Jun 2015 by Deepak97
I am a beginner in MEF. According to my requirement I have to show the multiple plugin UI according to the selection of plugin. For that I have to pass plugin related data to the external plugin UserControl.[InheritedExport(typeof(IConnect))]public interface IConnect{}Below code is...
22 Apr 2017 by erik schouten
I need advice on how to design a licensing system when I am importing DLL files using the MEF. So, my program would run and on startup would begin to load all the DLL's from a specific map into the program. First of, I want to make sure that the program would only load DLL's that are allowed by...
8 Dec 2012 by FantasticFiasco
I thought it would be possible to write the following code:[Export]public class ClassA{}public class ClassB{ private readonly Func classAProvider; [ImportingConstructor] public ClassB(Func classAProvider) { this.classAProvider =...
31 Aug 2011 by financeloans
Finance Loans gxpamjwrg svzylnus w gmoyiutyd idjcupqrn rnym taa jy wobjudouh gltfxi opl vxacutfyp xatuqj mnx mcwudbblm cyblpk mxr ...
5 Apr 2011 by fmsalmeida
In this article, I will show how to build a pluggable component using MEF.
7 Jan 2014 by Gabriel Sas
Hello, i want to export a grid and to import it so i can use it in the MainWindow.I want to do this to use different controls on the MainWindow.And to make it usable for other programers to create their own grid to change the MainWindow based on a list of grids.Any simple...
22 Jan 2014 by Gabriel Sas
Hellocan a user control be exported? and how? or why can't it be exported? using MEF and WPFThanks,
30 May 2014 by Gabriel Sas
Is there a tool that can find out if i am using Export[typeof(IMyExport)] on multiple classes but i am only using this as [Import] IMyExport TestObject; and it should be used with [ImportMany]
1 Jan 2011 by Gareth Barlow (NBNi)
Building up activities using the Managed Extensibility Framework for workflow services hosted in IIS.
14 Aug 2016 by GerVenson
An introduction into the Managed Service Extensibility Framework (MSEF)
10 Jul 2018 by Graeme_Grant
You don't need to use reflection with MEF, you simply Export & Import to share data - the data can exist in a DLL/EXE outside of the main app. So long as MEF can compose, the data will be visible. This is what we did in another MEF Solution[^] where reflection was requested for a plugin system...
28 May 2013 by Hamed Musavi
Setting up MEF to load plugins from a directory
23 Jan 2013 by Harsh Baid
In this post, we will have more insights on the implementation part regarding multi-file assembly and using MEF to apply the concept practically in the applications using Directory Catalog technique.
19 Jan 2011 by hoernchenmeister
Hi all,I created an application that is able to load plugins and displays them.I now integrated Logging (Enterprise Library) into the mainframe which makes me start thinking how to pass the centralized loggin mechanism of the mainframe to the loaded plugins.Would it work to implement...
11 Apr 2012 by hoernchenmeister
Hi all,I am dealing with MEF for quite a while now and was quite pleased with it.Since now I used a DirectoryCatalog that loaded dll's following a specific naming convention (all dll's/exe's etc in the same folder).Now I get the chance to structure something equal in a different way,...
12 Jun 2016 by hoernchenmeister
Good morning all,I am struggeling with a strange problem using nested imports in MEF.I try to keep it quite basic, so I do not annoy you people with the details ;)Maybe somebody has experienced similar behavior, I just have no more clue where to look at.I have a ModuleImporter class...
6 Dec 2010 by ImedRidene
Hi all,I have the following interface:public delegate void NotifyOnModulesAvailabilityHandler(Lazy[] modules);public interface IModulesLoader{ event NotifyOnModulesAvailabilityHandler NotifyOnModulesAvailability; Lazy[] Modules { get; set;...
3 Dec 2014 by John M. Baughman
Demonstrates using MEF in an AppDomain and allows the exchanging of MEF parts while the application is running.
10 Jul 2018 by JohnMeers
I have an application using MEF and am trying to write integration tests for the Plug-ins. The code I have is:- public string Run() { IFunction IUT = null; string Wanted = "NewUser"; foreach (Lazy func in...
25 Aug 2010 by kishore Gaddam
Introduction to MEF Programming
6 Feb 2011 by kishore Gaddam
Advanced MEF Programming
3 Apr 2014 by Kornfeld Eliyahu Peter
container.ComposeParts(this);...
8 Dec 2012 by Krunal Rohit
Please take a look, perfect example is given over here...
26 Aug 2010 by Kunal Chowdhury «IN»
In this article, I describe MEF using a Silverlight Application. Read it and don't forget to vote and share your feedback.
29 Sep 2014 by Kurlyan
First thing's first, English is not my language, please forget my language mistakes.My idea:- How to separate business logic & ui to multi dll- How to plug/unplug application plugin when host application is running- How to Building some share dll for (Script, UI control, css)So,...
4 Aug 2012 by Libish Varghese Jacob
You can see a an article here http://www.gonetdotnet.info/posts/wpf-articles/create-composite-application-wpf-prism[^] This will help you to start up with what you need.
13 Aug 2012 by Libish Varghese Jacob
you can find a sample application which uses PRISM Event Aggregator to create a simple application in WPF with MEF container here http://www.gonetdotnet.info/posts/wpf-articles/wpf-module-communication[^]. This article has detailed explanation for a newbie.
31 Jan 2013 by LOUIS Christian
Take a look on Prism on codeplex. MEF is integrated.http://compositewpf.codeplex.com/[^]
24 Jul 2011 by Mahadesh Mahalingappa
MEF with WCF
8 Apr 2016 by marceloarguello700
Load a Rhinoceros plugin through MEF
3 Jun 2014 by Member 10272748
I have several buttons that are mef plugin's to a separate application, and are displayed by that apps' view model. I need to also be able to control the status and toggle of those buttons from a windows service. Possible, and where can I look? Using .Net 4.0
17 Mar 2014 by Member 10678514
I need to create a system to execute some scheduled jobs.I considered it's a job for MEF.The idea is to have a central blok where I can attach some other components in the form of MEF plugins.For example I would like to have a class for data source, a class for data destination and a class...
9 Jan 2017 by Member 12937161
When i start my project it runs fine and UI is loaded and when i click the button after entering values, it shows error.At button click i have called a method.private void button_Click(object sender, RoutedEventArgs e) { CompositionHelpers.CalculatorComposition calc =...
26 Nov 2013 by Member 9417653
Please under stand the flow of code . I have an interface Ishape which in some separate dll or class library. [InheritedExport] public interface Ishape { int Paint(int width, int height); }In my window application I have two classes. public class...
27 Nov 2012 by Milan Raval
Advancements in MEF in .NET 4.5.
30 Nov 2011 by moneymakermaster
The property GetMessage is outside the class.At the namespace level there can be class,enum,interface or struct.Properties should be defined at class level
29 Sep 2014 by Nelek
Step 1) Do a little research. Google is a good start pointStep 2) Start codingStep 3) Compile and use the debug to solve little issuesStep 4) When you get a problem you don't know how to solve but at least you tried it, then come back and ask for something concrete with a snippet of the...
21 Mar 2011 by Nick Polyak
Prism for Silverlight/MEF in Easy Samples tutorial. Part 2 - Prism Navigation
22 Mar 2024 by Nicolas DESCARTES
How to build a plugin architecture in C# ?
30 May 2013 by NightCodeStalker
Can you boostrap a Prism module system from within the WCF service? Because no matter what I do my MEF dependencies are not being fulfilled.E.g.:This is my WCF service implementationpublic class MyService : IMyServiceContract{ // This should get filled by MEF after Prism loads...
30 Nov 2011 by Nikil S
This is often caused by an extra a closing paranthesis.Refer to the below answer for more information.Expected class,delegate,enum, interface,or struct[^]
27 Apr 2011 by Niladri_Biswas
This article will disscuss about MEF, how to start working in this, etc.
10 Dec 2011 by Not Active
Entity Framework is just a means of accessing the data, so it falls within the DAL, Data Access Layer. MEF is used is in the business layer.
30 Jul 2014 by Omar Gameel Salem
Solving "The IControllerFactory 'MefContrib.Web.Mvc.CompositionControllerFactory' did not return a controller for the name xxx"
7 Apr 2011 by OriginalGriff
Solved by the OP - answered to remove from unanswered list.
9 Jan 2017 by OriginalGriff
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself.Let me just explain what the error means: You have tried to use a variable, property, or a method return value but it contains null -...
31 Jan 2013 by Pete O'Hanlon
A while ago, I was lucky enough to work with the super smart Marlon Grech - the result of this work was this[^] project. If you need a WPF framework that uses it, take a look at Sacha Barber's excellent Cinch v2[^].
9 Dec 2013 by Pete O'Hanlon
While we are all familiar with testing standard interface implementations, actually testing Lazy imports can be trickier if you don't follow this trick.
12 Feb 2015 by Peter Leow
Refer:MEF vs. PRISM. What is the difference?[^]
27 Mar 2012 by pietvredeveld
I think the problem is in the return extensions.FirstOrDefault(); MEF will normaly return all the objects that match the requested import. Now only the first one it finds. You can add meta data and lazy loading to get the right object from MEF.PietPS: just read the solution given on...
28 Mar 2012 by pietvredeveld
Hi,I've look deeper into you're problem. It not a MEF problem. The problem is the loading model of .NET. (or better the way you're objects are loaded by .net)When MEF loads it returns the correct objects. But when looking for class ProjectXYZ when projectB is loaded there is already a...
13 Oct 2011 by Quipsound
Hi thereI have a class decorated with the ImportingConstructor attribute as follows:[ImportingConstructor]public MyClass([Import("Path")]string path, [Import("Key")]string key)and can create an instance using CompositionContainer.GetExportedValue...
9 Oct 2013 by Ramana Bellary
Hi, I want to convert Lazy to Lazy where IOperationData and IOperation are interfaces.foreach (Lazy i in operations) { if ((i.Metadata as IOperationData).Symbol.Equals(operation)) ...
1 Jun 2011 by rashmih.in
Hi,I am new to MEF (Managed Extensibility Framework). I need to create a WCF service as a MEF container. Sample example would be great.I would appreciate the help.Thanks in advance.
15 Mar 2012 by rawwool (Rahul Kumar)
Use Twitter as a globally available persisted message queue in your distributed applciation work flow
30 Nov 2011 by Richard MacCutchan
"Expected class, delegate, enum, interface, or struct"But you have a simple method!
13 Feb 2016 by Roger C Moore
Exploring Dependency Injection / Inversion of Control (IoC) with Managed Extensibility Framework (MEF)
21 Apr 2013 by RowanArkison
Hi@all!I have a service, which uses user defined object providers (e.g. logic to access different data sources) by [ImportMany]. Since I want to use the default PRISM ILoggerFacade within the IObjectProvider Implementations, I have set up the importing constructor like this: ...
21 May 2017 by Sabyasachi Mukherjee
I'm using MEF as the IoC container in WPF with Caliburn.Micro framework. The MEF container resides in the Bootstrapper. Bootstrapper has the method: protected override void OnStartup(object sender, StartupEventArgs e) { DisplayRootViewFor(); } Now,...
31 Jan 2013 by Saif84
How can I use MEF with WPF and the MVVM pattern ?
26 Mar 2012 by Saroop Trivedi
I have a interface as follows: [InheritedExport(typeof(ITransform))] public interface ITransform {...}Now, I have two classes: namespace ProjectA { public class Transform:ITransform {....} } And namespace ProjectB { ...
24 Jul 2019 by Sau002
This article takes you through a step by step journey of building a fairly large console application which is modular and also extensible by using the principles of Managed Extensibility Framework.
23 Dec 2010 by Sergey Alexandrovich Kryukov
You're "pretty sure", but I would check up: in your implementation class, totally disregard "using" clause and write all fully qualified names -- should show the source of the problem.
30 May 2013 by Sergey Alexandrovich Kryukov
Just start from here:http://en.wikipedia.org/wiki/Managed_Extensibility_Framework[^],http://msdn.microsoft.com/en-us/library/dd460648%28VS.100%29.aspx[^],http://mef.codeplex.com/[^],http://mef.codeplex.com/documentation[^].—SA
3 Apr 2014 by Sergey Alexandrovich Kryukov
You did not show where the exception with the message "Object reference not set to an instance of an object" is thrown. Not to worry. This is one of the very easiest cases to detect and fix. It simply means that some member/variable of some reference type is dereferenced by using and of its...
3 Jun 2014 by Sergey Alexandrovich Kryukov
The question is way too vague to give the exact advice. You did not describe your existing architecture and what have you tried. You did not explain what could be your problem.But the idea could be this: you should remember that your windows service works even if there is no a desktop, so...
18 Apr 2014 by Shai Vashdi
Hi Gablriel,Yes, a User Control can be imported. I wrote an example just for that in my article:The Simplest Way to use MEF Fully Lazy DLL Loading[^]
18 Apr 2014 by Shai Vashdi
Hi Maurizio,Just look on my article: The Simplest Way to use MEF Fully Lazy DLL Loading[^]Use the "interfaces" approach for OOD pattern :)
18 Apr 2014 by Shai Vashdi
Hi Andy,Take the simple solution, just use a generic MEF importer & loader. I hope my article can help you:The Simplest Way to use MEF Fully Lazy DLL Loading[^]Best Regards,Shai
18 Apr 2014 by Shai Vashdi
Hi,Just use the meta data for example:[ExportMetadata("Name", "ControlsLibrary1.BlueControl")]Then when you load all of the Shapes you can add them to the Combo-Box.You can read more about it in my article:The Simplest Way to use MEF Fully Lazy DLL Loading[^]I hope it...
3 May 2012 by Shenwei Liu
The article series shows how to upgrade a Silverlight application having basic patterns to the MVVM and MEF composable patterns with easy approaches and detailed coding explanations.
3 May 2012 by Shenwei Liu
The article series shows how to upgrade a Silverlight application having basic patterns to the MVVM and MEF composable patterns with easy approaches and detailed coding explanations.
3 May 2012 by Shenwei Liu
The article series shows how to upgrade a Silverlight application having basic patterns to the MVVM and MEF composable patterns with easy approaches and detailed coding explanations.
31 Jul 2012 by Shuqian Ying
The source code and a simple demo program for a plug-in in Microsoft Managed Extensibility Framework (MEF) that provides visual display of email messages.
11 Apr 2012 by Steve Maier
I have used MEF for a large medical system for sometime now. We also use a separate folder for the plugins. Actually we have multiple folders as well that various plugins are in. The only difference that we have from your setup is that the contract DLL is in our main folder, not a lib...
5 Jun 2011 by stevenlauwers22
Creating an Elmah plugin for Glimpse
2 Apr 2014 by stubobis1
I am trying to learn dependency injection.Ive made a test app to try it out. The output should be "Testing Appended string", but it keeps giving me a NullReferenceException. Any help?using System;using System.Collections.Generic;using System.ComponentModel.Composition.Hosting;using...
30 Nov 2011 by sucram
public string GetMessage {get;set;}Is not within a class you can not have a getter ans setter in the namespace.
11 May 2011 by Super Lloyd
A much simpler composite application library.
23 Nov 2013 by Tomas Takac
How to inject named logger using MEF
15 Sep 2015 by V3rius
Hello everybody,i have a project with a Datagrid (Host),another Project with an Interface(Contract) anda third Project (Plugin) which References the contract like the host.(All of them in .Net 4.6)Seems like normal MEF till now.I use EF6 inside the Plugin to get information for...