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

  • Home
  • SEARCH
  • 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 278221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T01:12:14+00:00 2026-05-12T01:12:14+00:00

This is a question about tidyness. The project is already working, I’m satisfied with

  • 0

This is a question about tidyness. The project is already working, I’m satisfied with the design but I have a couple of loose ends that I’d like to tie up.

My project has a plugin architecture. The main body of the program dispatches work to the plugins that each reside in their own AppDomain.

The plugins are described with an interface, which is used by the main program (to get the signature for invoking DispatchTaskToPlugin) and by the plugins themselves as an API contract:

namespace AppServer.Plugin.Common
{
     public interface IAppServerPlugin
     {
        void Register();
        void DispatchTaskToPlugin(Task t);
        // Other methods omitted
     }
}

In the main body of the program Register() is called so that the plugin can register its callback methods with the base class, and then later DispatchTaskToPlugin() is called to get the plugin running.

The plugins themselves are in two parts. There’s a base class that implements the framework for the plugin (setup, housekeeping, teardown, etc..). This is where DispatchTaskToPlugin is actually defined:

namespace AppServer.Plugin
{
    abstract public class BasePlugin : MarshalByRefObject,
           AppServer.Plugin.Common.IAppServerPlugin
    {

        public void DispatchTaskToPlugin(Task t)
        {
            // ...
            // Eventual call to actual plugin code
            //
        }

        // Other methods omitted
    }
}

The actual plugins themselves only need to implement a Register() method (to give the base class the delegates to call eventually) and then their business logic.

namespace AppServer.Plugin
{
    public class Plugin : BasePlugin
    {
        override public void Register()
        {
             // Calls a method in the base class to register itself.
        }
        // Various callback methods, business logic, etc...
    }
}

Now in the base class (BasePlugin) I’ve implemented all kinds of convenience methods, collected data, etc.. for the plugins to use. Everything’s kosher except for that lingering method DispatchTaskToPlugin().

It’s not supposed to be callable from the Plugin class implementations — they have no use for it. It’s only needed by the dispatcher in the main body of the program. How can I prevent the derived classes (Plugin) from seeing the method in the base class (BasePlugin/DispatchTaskToPlugin) but still have it visible from outside of the assembly?

I can split hairs and have DispatchTaskToPlugin() throw an exception if it’s called from the derived classes, but that’s closing the barn door a little late. I’d like to keep it out of Intellisense or possibly have the compiler take care of this for me.

Suggestions?

  • 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-12T01:12:15+00:00Added an answer on May 12, 2026 at 1:12 am

    If the plugins are only really meant to override one method, I suggest you make them implement an interface with just the one method in. Then your current BasePlugin can use composition instead of inheritance to deal with “real” plugin based just on the interface. It may need to pass something into Register so that the plugin can subscribe to events, but that can be expressed as an interface as well, so that the plugin only sees what you want it to.

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

Sidebar

Related Questions

I have a question about this question . I posted a reply there but
This is a question about style and design rather than syntax. I have domain
This question is about App domains and Sessions. Is it possible to have IIS
( This question about refactoring F# code got me one down vote, but also
This question about Timers for windows services got me thinking: Say I have (and
I've just read this question , and I have a question about it: How
I've seen this question about advice for C# programmers writing Python code but I
This question refers to affiliate marketing, but really is a generic question about intercepting
This question is a follow up to my previous question about getting the HTML
I was reading this question about how to parse URLs out of web pages

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.