title: How to inject SignalR Hub Class (not hubcontext) into Controller
body: <pre><code>public class ComputerHub : Hub
  {
      private readonly DbContext _db;
      public ComputerHub(DbContext db)
      {
         _db = db;
      }
  
      public Task OpenLock(string connectionId)
      {
         return Clients.Client(connectionId).SendAsync("OpenLock");
      }
  ...
  }
  </code></pre>
  
  <p>Startup.cs</p>
  
  <pre><code>  public void ConfigureServices(IServiceCollection services)
    {
         ...
         services.AddSignalR();
    }
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        ....
        app.UseSignalR(routes =&gt;
              {
                  routes.MapHub&lt;ComputerHub&gt;("/computerhub");
              });
        ....
    }
  </code></pre>
  
  <p>I want to reach the OpenLock method in a controller. How should I add to ServiceCollection the computerhub in the startup.cs.</p>