public IRouterBuilder Register(RouteSpecification route, RouteDestination destination, bool defaultType = true)
        {
            if (route.Context == null)
            {
                if (!_TypeToRoute.ContainsKey(destination.Type))
                {
                    _TypeToRoute.Add(destination.Type, route.Name);
                }
            }

            var routeToType = GetRoutes(route);

            if (!defaultType && routeToType.ContainsKey(route.Name))
            {
                return(this);
            }

            routeToType[route.Name] = destination;
            return(this);
        }
        public RouteDestination SolveType(RouteSpecification route)
        {
            var routeToType = GetRoutes(route);

            return(routeToType.GetOrDefault(route.Name));
        }
 private Dictionary <string, RouteDestination> GetRoutes(RouteSpecification route)
 {
     return(route.Context == null
         ? _RouteToType : _ContextualRouteToType.GetOrAddEntity(route.Context, _ => new Dictionary <string, RouteDestination>()));
 }