title: Using Unity instead of ASP.Net Core DI IServiceCollection
body: <p>More and more .NET Core libraries is bound to <code>IServiceCollection</code>. In example, I want to use <code>HttpClientFactory</code> described <a href="https://github.com/aspnet/HttpClientFactory/wiki/Consumption-Patterns" rel="noreferrer">here</a> in my NET Framework 4.7.1. desktop application. My application is using Unity IoC. I referenced <code>Microsoft.Extensions.Http</code> as NuGet.</p>
  
  <p>But there is a problem: new ASP.Net Core components are bound to Microsoft DI framework for .NetCore - <code>IServiceCollection</code>. In example, registration of <code>HttpClientFactory</code> is here:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddHttpClient();
  }
  </code></pre>
  
  <p>I was going deeper into <a href="https://github.com/aspnet/HttpClientFactory" rel="noreferrer">MS code</a> and wanted to manually register corresponding interfaces and classes to Unity. This is how services are registered by IServiceCollection:</p>
  
  <pre><code>services.TryAddTransient&lt;HttpMessageHandlerBuilder, DefaultHttpMessageHandlerBuilder&gt;();
  services.TryAddSingleton&lt;IHttpClientFactory, DefaultHttpClientFactory&gt;();
  </code></pre>
  
  <p>This would be no problem to move this to Unity IoC, but I am stucked when I want to register <code>DefaultHttpMessageHandlerBuilder</code> and <code>DefaultHttpClientFactory</code> which have <strong>internal</strong> visibility. So they are not available for registration outside of MS code.</p>
  
  <p>Do I have any chance how to resolve this situation? </p>