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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:20:03+00:00 2026-05-31T15:20:03+00:00

I am writing a program that uses IoC(Windsor v3.0) at startup to load all

  • 0

I am writing a program that uses IoC(Windsor v3.0) at startup to load all assemblies in a directory, if implementing an interface/service, into a repository for the core of the application. I am, however, a newcomer to Windsor. My app polls a DB table and when it finds a row that needs to be processed, it checks the name of the service to process the record and requests it from the repository. I can load all the modules into the dictionary and then into the repository via configuration as in this post. Good and well, but I need it to be more dynamic.

How I envision it (pseudo-code):

List<string> enabledServices = GetServicesFromDb();
IDictionary<string, IModule> dict = new IDictionary<string, IModule>();

//Load the assemblies (This works currently!)
_container.Register(AllTypes
                   .FromAssemblyInDirectory(new AssemblyFilter("Modules"))
                   .BasedOn<IModule>());

// Build dictionary
foreach(string service in enabledServices)
{
     foreach(?? asmble in _container.assemblies)
     {
         if(asmble.Id == service)
             dict.Add(service, asmble);
     }
}

// Register the repository from constructed dictionary
_container.Register(
    Component
    .For<IModuleRepository>()
    .ImplementedBy<IntegrationRepository>()
    .Parameters(new { modules = dict})
);

The repository:

public class IntegrationRepository : IModuleRepository
{
    private readonly IDictionary<string, IModule> _modules;

    public IntegrationRepository(IDictionary<string, IModule> modules)
    {
        _modules = modules;
    }

    public IModule GetModule(string moduleName)
    {
        return _modules.ContainsKey(moduleName) ? _modules[moduleName] : null;
    }
}

IModule looks like this:

public interface IModule : IDisposable
{
    string Id { get; }
    string Description { get; }
    bool Enabled { get; set; }
    bool Validate();
    string EmailSubject { get; }
}

All modules:

  1. Implement “IModule” interface
  2. Reside in the “Modules” subfolder
  3. Share a common namespace

I don’t have enough experience with Windsor to know how to iterate through the container or if its possible, and _container.ResolveAll(); doesn’t seem to work… at least the way I have it in my mind.

My thoughts come from this example which alludes to passing the object in if the object is already created. And this which is similar. I also saw some interesting things on the DictionaryAdapterFactory() but not confident enough to know how to use it

Is something like this possible? Any ideas?

  • 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-31T15:20:04+00:00Added an answer on May 31, 2026 at 3:20 pm

    instead of all this you can just store your container globally and you can resolve by full name your modules everywhere

    _container.Resolve<IModule>(serviceFullName)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a program that uses FileSystemWatcher to monitor changes to a given directory,
I'm writing a program that uses File I/O to traverse through a directory given
I am writing this chat program that uses ncurses as the interface. How am
I am currently writing a program that uses AJAX to load a form for
I'm writing a small program in C# that uses SQL to store values into
I am writing a program that uses prints a hex dump of its input.
I'm writing a program that uses regular expressions to make comparisons against the entire
I'm planning on writing a program for Linux that uses text to speech and
I'm writing a custom text-to-speech program that uses SAPI 5, and one problem I'm
I'm writing a program that for performance reasons uses shared memory (sockets and pipes

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.