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
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.
[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
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
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
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
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
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
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