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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:24:06+00:00 2026-06-12T21:24:06+00:00

My application implements a modular architecture that can dynamically load one or more plugin

  • 0

My application implements a modular architecture that can dynamically load one or more “plugin” assemblys. Each assembly contains a class implementing an IPlugin interface, providing various methods and properties that the host app uses to interact with the plugin.

This class inevitably has dependencies on other classes within the plugin, and these may in turn have their own dependencies. So far I’ve been managing all this using Castle Windsor (each plugin contains an IWindsorInstaller where I register its dependencies), and doing DI via their constructors. The downside is that the classes have to be public for this approach to work.

I’ve now come to my senses and want to lock down the plugin by making all these classes internal, however I’m not sure of the best way to do handle the dependencies as presumably I won’t be able to use Windsor. I don’t want the classes to instantiate their own dependencies (not loosely-coupled, lack of testability, etc.), so what other approaches are there?

  • 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-06-12T21:24:07+00:00Added an answer on June 12, 2026 at 9:24 pm

    The downside is that the classes have to be public for this approach
    to work.

    This is not true. You can register stuff that is internal, but you’ll probably loose the auto-wiring (automatic constructor injection) feature of Castle Windsor (or any DI container for that matter). You can register internal stuff by registering delegates that create those types manually. For instance:

    container.Register(Component.For<IService>()
        .UsingFactoryMethod(() =>
        {
            var log = container.Resolve<ILogger>();
            return new RealService(log);
        })
        .LifeStyle.Transient);
    

    Manually creating services with new is suboptimal, since auto-wiring keeps the composition root of your plug in assembly the most maintainability, but I don’t think there is a good alternative in your situation. Still, this is better than letting each service create its own dependencies (poor man’s DI).

    UPDATE

    I remembered something: It should be possible to still do auto-wiring with internal types, when you register those internal types using the generic methods, such as this one:

    container.Register(Component.For<IService>()
        .ImplementedBy<RealService());
    

    For this to work, the constructor of RealService has to be public (but RealService itself can be internal). This even works in a partial trust, such as when running in the very restrictive the Silverlight sandbox (or at least, it works with Simple Injector, but Castle should be able to do this as well).

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

Sidebar

Related Questions

Can anyone provide me an example WinForms application that implements the concept of User
I have to write an application that implements a secure connection between client and
I made an application and i have in it a FrameLayout that implements an
I have a Silverlight application that implements some basic CRUD operations on a fairly
I currently have a web-application that implements a rudimentary form of ACL using UNIONs
I have an ASP.NET MVC web application that implements a custom membership provider. The
I have an existing ASP.NET application that implements Forms Authentication site-wide. The application is
I have a main application window that also implements a dock panel. At the
Can anyone tell me how to follow a modular architecture and create MVC3 Razor
I'm fleshing out a WPF business application in my head and one thing that

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.