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

The Archive Base Latest Questions

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

Note: All sample code is greatly simplified. I have a DLL defined as: using

  • 0

Note: All sample code is greatly simplified.

I have a DLL defined as:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Web;

namespace RIV.Module
{
    public interface IModule
    {
        StringWriter ProcessRequest(HttpContext context);
        string Decrypt(string interactive);
        string ExecutePlayerAction(object ParamObjectFromFlash);
        void LogEvent(object LoggingObjectFromFlash);
    }
}

Now, outside of my solution, other developers can define concrete classes and drop them into the BIN folder of my app. Maybe something like:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RIV.Module;

namespace RIV.Module.Greeting
{
    public class Module : IModule
    {
        public System.IO.StringWriter ProcessRequest(System.Web.HttpContext context)
        {
            //...
        }
        public string Decrypt(string interactive)
        {
            //...
        }
        public string ExecutePlayerAction(object ParamObjectFromFlash)
        {
            //...
        }
        public void LogEvent(object LoggingObjectFromFlash)
        {
            //...
        }
    }
}

Now, in my app I would need to know that a new Module was available (I am guessing via web.config or something along those lines) and then be able to call it based off of some trigger in the database Campaign table (which maps to the module to use for that specific campaign).

I am trying to instantiate it this way:

var type = typeof(RIV.Module.Greeting.Module);
var obj = (RIV.Module.Greeting.Module)Activator.CreateInstance(type);

However, the compiler belches because a reference was never set to RIV.Module.Greeting.dll!

What am I doing wrong?

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

    Instead of typeof(RIV.Module.Greeting.Module), try using

    var type = Type.GetType("RIV.Module.Greeting.Module, RIV.Module.Greeting");
    

    (i.e. load the type by specifying its assembly-qualified name as string) and casting to IModule.

    This approach requires you to know the exact class and assembly names of the modules (as you wrote, they could be stored in web.config).

    Alternatively, you could go for a completely dynamic plugin approach:

    1. establish a convention that all module assemblies should be named “RIV.Module.XYZ”
    2. scan the bin directory for matching DLLs
    3. for each DLL, load it (e.g. Assembly.Load) and scan for types implementing IModule
    4. instantiate all found types and cast to IModule
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

NOTE: Using .NET 2.0, and VS2005 as IDE Hello all, I'm working on logging
I have a sample I'm building, that's using the Northwind database. I have a
Currently, my VBA code creates a single file for each note. Here's some simplified
We all know that having a good note taking tool is important as a
NOTE: I am not set on using VI, it is just the first thing
Note : The code in this question is part of deSleeper if you want
Note The question below was asked in 2008 about some code from 2003. As
(Note: This is for MySQL's SQL, not SQL Server.) I have a database column
My question is best illustrated with a code sample, so let's just start off
So I'm using rspec to test my code as I'm going through the Rails

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.