コード例 #1
0
 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;
 }
コード例 #2
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;
 }
コード例 #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);
        }