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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:20:59+00:00 2026-05-27T00:20:59+00:00

I am trying to build a core application that uses plugins so that the

  • 0

I am trying to build a core application that uses plugins so that the core never changes and each time we get a new client we write a module for them. We implement a interface called IClientPlugin with the new customer class.

This is using Compact Framework 3.5 and windows mobile 6.5.3.

So here is what I need to acheive:

this is a warehouse management system. The first task is to receive in the product from a truck scanning barcodes off packages with the handheld device.

The core module for this is started when the person clicks the receiving menu item.

the core method is – callClientMethod()

I know the client name and it is stored in a global variable at login and the class will be {clientname}.cs
and contain a method called processReceiving().

I know how to instantiate this object.

The question is: is there a way I can dynamically create a instance of the client class without hardcoding case statements?

For example suppose I have 2 clients Acme and Widgets. They each get a client class, namely Acme.cs and Widgets.cs

If I login as Acme or Widgets I want the code to dynamically create a instance of the Client class that I logged in as so that the core code does not have to change as I add more clients as long as I add a module for them.

psuedo example:

var myClient = New (Clientname)();

Is this possible or is there a better design approach or is the switch/case statement a neccessary evil?

  • 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-27T00:20:59+00:00Added an answer on May 27, 2026 at 12:20 am

    You can use reflection to create objects dynamically.
    There are many ways to load a type or assembly. Lets start with a simple one:

    Type clientType = Type.GetType("AssemblyName, TypeName");
    IClientPlugin clientPlugin = 
                       (IClientPlugin)Activator.CreateInstance(clientType);    
    

    If your client is named myClient1 and you have the convention, that your assemblies are named for example like Clients.ClientName.dll then you can write a function:

    IClientPlugin CreatePluginInstance(string clientName) {
        string typeName = string.Format("Clients.{0}, {0}", clientName);
        Type clientType = Type.GetType(typeName);
        IClientPlugin clientPluginInstance = 
                          (IClientPlugin)Activator.CreateInstance(clientType);    
        return clientPluginInstance;
    }
    

    EDIT

    If your plugin classes are located in the same assembly as your main project, you can simplify the call of Type.GetType to just specify the classname:

    Type.GetType(clientName);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build an iPhone application using core data's built in table
Trying to build a GUI application in Java/Swing. I'm mainly used to painting GUIs
I have a website I've built in django that I'm trying to get working
I have been working for 6 hours trying to get my standard core functions
I'm trying to build a dual platform application for a company of my own
I have an application that is finished except for the problem i am trying
I have been trying to build a modular web application. My requirements are to
We're trying to do an Eclipse PDE build for a RCP Application via Hudson/Jenkins.
I'm trying to build a reusable $.ajax method for my current application but I'm
I am trying to build a rails login process with devise that will allow

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.