Skip to content

Instantly share code, notes, and snippets.

@bzbetty
Created November 15, 2012 09:23
Show Gist options
  • Save bzbetty/4077607 to your computer and use it in GitHub Desktop.
Save bzbetty/4077607 to your computer and use it in GitHub Desktop.
public class InjectedRouteConstraint<T> : IRouteConstraint where T : IRouteConstraint
{
private IDependencyResolver _dependencyResolver { get; set; }
public InjectedRouteConstraint(IDependencyResolver dependencyResolver)
{
_dependencyResolver = dependencyResolver;
}
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
{
return _dependencyResolver.GetService<T>().Match(httpContext, route, parameterName, values, routeDirection);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment