SatisfyImports limits?

Jan 11, 2010 at 3:42 PM

Hi

I'm getting this exception: "Cannot call SatisfyImports on a object of type '.....' because it is marked with one or more ExportAttributes."

What can I do with that?

Is there any workaround?

Thanks

Adiel

Jan 11, 2010 at 3:46 PM

It sounds like you are using PartInitializer on a part that has an Export. PartInitializer does not support Exports, as if a part has an export it will be discovered by MEF's catalog. PartInitializer should only be used by Parts such as a user control that are not in the catalog.

Can you describe a bit about what you are trying to do? Which part are you using PI on, and why does it need to be exported?

Thanks

Glenn

Jan 11, 2010 at 3:51 PM

Hi

First that was Quick!!! thanks.

I'm trying to create a composition of PRISM and MEF. 

In the view I'm using [Import] to fetch the ViewModel, and on the same view [Export] to use with the module level.

I'll try to remove the PI and see.

If U have some additional resources I'll appreciated it.

Thanks

Adiel

 

 

Jan 11, 2010 at 3:56 PM

It's work.

thanks

By the way how can I share the container from the bootswrapper with the other parts. (I want to export specific instance...)

I tried to set it as a property but It's look like MEF creates a new bootswarpper and then share it's container (witch is null).

Thanks

Adiel

Jan 11, 2010 at 4:04 PM

You can, though we recommend not doing it. If what you are trying to do is create new instances on the fly, you can import PartCreator<T>. An alternative option is to compose the container into itself. You can do this by calling Container.ComposeExportedValue passing the container.

Glenn

From: adiel [mailto:notifications@codeplex.com]
Sent: Monday, January 11, 2010 7:57 AM
To: Glenn Block
Subject: Re: SatisfyImports limits? [MEF:80443]

From: adiel

It's work.

thanks

By the way how can I share the container from the bootswrapper with the other parts. (I want to export specific instance...)

I tried to set it as a property but It's look like MEF creates a new bootswarpper and then share it's container (witch is null).

Thanks

Adiel

Read the full discussion online.

To add a post to this discussion, reply to this email (MEF@discussions.codeplex.com)

To start a new discussion for this project, email MEF@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Oct 18, 2010 at 12:32 PM

Is it then considered a bad practice to expose the container thru the MEF ServiceLocator Adapter?:

MefServiceLocator locator = new MefServiceLocator(this.Container);
ServiceLocator.SetLocatorProvider(() => locator);

...

var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();