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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:54:40+00:00 2026-05-15T06:54:40+00:00

I have a plugin that I will instantiate at runtime and I want to

  • 0

I have a plugin that I will instantiate at runtime and I want to pass it a WCF service from the application host. The application host is responsible for creating the connection to the service. The reason for this is that a single service can be used by multiple plugins, but the plugins should only know about its interface since there may be several implementation of IMyPluginServices. For instance, the Run method of the plugin instance would be:

    public void Run(IMyPluginServices services)
    {
        services.DoSomething();
    }

The problem I am running into is that I don’t know how to create a service of type IMyPluginServices and pass it to the Run function. The service reference generated by VS 2010 doesn’t seem to create an object of type IMyPluginServices that I can pass to it. Any help would be greatly appreciated. Thanks.

  • 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-15T06:54:41+00:00Added an answer on May 15, 2026 at 6:54 am

    When you add a service reference in VS 2010 for a service it generates an interface named IMyService which contains methods for each OperationContract in your service. It also generates a concrete class named MyServiceClient, which can be constructed and then used to invoke your service.

    Now, the problem that you’re running into, I believe, is that MyServiceClient is a subclass of ClientBase<IMyService>, and does not implement the generated IMyService interface (which is a real pain).

    To get around this problem I ended up making a new interface:

    public interface IMyServiceClient : IMyService, IDisposable, ICommunicationObject
    {
    }
    

    (Note: IDisposable and ICommunicationObject are only required if you want your module to be able to detect/react to faulted channels and other such things).

    I then extend MyServiceClient with a partial class (in the assembly that contains my WCF Service reference):

    public partial class MyServiceClient : IMyServiceClient
    {
    }
    

    Now in my modules I can accept an IMyServiceClient instead of an IMyService, and still execute all of the methods that I need to. The application in control of the modules can still create instances of MyServiceClient as it always did.

    The beauty of this is that your new interface and partial class don’t need any actual code – the definitions suffice to get the job done.

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

Sidebar

Related Questions

I'm writing a web application that will have plugins. The plugins will be .DLL
I have an ActiveX plugin that we need (if possible) to run in Firefox.
I have a plugin for an RCP app that uses BIRT. I have a
Typically I create a plugin when I have a module that I know I'm
I have a plug-in to an Eclipse RCP application that has a view. After
I have a C++ Windows application that can be extended by writing C++ plugins,
I have findbugs plugin for eclipse which when run on my project will show
I would like to write a Chrome plugin that will communicate with my native
I have a .exe and many plug-in .dll modules that the .exe loads. (I
I have two unrelated processes that use .NET assemblies as plugins. However, either process

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.