private ISearchRequest AttachCustomConverterWhenNeeded <T, TResult>(RouteValues p, ISearchRequest d)
     where T : class
     where TResult : class
 {
     d.RequestParameters.DeserializationOverride(this.CreateSearchDeserializer <T, TResult>(d));
     return(d);
 }
        public string Resolve(RouteValues routeValues, IConnectionSettingsValues settings)
        {
            if (_fixedUrl != null)
            {
                return(_fixedUrl);
            }

            var resolved = routeValues.Resolve(settings);

            if (!Routes.TryGetValue(resolved.Count, out var routes))
            {
                throw new Exception($"No route taking {resolved.Count} parameters{_errorMessageSuffix}");
            }

            if (routes.Count == 1)
            {
                return(routes[0].ToUrl(resolved));
            }

            //find the first url with N parts that has all provided named parts
            foreach (var u in routes)
            {
                if (u.Matches(resolved))
                {
                    return(u.ToUrl(resolved));
                }
            }
            throw new Exception($"No route taking {routeValues.Count} parameters{_errorMessageSuffix}");
        }
Beispiel #3
0
        protected override string ResolveUrl(RouteValues routeValues, IConnectionSettingsValues settings)
        {
            if (Self.PointInTime is object && !string.IsNullOrEmpty(Self.PointInTime.Id) && routeValues.ContainsKey("index"))
            {
                routeValues.Remove("index");
            }

            return(base.ResolveUrl(routeValues, settings));
        }
 protected virtual string ResolveUrl(RouteValues routeValues, IConnectionSettingsValues settings) => ApiUrls.Resolve(routeValues, settings);
 private TRequest CovariantConverterWhenNeeded <T, TResult, TRequest, TRequestParameters>(RouteValues p, TRequest d)
     where T : class
     where TResult : class
     where TRequest : IRequest <TRequestParameters>, ICovariantSearchRequest
     where TRequestParameters : IRequestParameters, new()
 {
     d.RequestParameters.DeserializationOverride = this.CreateSearchDeserializer <T, TResult, TRequest, TRequestParameters>(d);;
     return(d);
 }
 public DispatchException(string msg, RouteValues provided) : base(msg)
 {
     Provided = provided;
 }