Aug 12, 2011 at 9:50 PM
Edited Aug 13, 2011 at 12:04 AM
I am using Prism + MEF in a project with multiple XAP modules.
In my bootstrapper i register a service in the ConfigureContainer method like so: this.Container.ComposeExportedValue<IService>(new MyService());
Importing the service instance works fine in all my viewmodels that are part of a module.
But when I try to import it in a project that is in a separate class library it is not found.
Basically in some other class library, and a control in that class library. The control imports its viewmodel. This works. The viewmodel seems to be able to import some basic classes fine (like the IRegionManager and IModuleCatalog), but cannot satisfy my
IService. It is being imported the same way as in other module viewmodels and it works, just not in this class library.
edit: actually it looks like none of the imported instances in the class library are the same. I just tried publishing an event from the imported EventAggregator and it was not caught by the subscriber like it is with other viewmodels in my modules.
My concrete service is not marked with an [Export()] in this case, but I did try and the class library viewmodel did find it then, but its not the same configured instance I registered in the bootstrapper.
So it seems like this class library is pulling from a different AggregateCatalog or something. Am I composing it wrong? Or leaving some step out?