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 227923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:38:21+00:00 2026-05-11T19:38:21+00:00

i am currently working with MEF and facing some problems what i want is

  • 0

i am currently working with MEF and facing some problems

what i want is to load dlls from the directory.

first i scan the directory and save two things in dictionary

Name property from respective DLL (as string)

and Module Name (as string)

here is ScanDirectory() code

private void ScanPluginDirectory()
{
    catalog = new AggregateCatalog();

    catalog.Catalogs.Add(new DirectoryCatalog(@"..\..\plugin"));            
    container = new CompositionContainer(catalog);

    batch = new CompositionBatch();
    batch.AddPart(this);        

    container.Compose(batch);    

    pluginDictionary = new Dictionary<String, String>();
    foreach (IFilter filter in filters)
    {
        Type t = filter.GetType();
        pluginDictionary.Add(filter.Name, t.Module.Name);
    }
}

and show their name in a checkbox list. upon selection of dll from checkbox.

i have import statement as

[Import]
public IEnumerable<IFilter> filters { get; set; }

currently my program is running fine. what i did is when i check a plugin from checkbox list. it moves it into “loaded” directory and and they QueryPlugin() method looks into “loaded” directory to search for plugins.

upon unchecking plugin from checkbox list. i move it out of “loaded” directory…

What i want is to use batch.RemovePart() method to get rid of this rapid moving of dlls from one directory to other….

NOTE: i am not adding plugins manually into batch using

batch.AddPart(new DemoFilter1());

instead of this i used DirectoryCatalog();;

  • 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-11T19:38:21+00:00Added an answer on May 11, 2026 at 7:38 pm

    Instead of using a DirectoryCatalog, use an AggregateCatalog and add an AssemblyCatalog for each assembly in the directory to the aggregate catalog. Then when a plugin is checked or unchecked, you can add or remove the corresponding AssemblyCatalog to the AggregateCatalog.

    Note that there may be problems with this approach if there is more than one plugin in a given assembly. A more robust approach could be filtering individual part definitions using a filtered catalog.

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

Sidebar

Related Questions

Im currently working with two actors in scala. One, the producer , produces some
I currently working with PictureBox and facing one problem. First, I have drawn one
currently working on generation elliptic curve for ECDSA and met some problems: An elliptic
Currently working for the first time with JSON and with little experience of jQuery.
Currently working on a VBScript to automate some of the dirty PST ingestion work
Currently working through a Teach Yourself WPF tutorial. Usually I can mentally convert from
Im currently working on a Python/Pygame module to wrap some basic sprite animation. Animation
I'm currently working on learning some game development with Java. I'm working on the
Am currently working on a web application which receives the encoded text from the
Im currently working on making a flash platformer engine...but my collision detect needs some

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.