This project is read-only.

Importing service agent into a service agent

Oct 18, 2012 at 9:27 AM
Edited Oct 24, 2012 at 11:27 AM

I'm trying to import a service agent as part of the ctor for another service agent.  Sample code... 


public class MySampleServiceAgent: ISampleServiceAgent
    public MySampleServiceAgent() {}


[ExportService(ServiceType.Runtime, typeof(IApplicationContext))]
public class DefaultApplicationContext: IApplicationContext
    private ISampleServiceAgent sampleServiceAgent;
    private DefaultApplicationContext() {}

    public DefaultApplicationContext(ISampleServiceAgent sampleServiceAgent)
        this.sampleServiceAgent = sampleServiceAgent;


If I use the [ImportingConstructor] on the DefaultApplicationContext then MEF breaks and nothing gets bound in WPF.  Got no idea how I can debug this.  Obvious first question is... Am I doing something wrong?

Thanks, Darren

edit: fixed naming in sample code