Multiple Exports for One Import

Jul 17, 2009 at 11:17 AM

Hi,

I was trying to get MEF to work in the following scenario. Can you help me out...it could result into a feature request if you deem fit.

I have a chain of responsibility scenario. Where every Assembly exports an interface/method(s)

My host program creates a list of the imports (which are identical interfaces) and then when processing is required it chains them together to process messages. We should be able to drop a new/extra assembly and be able to refresh the chain.

MEF currently doesn't accomodate this scenario. Could you suggest a workaround and/or tell me if this feature request is not desirable for some design reason.

 

 

Jul 17, 2009 at 4:33 PM

Hi,

Is it the chaining, or the refreshing, that you’re inquiring about? Some more details would be great.

Thanks!


Nick

From: adityayadav76 [mailto:notifications@codeplex.com]
Sent: Friday, July 17, 2009 3:18 AM
To: Nicholas Blumhardt
Subject: Multiple Exports for One Import [MEF:62735]

From: adityayadav76

Hi,

I was trying to get MEF to work in the following scenario. Can you help me out...it could result into a feature request if you deem fit.

I have a chain of responsibility scenario. Where every Assembly exports an interface/method(s)

My host program creates a list of the imports (which are identical interfaces) and then when processing is required it chains them together to process messages. We should be able to drop a new/extra assembly and be able to refresh the chain.

MEF currently doesn't accomodate this scenario. Could you suggest a workaround and/or tell me if this feature request is not desirable for some design reason.

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

Jul 18, 2009 at 3:36 PM

Hi,

I have multiple identical exports and I’m trying to import an Arraylist of interfaces which is not working. As of now MEF works with one export per import.

Now if MEF is enhanced to allow import aggregation of multiple identical exports. Then when I refresh the assemblies it should refresh the Aggregate list.

If you want I can paste some code on Monday if you want to see what I’m trying to achieve and why its not working.

Regards

Aditya

From: nblumhardt [mailto:notifications@codeplex.com]
Sent: Friday, July 17, 2009 9:04 PM
To: aditya.yadav@gmail.com
Subject: Re: Multiple Exports for One Import [MEF:62735]

From: nblumhardt

Hi,

Is it the chaining, or the refreshing, that you’re inquiring about? Some more details would be great.

Thanks!


Nick

From: adityayadav76 [mailto:notifications@codeplex.com]
Sent: Friday, July 17, 2009 3:18 AM
To: Nicholas Blumhardt
Subject: Multiple Exports for One Import [MEF:62735]

From: adityayadav76

Hi,

I was trying to get MEF to work in the following scenario. Can you help me out...it could result into a feature request if you deem fit.

I have a chain of responsibility scenario. Where every Assembly exports an interface/method(s)

My host program creates a list of the imports (which are identical interfaces) and then when processing is required it chains them together to process messages. We should be able to drop a new/extra assembly and be able to refresh the chain.

MEF currently doesn't accomodate this scenario. Could you suggest a workaround and/or tell me if this feature request is not desirable for some design reason.

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

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

Coordinator
Jul 19, 2009 at 6:38 AM

Use the ImportMany attribute instead of an Import attribute to import a collection of exports of a given contract.  I don't think ArrayList is supported as a type for this.  We recommend using IEnumerable<T> or an array of T.

See the Declaring Imports section of the programming guide for more information about imports.

Thanks,
Daniel