Moved the routing up a level.

This commit is contained in:
David Fowler 2013-12-14 16:11:13 -08:00
parent 81a4cfbfbf
commit e7ade37b3f
2 changed files with 9 additions and 5 deletions

View File

@ -20,12 +20,13 @@ namespace Microsoft.AspNet.Mvc
_serviceProvider = serviceProvider ?? MvcServices.Create();
}
public Task ExecuteAsync(IOwinContext context)
public Task ExecuteAsync(IOwinContext context, IRouteData routeData)
{
var routeData = new FakeRouteData(context);
var requestContext = new RequestContext(context, routeData);
IActionInvokerFactory invokerFactory = _serviceProvider.GetService<IActionInvokerFactory>();
var invoker = invokerFactory.CreateInvoker(new RequestContext(context, routeData));
var invoker = invokerFactory.CreateInvoker(requestContext);
return invoker.InvokeActionAsync();
}

View File

@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Routing;
using Microsoft.Owin;
using Owin;
@ -16,10 +17,12 @@ namespace MvcSample
var handler = new MvcHandler();
// Pretending to be routing
app.Run(async context =>
{
await handler.ExecuteAsync(context);
// Pretending to be routing
var routeData = new FakeRouteData(context);
await handler.ExecuteAsync(context, routeData);
});
}
}