public static UriMakerContext MapHttpAttributeRoutesAndUseUriMaker(
     this HttpConfiguration configuration,
     IDirectRouteProvider directRouteProvider = null)
 {
     directRouteProvider = directRouteProvider ?? new DefaultDirectRouteProvider();
     var decorator = new DecoratorRouteProvider(directRouteProvider);
     configuration.MapHttpAttributeRoutes(decorator);
     var uriMakerContext = new UriMakerContext(decorator.RouteMap);
     return uriMakerContext;
 }
 public static UriMakerContext MapHttpAttributeRoutesAndUseUriMaker(
     this HttpConfiguration configuration,
     IDirectRouteProvider directRouteProvider = null,
     Func<HttpRequestMessage, ICollection<RouteEntry>, RouteEntry> routeSelector = null)
 {
     directRouteProvider = directRouteProvider ?? new DefaultDirectRouteProvider();
     var decorator = new DecoratorRouteProvider(directRouteProvider, routeSelector);
     configuration.MapHttpAttributeRoutes(decorator);
     var uriMakerContext = new UriMakerContext(decorator.RouteMap);
     configuration.Properties.AddOrUpdate(ContextKey, _ => uriMakerContext, (_, __) => uriMakerContext);
     return uriMakerContext;
 }
Exemplo n.º 3
0
        public static UriMakerContext MapHttpAttributeRoutesAndUseUriMaker(
            this HttpConfiguration configuration,
            IDirectRouteProvider directRouteProvider = null,
            Func <HttpRequestMessage, ICollection <RouteEntry>, RouteEntry> routeSelector = null)
        {
            directRouteProvider = directRouteProvider ?? new DefaultDirectRouteProvider();
            var decorator = new DecoratorRouteProvider(directRouteProvider, routeSelector);

            configuration.MapHttpAttributeRoutes(decorator);
            var uriMakerContext = new UriMakerContext(decorator.RouteMap);

            configuration.Properties.AddOrUpdate(ContextKey, _ => uriMakerContext, (_, __) => uriMakerContext);
            return(uriMakerContext);
        }