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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:37:53+00:00 2026-06-08T07:37:53+00:00

I have a simple plugin system in a piece of code I have written.

  • 0

I have a simple plugin system in a piece of code I have written. Basically, it takes a Type, which inherits from a base class, and calls “CreateInstance” on it. I then invoke the methods in this instance. The super class lives in an SDK DLL and contains no special logic/code, just skeleton methods which are overridden when a plugin is made.

I want to be able to make an object available to the plugin developers, called “SystemLog”, which will let them write log output. My question is, how can I populate this object when I create the instance, unless I make it public with get/set accessors? I would like it to be read-only to the plugin developer, as I don’t want them overwriting it in some way.

  • 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-08T07:37:54+00:00Added an answer on June 8, 2026 at 7:37 am

    I see two questions here:

    1. How to pass SystemLog to the plugin wants to use it?
    2. How to protect SystemLog from plugins?

    Let me start from the 2-nd one. You can declare something like

    public interface ISystemLogger 
    { 
      void log(String message);
    }
    

    And implement simple kind of wrapper on top of the SystemLog (instance of this wrapper you could pass to the plugins). So plugins know only about ISystemLoggger interface and not about any kind of it’s implementation

    private sealed class SystemLoggerPluginWrapper : ISystemLogger
    {
      private readonly SystemLog inner;
    
      public SystemLoggerPluginWrapper(SystemLog inner) {
        this.inner = inner;
      }
    
      public void log(string message)
      {
        inner.log(message);
      }
    }
    
    1. If you do not use any kind of dependency injection and create instance manually you could call pluginType.GetConstructors() iterate though them and if there is one that has exactly single parameter of type ISystemLogger instead if calling CreateInstance(Type) you call CreateInstance(Type, Object[]) and pass an instance of wrapper above.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have simple class with width and height member fields which define number of
I'm looking to a framework which will allow me to have a simple plugin
I'm using the wonderfully lightweight jQuery minitabs plugin from: http://code.google.com/p/minitabs/ which is a lovely
I have written a simple Magento plugin that simply lists all sub categories that
I wrote the following jQuery plugin that is basically just a simple notification system
I am writing a simple plugin system for my .NET app written in C#.
I'm trying to implement a simple plugin system which will allow people to write
so I implemented a really simple plugin system. i have the following Assemblies: MainApp
I have simple facebook connect plugin on a wordpress blog and have integrated the
I have created a simple WordPress plugin that automatically sets my new sites up

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.