MEF create object explicitely

I am trying to create objects explicitely, similar to Spring ApplicationContext.getBean() method which creates objects with all the dependencies initialised within that object, I am not aware about MEF much , I tried searching web for the same but could not find the method to explicitely invoke creation of object with all its dependencies initialised,

Does anybody know the method which allows explicitely creating objects with all of its imports initialised ?

Thanks in advance,



ExportedType instance = compositionContainer.GetExportedValue<ExportedType>();

Where compositionContainer is your CompositionContainer instance and ExportedType is the type that you want to create/get an instance for.

How can you get an instance of CompositionContainer? Use the following code once:

CompositionContainer compositionContainer = CompositionHost.Initialize(catalog);

Where catalog is your MEF catalog (usually an instance of AggregateCatalog).

Need Your Help

ggplot2, geom_boxplot with custom quantiles and outliers

r ggplot2

I have a dataset which includes data from 100 simulations of train runs in a network with 4 trains, 6 stations and lateness at arrival for each train at each station. My data looks something like t...

Datagridview insert data not show

c# linq-to-entities

I just learn linq and trying to make insert update delete with linq and data entity model. Now I'm have some problem, when I'm insert some data, the datagridview not show that, I must cl...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.