.NET Framework Bookmark and Share   
 index > Managed Extensibility Framework > MEF and singletons
 

MEF and singletons

Hi,

I have an object with more than one interface and I want to resolve this dependancies with MEF. But its important, that the instance of the object is a singleton, so how can I tell MEF to do so?

Thanks

Gerhard
  • Moved byMathias Schiffer Tuesday, June 23, 2009 10:28 AMEnglish Language Post (From:.NET Framework)
  •  
Gerhard
When you export your class use the creationpolicy attribute
[PartCreationPolicy(CreationPolicy.Shared)]
[Export(typeof(IMyInterface))]
public class MyClass : IMyInterface
{
}
Craig Kuhnert

You can use google to search for other answers

Custom Search

More Threads

• Do you will support event subscribe and publish in future vesion fo MEF?
• pinvoke query
• wrong csv information showed up in csv file
• Looking for example of some usercontrol/tabitem exporting a ToolBar object
• Extensibility and hiding
• Weird crash when Candidate provider does not export the imported type
• how to add or integrate download accelerator to IE
• What is MEF in clear words that every newbie will catch ??
• Why multi ExportAttribute is not supportted by property?
• How to deploy an Add-In...?