Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6235913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:45:22+00:00 2026-05-24T10:45:22+00:00

As is answered in this post, I can use this code for getting plugins

  • 0

As is answered in this post, I can use this code for getting plugins using catalog/container.

var catalog = new AggregateCatalog(); 
catalog.Catalogs.Add(new DirectoryCatalog(@"./")); // or different directory
var container = new CompositionContainer(catalog);
container.ComposeParts(this);

How is this code modified when I need multiple plugins? For example, if I have two plugins : one for getting color using interface Icolor, and the other for size using interface Isize, how can I discriminate between the two?

I can think of having two different directories for both color and size, but I don’t think this is a general solution.

// get catalog and container
AggregateCatalog catalogForColor = new AggregateCatalog();
catalogForColor.Catalogs.Add(new DirectoryCatalog(@"/pluginForColorDirectory"));
var containerForColor = new CompositionContainer(catalogForColor);
containerForColor.ComposeParts(this);

AggregateCatalog catalogForSize = new AggregateCatalog();
catalogForSize.Catalogs.Add(new DirectoryCatalog(@"/pluginForSizeDirectory"));
var catalogForSize = new CompositionContainer(catalogForSize);
catalogForSize.ComposeParts(this);

// the property to store the catalog 
public IEnumerable<Lazy<Icolor, IMessageSenderMetadata>> Color { get; set; }
public IEnumerable<Lazy<Isize, IMessageSenderMetadata>> Size { get; set; }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:45:23+00:00Added an answer on May 24, 2026 at 10:45 am

    DrectoryCatalog and AssemblyCatalog instances will scan assemblies for ALL exported parts. This will include both types of your plugin. You should’t have to create a whole new catalog and container for composing these types, it should just work as-is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As is asked and answered in this post , one can use SyntaxHighlighter for
As asked and answered in this post , I need to replace '[' with
I came across this answered question , but I can't seem to compile the
Sorry if this has already been answered, but I can't find it if so.
i'm using Valums Ajax uploader. all works great in Mozilla with this code: View:
This may have already been answered in another post, but I just am not
Apologies if this seems like a duplicate post... Thomas Warner kindly answeres an earlier
Question: I have a question that is apparently not answered by this already-asked Bash
If this is answered somewhere else, kindly smack me and point me in the
After having this question answered through a link to an external site , I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.