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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:20:53+00:00 2026-05-16T12:20:53+00:00

I have following wrapper to help me manage the wcf client lifetime: public class

  • 0

I have following wrapper to help me manage the wcf client lifetime:

public class ServiceProxyHelper<TProxy, TChannel> : IDisposable
      where TProxy : ClientBase<TChannel>, new()
      where TChannel : class
   {
      private TProxy m_proxy;

      public TProxy Proxy
      {
         get
         {
            if (m_proxy != null)
            {
               return m_proxy;
            }
            throw new ObjectDisposedException("ServiceProxyHelper");
         }
      }

      protected ServiceProxyHelper()
      {
         m_proxy = new TProxy();
      }

      public void Dispose()
      {
          //....
      }
}

I’m using that in the following way:

   public class AccountServiceClientWrapper : ServiceProxyHelper<AccountServiceClient, IAccountService>
   {
   }

   public class Test()
   {
      using(AccountServiceClientWrapper wrapper = new AccountServiceClientWrapper())
      {
         wrapper.Proxy.Authenticate();
      }
   }

How I can modify that code to provide endpointConfigurationName for the client ?

wrapper.Proxy.Endpoint.Name = "MyCustomEndpointName";

Is not working. That endpointConfigurationName should be provider to service client constructor, but how I can do that using this wrapper ?

Regards

  • 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-16T12:20:53+00:00Added an answer on May 16, 2026 at 12:20 pm

    Perhaps you can use Activator.CreateInstance to create the proxy instance passing endpointConfigurationName as a parameter. For example,

    protected ServiceProxyHelper(string endpointConfigurationName )
    {
      m_proxy = (TProxy)Activator.CreateInstance(typeof(TProxy), endpointConfigurationName);
    }
    

    This will be an additional constructor in your wrapper to allow passing end point config name. Only flaw would be in case proxy type does not support such constructor, you will get an runtime exception instead of compile time error.

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

Sidebar

Related Questions

I have the following DOM: <div class=qtip qtip-light qtip-active> <div class=qtip-wrapper> <div class=qtip-borderTop></div> <div
I have following method in wcf webenabled service Public Person AddPerson(Person p); As of
I have following class public class ButtonChange { private int _buttonState; public void SetButtonState(int
I have the following HTML: <div class=wrapper> <div class=label> foor bar baz </div> <img
Say I have the following abstract class: class AbstractClass { public: AbstractClass() {} virtual
I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,
I have the following: Javascript: $(.bg .thumb_wrapper).click(function() { $(.bg .thumb_wrapper).removeClass(active); $(this).addClass(active); }); So every
I have following requirement, I have C#/.Net console application, which refers to 'System.Data.Sqlite.dll' 'System.Data.Sqlite.dll'
I have following code in my application: // to set tip - photo in
I have following requirement in my application. A tableView with games title After selecting

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.