title: HttpClientFactory how to inject into class I have no control over core 2.1
body: <p>I would like to use the new <code>HttpClientFactory</code> and I am having trouble setting it up.</p>
  
  <p>I have the following  (Just noddy examples I put together to explain my point)</p>
  
  <pre><code>public class MyGitHubClient
  {
      public MyGitHubClient(HttpClient client)
      {
          Client = client;
      }
  
      public HttpClient Client { get; }
  }
  </code></pre>
  
  <p>Then in my <code>webapi.Startup</code> I have </p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddHttpClient&lt;MyGitHubClient&gt;(client =&gt;
      {
          client.BaseAddress = new Uri("https://api.github.com/");
         //etc..              
      });
  
      //NOW I get error "Class name is not valid at this point" for "MyGitHubClient" below
  
      services.AddSingleton&lt;IThirdPartyService&gt;(x =&gt; new ThirdPartyService(MyGitHubClient,someOtherParamHere));
  
      ///etc...
  }
  </code></pre>
  
  <p>Third party constructor</p>
  
  <pre><code>    public ThirdPartyService(HttpClient httpClient, string anotherParm)
      {
  
      }       
  </code></pre>
  
  <p>How can I use the <code>HttpClientFactory</code> when I have to call a class that I have no control over?</p>