Re: Manually registering an export from a MEF plugin

2011-09-11 Thread Matt Siebert
Thanks Michael. Your code works for me without specifying the type on the FuncIBar import. The export on CreateBar() doesn't need to specify the type either. On Sat, Sep 10, 2011 at 10:34 PM, Michael Minutillo michael.minuti...@gmail.com wrote: Sorry, you need to specify the type when

Re: Manually registering an export from a MEF plugin

2011-09-11 Thread Michael Minutillo
Hmm. It appears I have been misinformed by the documentation. Curse you, out of sync build artefacts! *shakes first as sky* Michael M. Minutillo Indiscriminate Information Sponge http://codermike.com On Mon, Sep 12, 2011 at 12:59 PM, Matt Siebert mlsieb...@gmail.com wrote: Thanks Michael.

Re: Manually registering an export from a MEF plugin

2011-09-10 Thread Matt Siebert
[mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Matt Siebert Sent: Thursday, September 08, 2011 11:33 PM To: ozDotNet Subject: Manually registering an export from a MEF plugin Hey folks, I'm beginning to use MEF in a solution that involves a mix of .NET 3.5 and 4.0 projects. I'm using MEF

Re: Manually registering an export from a MEF plugin

2011-09-10 Thread Matt Siebert
I kind of like this approach, but does MEF allow an Export on a method? If so then I suppose I could do something like: class BarFactory { [Import] IBlah blah; [Export] IBar CreateBar() { return new Bar(blah); } } I can see how imports could be handled with David's

Re: Manually registering an export from a MEF plugin

2011-09-10 Thread Michael Minutillo
Sorry, you need to specify the type when importing a Func, you can't leave it blank as I did in my example code (serves me right for not trying it before posting) On Sat, Sep 10, 2011 at 8:31 PM, Michael Minutillo michael.minuti...@gmail.com wrote: You can export a Func and then call it. Like

Re: Manually registering an export from a MEF plugin

2011-09-10 Thread Michael Minutillo
You can export a Func and then call it. Like this: class BarFactory { [Import] IBlah blah; [Export(typeof(FuncIBar))] IBar CreateBar() { return new Bar(blah); } } class BarProvider { [Import] private FuncIBar _factory; [Export] public IBar Bar { get { return

Manually registering an export from a MEF plugin

2011-09-09 Thread Matt Siebert
Hey folks, I'm beginning to use MEF in a solution that involves a mix of .NET 3.5 and 4.0 projects. I'm using MEF in the 4.0 projects and I need to register some exports that live in the 3.5 projects. The problem is I need to do this from one of the plugin projects. To illustrate this, imagine

RE: Manually registering an export from a MEF plugin

2011-09-09 Thread David Kean
an export from a MEF plugin Hey folks, I'm beginning to use MEF in a solution that involves a mix of .NET 3.5 and 4.0 projects. I'm using MEF in the 4.0 projects and I need to register some exports that live in the 3.5 projects. The problem is I need to do this from one of the plugin projects

Re: Manually registering an export from a MEF plugin

2011-09-09 Thread Michael Minutillo
One solution would be to add the following class to Foo.dll but it means you're controlling the creation of Bar instead of getting MEF to do it for you class BarProvider { [Export(typeof(IBar))] IBar ExportedBar = new Bar(); } Michael M. Minutillo Indiscriminate Information Sponge