/// <summary> /// Gets route. /// </summary> /// <param name="routePath"> /// The route path. /// </param> /// <returns> /// The <see cref="Route"/>. /// </returns> /// <exception cref="Exception"> /// Generic exception - Route Not found. /// </exception> public static Route GetRoute(string routePath) { object routeObj = IoC.GetInstance(typeof(Route), routePath); if ((routeObj == null) || !(routeObj is Route)) { throw new Exception(string.Format("No route found for route path = {0}.", routePath)); } return (Route)routeObj; }
/// <summary> /// The get route. /// </summary> /// <param name="routePath"> /// The route path. /// </param> /// <returns> /// The <see cref="Route"/>. /// </returns> /// <exception cref="Exception"> /// Generic exception - Route Not found. /// </exception> public static Route GetRoute(RoutePath routePath) { object routeObj = IoC.GetInstance(typeof(Route), routePath.Key); if ((routeObj == null) || !(routeObj is Route)) { throw new Exception($"No route found for method:{routePath.Method} route path:{routePath.Path}."); } return((Route)routeObj); }
/// <summary> /// The get route. /// </summary> /// <param name="commandPath"> /// The command path. /// </param> /// <returns> /// The <see cref="Command"/>. /// </returns> /// <exception cref="Exception"> /// Generic exception - Route Not found. /// </exception> public static Command GetCommand(string commandPath) { var key = Command.GetKeyFromPath(commandPath); object commandObj = IoC.GetInstance(typeof(Command), key); if ((commandObj == null) || !(commandObj is Command)) { throw new Exception($"No route found for command with key:{key}."); } return((Command)commandObj); }