Instead of replacing the IAppActivator, you can simply register the arguments of the Startup constructor with the Katana ServiceProvider.
IAppActivator , Startup. , WebApp.Start, ServiceProvider:
public class MyService : IMyService
{
private readonly IMyOtherService _myOtherService;
public MyService(IMyOtherService myOtherService)
{
_myOtherService = myOtherService;
}
}
public class Startup
{
private readonly IMyService _myService;
public Startup(IMyService myService)
{
_myService = myService
}
public void Configuration(IAppBuilder app)
{
app.MapSignalR(new HubConfiguration { Resolver = ... });
}
}
using System;
using Microsoft.Owin.Hosting;
using Microsoft.Owin.Hosting.Services;
using Microsoft.Owin.Hosting.Starter;
public class Program
{
static void Main(string[] args)
{
var url = "http://localhost:8080";
var services = (ServiceProvider)ServicesFactory.Create();
var options = new StartOptions(url);
services.Add<IMyOtherService, MyOtherService>();
services.Add<IMyService, MyService>();
var starter = services.GetService<IHostingStarter>();
using (starter.Start(options))
{
Console.WriteLine("Server running on {0}", url);
Console.ReadLine();
}
}
}
WebApp.Start Program.Main, , IHostingStarter.Start, : http://katanaproject.codeplex.com/SourceControl/changeset/view/c726b87e90c05677a256ca1821bac481f402d6bd#src/Microsoft.Owin.Hosting/WebApp.cs
ServiceProvider.Add, : http://msdn.microsoft.com/en-us/library/microsoft.owin.hosting.services.serviceprovider(v=vs.111).aspx
, Katana IAppActivator StartOptions.Settings, .
, , Startup , .