示例#1
0
        public void RegisterRoute(IRoute route)
        {
            var matchingRoutes = _routes.Where(x => x.Name == route.Name).ToList();

            if (matchingRoutes.Count > 0)
            {
                foreach (var r in matchingRoutes)
                {
                    if (route.Match(r.GetParmaNames()))
                        throw new InvalidRouteException(string.Format("There is already a route registered which matches you route name [{0}] and parameters you supplied", route.Name));
                }
            }

            _routes.Add(route);
        }
示例#2
0
        public void RegisterRoute(IRoute route)
        {
            var matchingRoutes = _routes.Where(x => x.Name == route.Name).ToList();

            if (matchingRoutes.Count > 0)
            {
                foreach (var r in matchingRoutes)
                {
                    if (route.Match(r.GetParmaNames()))
                    {
                        throw new InvalidRouteException(string.Format("There is already a route registered which matches you route name [{0}] and parameters you supplied", route.Name));
                    }
                }
            }


            _routes.Add(route);
        }