Esempio n. 1
0
        public bool TryGet(Type inputType, out RouteDefinition route)
        {
            if (routeTable.TryGet(inputType, out route))
            {
                // If the URL in route is absolute, nothing is needed.
                if (Uri.TryCreate(route.Url, UriKind.Absolute, out Uri url))
                {
                    return(true);
                }

                if (route.Url.StartsWith("~/"))
                {
                    string relativeUrl = route.Url.Substring(1);
                    route = new RouteDefinition(baseUrl + relativeUrl, route.Method, route.RequestSerializer, route.ResponseDeserializer, route.ContentType);
                    return(true);
                }
            }

            route = null;
            return(false);
        }
Esempio n. 2
0
 public bool TryGet(Type inputType, out RouteDefinition route)
 {
     Ensure.NotNull(inputType, "inputType");
     return(storage.TryGetValue(inputType, out route));
 }