title: Inject one service that uses methods from multiple interfaces
body: <p>I am trying to inject an instance of a service into my <code>NameController</code>. The service uses methods from multiple service classes, so I'm doing this with multiple interface inheritance. </p>
  
  <p>With the code I provided, using <code>_oneThreeService</code> I am actually able to access all the methods that <code>OneService.cs</code> and <code>TwoService.cs</code> contain. However, when I run the application, I get an error that states: <code>InvalidOperationException: Unable to resolve service for type 'ServiceClassLibrary.IOneThreeService' while attempting to activate 'Web.Controllers.NameController'.</code></p>
  
  <p>In the ConfigureServices method, I have tried adding this line <code>services.AddScoped&lt;IOneThreeService, OneService, ThreeService&gt;();</code> but that can't be done.</p>
  
  <p>What I want is to be able to use methods from those two service classes by injecting only one service into the controller.</p>
  
  <p>Startup.cs > ConfigureServices method:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
        services.AddScoped&lt;IOneService, OneService&gt;();
        services.AddScoped&lt;ITwoService, TwoService&gt;();
        services.AddScoped&lt;IThreeService, ThreeService&gt;();
  
        services.AddControllersWithViews();
  }
  </code></pre>
  
  <p>IOneThreeService.cs:</p>
  
  <pre><code>public interface IOneThreeService : IOneService, IThreeService
  {
  
  }
  </code></pre>
  
  <p>NameController.cs:</p>
  
  <pre><code>public class NameController : Controller
  {
      private readonly IOneThreeService _oneThreeService;
  
      public NameController(IOneThreeService oneThreeService)
      {
          _oneThreeService = oneThreeService;
      }
  
      [HttpGet]
      public IActionResult Index()
      {
          _oneThreeService.MethodFromOneService();
          _oneThreeService.MethodFromTwoService();
  
          return View();
      }
  }
  </code></pre>