Skip to content

Instantly share code, notes, and snippets.

@stevenharman
Created July 13, 2010 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenharman/474275 to your computer and use it in GitHub Desktop.
Save stevenharman/474275 to your computer and use it in GitHub Desktop.
For<UrlHelper>()
.HybridHttpOrThreadLocalScoped()
.Use(ctx =>
{
var httpContext = new HttpContextWrapper(HttpContext.Current);
var routeData = RouteTable.Routes.GetRouteData(httpContext);
return new UrlHelper(new RequestContext(httpContext, routeData));
});
For<IUrlHelper>()
.HybridHttpOrThreadLocalScoped()
.Use(ctx => new MvcUrlHelper(ctx.GetInstance<UrlHelper>()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment