Exemplo n.º 1
0
 public RouteFinder(IRouteExplorer routeExplorer, IShortestRouteFinder shortestRouteFinder, IDatabaseReader databaseReader, IRouteValidator routeValidator)
 {
     this.routeExplorer       = routeExplorer;
     this.shortestRouteFinder = shortestRouteFinder;
     this.databaseReader      = databaseReader;
     this.routeValidator      = routeValidator;
 }
Exemplo n.º 2
0
 public OfferSearchService(IDataRepository <Offer> repository, ITomtomApi tomtomApi,
                           IRouteFinder routeFinder, IRouteValidator routeValidator)
 {
     _repository     = repository;
     _tomtomApi      = tomtomApi;
     _routeFinder    = routeFinder;
     _routeValidator = routeValidator;
 }
Exemplo n.º 3
0
        public void AddValidator(IRouteValidator validator)
        {
            if (_validators == null)
            {
                _validators = new List <IRouteValidator>();
            }

            _validators.Add(validator);
        }
        public DynamicConfigBuilder(
            IBackendsRepo backendsRepo,
            IRoutesRepo routesRepo,
            IRouteValidator parsedRouteValidator)
        {
            Contracts.CheckValue(backendsRepo, nameof(backendsRepo));
            Contracts.CheckValue(routesRepo, nameof(routesRepo));
            Contracts.CheckValue(parsedRouteValidator, nameof(parsedRouteValidator));

            _backendsRepo         = backendsRepo;
            _routesRepo           = routesRepo;
            _parsedRouteValidator = parsedRouteValidator;
        }
Exemplo n.º 5
0
 public DynamicConfigBuilder(
     IEnumerable <IProxyConfigFilter> filters,
     IClustersRepo clustersRepo,
     IRoutesRepo routesRepo,
     IRouteValidator parsedRouteValidator,
     IEnumerable <ISessionAffinityProvider> sessionAffinityProviders,
     IEnumerable <IAffinityFailurePolicy> affinityFailurePolicies)
 {
     _filters                  = filters ?? throw new ArgumentNullException(nameof(filters));
     _clustersRepo             = clustersRepo ?? throw new ArgumentNullException(nameof(clustersRepo));
     _routesRepo               = routesRepo ?? throw new ArgumentNullException(nameof(routesRepo));
     _parsedRouteValidator     = parsedRouteValidator ?? throw new ArgumentNullException(nameof(parsedRouteValidator));
     _sessionAffinityProviders = sessionAffinityProviders?.ToProviderDictionary() ?? throw new ArgumentNullException(nameof(sessionAffinityProviders));
     _affinityFailurePolicies  = affinityFailurePolicies?.ToPolicyDictionary() ?? throw new ArgumentNullException(nameof(affinityFailurePolicies));
 }
Exemplo n.º 6
0
 public DynamicConfigBuilder(
     IEnumerable <IProxyConfigFilter> filters,
     IBackendsRepo backendsRepo,
     IRoutesRepo routesRepo,
     IRouteValidator parsedRouteValidator)
 {
     Contracts.CheckValue(filters, nameof(filters));
     Contracts.CheckValue(backendsRepo, nameof(backendsRepo));
     Contracts.CheckValue(routesRepo, nameof(routesRepo));
     Contracts.CheckValue(parsedRouteValidator, nameof(parsedRouteValidator));
     _filters              = filters;
     _backendsRepo         = backendsRepo;
     _routesRepo           = routesRepo;
     _parsedRouteValidator = parsedRouteValidator;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Route"/> class.
        /// </summary>
        /// <param name="routeSpecification">The path specification, which gives the pattern that paths will
        /// follow. For example, "/patients/{action}".</param>
        /// <param name="routeHandler">A delegate that will produce a route handler when needed for this
        /// route.</param>
        /// <param name="defaults">The default values of this route.</param>
        /// <param name="constraints">The constraints that will apply to this route.</param>
        /// <param name="parser">An object charged with parsing the route specification, producing a
        /// <see cref="ParsedRoute"/>.</param>
        /// <param name="validator">An object charged with validating the route configuration, ensuring the
        /// route doesn't violate any expectations around how a route can be declared.</param>
        public Route(string routeSpecification, Func <IRouteHandler> routeHandler, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteParser parser, IRouteValidator validator)
        {
            Guard.ArgumentNotNull(routeHandler, "routeHandler");

            pathSpecification = routeSpecification ?? string.Empty;
            this.routeHandler = routeHandler;

            this.validator   = validator ?? new RouteValidator();
            this.defaults    = defaults ?? new RouteValueDictionary();
            this.constraints = constraints ?? new RouteValueDictionary();

            this.parser = parser ?? new RouteParser(
                new ParameterSegmentRecognizer(),
                new LiteralSegmentRecognizer(),
                new CatchAllParameterSegmentRecognizer()
                );
        }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Route"/> class.
        /// </summary>
        /// <param name="routeSpecification">The path specification, which gives the pattern that paths will
        /// follow. For example, "/patients/{action}".</param>
        /// <param name="routeHandler">A delegate that will produce a route handler when needed for this
        /// route.</param>
        /// <param name="defaults">The default values of this route.</param>
        /// <param name="constraints">The constraints that will apply to this route.</param>
        /// <param name="parser">An object charged with parsing the route specification, producing a
        /// <see cref="ParsedRoute"/>.</param>
        /// <param name="validator">An object charged with validating the route configuration, ensuring the
        /// route doesn't violate any expectations around how a route can be declared.</param>
        public Route(string routeSpecification, Func<IRouteHandler> routeHandler, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteParser parser, IRouteValidator validator)
        {
            Guard.ArgumentNotNull(routeHandler, "routeHandler");

            pathSpecification = routeSpecification ?? string.Empty;
            this.routeHandler = routeHandler;

            this.validator = validator ?? new RouteValidator();
            this.defaults = defaults ?? new RouteValueDictionary();
            this.constraints = constraints ?? new RouteValueDictionary();
            
            this.parser = parser ?? new RouteParser(
                new ParameterSegmentRecognizer(),
                new LiteralSegmentRecognizer(),
                new CatchAllParameterSegmentRecognizer()
                );
        }
Exemplo n.º 9
0
 public DynamicConfigBuilder(
     IEnumerable <IProxyConfigFilter> filters,
     IBackendsRepo backendsRepo,
     IRoutesRepo routesRepo,
     IRouteValidator parsedRouteValidator,
     IEnumerable <ISessionAffinityProvider> sessionAffinityProviders,
     IEnumerable <IAffinityFailurePolicy> affinityFailurePolicies)
 {
     Contracts.CheckValue(filters, nameof(filters));
     Contracts.CheckValue(backendsRepo, nameof(backendsRepo));
     Contracts.CheckValue(routesRepo, nameof(routesRepo));
     Contracts.CheckValue(parsedRouteValidator, nameof(parsedRouteValidator));
     Contracts.CheckValue(sessionAffinityProviders, nameof(sessionAffinityProviders));
     Contracts.CheckValue(affinityFailurePolicies, nameof(affinityFailurePolicies));
     _filters                  = filters;
     _backendsRepo             = backendsRepo;
     _routesRepo               = routesRepo;
     _parsedRouteValidator     = parsedRouteValidator;
     _sessionAffinityProviders = sessionAffinityProviders.ToProviderDictionary();
     _affinityFailurePolicies  = affinityFailurePolicies.ToPolicyDictionary();
 }
Exemplo n.º 10
0
Arquivo: Route.cs Projeto: Niels-R/mvc
        public void AddValidator(IRouteValidator validator)
        {
            if (_validators == null)
                _validators = new List<IRouteValidator>();

            _validators.Add(validator);
        }
Exemplo n.º 11
0
 public RoutesConsoleReader()
 {
     routeInputParser = new RouteInputParser();
     routeValidator   = new RouteValidator();
 }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Route"/> class.
 /// </summary>
 /// <param name="routeSpecification">The path specification, which gives the pattern that paths will
 /// follow. For example, "/patients/{action}".</param>
 /// <param name="routeHandler">A delegate that will produce a route handler when needed for this
 /// route.</param>
 /// <param name="defaults">The default values of this route.</param>
 /// <param name="constraints">The constraints that will apply to this route.</param>
 /// <param name="validator">An object charged with validating the route configuration, ensuring the
 /// route doesn't violate any expectations around how a route can be declared.</param>
 public Route(string routeSpecification, Func <IRouteHandler> routeHandler, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteValidator validator)
     : this(routeSpecification, routeHandler, defaults, constraints, null, validator)
 {
 }
Exemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Route"/> class.
 /// </summary>
 /// <param name="routeSpecification">The path specification, which gives the pattern that paths will
 /// follow. For example, "/patients/{action}".</param>
 /// <param name="routeHandler">A delegate that will produce a route handler when needed for this
 /// route.</param>
 /// <param name="defaults">The default values of this route.</param>
 /// <param name="constraints">The constraints that will apply to this route.</param>
 /// <param name="validator">An object charged with validating the route configuration, ensuring the 
 /// route doesn't violate any expectations around how a route can be declared.</param>
 public Route(string routeSpecification, Func<IRouteHandler> routeHandler, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteValidator validator)
     : this(routeSpecification, routeHandler, defaults, constraints, null, validator)
 {
 }