Skip to content

Instantly share code, notes, and snippets.

@Antaris
Created February 24, 2017 11:50
Show Gist options
  • Save Antaris/11770ce7289e46031bd9cc5bd49a35a9 to your computer and use it in GitHub Desktop.
Save Antaris/11770ce7289e46031bd9cc5bd49a35a9 to your computer and use it in GitHub Desktop.
public class DynamicRouter : IRouter
{
private IRouter _router;
public DynamicRouter(IRouter router)
{
_router = router;
}
public Task RouteAsync(RouteContext context)
=> _router.RouteAsync(context);
public VirtualPathData GetVirtualPathData(VirtualPathContext context)
=> _router.GetVirtualPathData(context);
public void SetRouter(IRouter router)
{
_router = router;
}
}
@Antaris
Copy link
Author

Antaris commented Feb 24, 2017

var router = new DynamicRouter(routes);
app.UseRouter(router);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment