protected override IEnumerable <RouteBase> BuildRoutes(RouteStrategyMarkupFileInfo file) { return(getRouteList(file.AppRelativePath) .Select(url => new DotvvmRoute(url, file.AppRelativePath, GetRouteDefaultParameters(file), GetRoutePresenterFactory(file), this.configuration) { RouteName = url })); }
/// <summary> /// Builds a route for the specified markup file. /// </summary> protected virtual RouteBase BuildRoute(RouteStrategyMarkupFileInfo file) { var routeName = GetRouteName(file); var url = GetRouteUrl(file); var defaultParameters = GetRouteDefaultParameters(file); var presenterFactory = GetRoutePresenterFactory(file); return(new DotvvmRoute(url, file.AppRelativePath, defaultParameters, presenterFactory, configuration) { RouteName = routeName }); }
/// <summary> /// Builds a route for the specified markup file. /// </summary> protected virtual RouteBase BuildRoute(RouteStrategyMarkupFileInfo file) { var routeName = GetRouteName(file); var url = GetRouteUrl(file); var defaultParameters = GetRouteDefaultParameters(file); var presenterFactory = GetRoutePresenterFactory(file); return new DotvvmRoute(url, file.AppRelativePath, defaultParameters, presenterFactory) { RouteName = routeName }; }
protected virtual object GetRouteDefaultParameters(RouteStrategyMarkupFileInfo file) { return(null); }
protected virtual string GetRouteUrl(RouteStrategyMarkupFileInfo file) { var pathWithoutExtension = file.ViewsFolderRelativePath.Substring(0, file.ViewsFolderRelativePath.Length - ".dothtml".Length); return(pathWithoutExtension); }
protected virtual string GetRouteName(RouteStrategyMarkupFileInfo file) { return(GetRouteUrl(file).Replace('/', '_')); }
/// <summary> /// Builds a set of routes for the specified markup file. /// </summary> protected virtual IEnumerable <RouteBase> BuildRoutes(RouteStrategyMarkupFileInfo file) => new [] { this.BuildRoute(file) };
protected virtual Func <IDotvvmPresenter> GetRoutePresenterFactory(RouteStrategyMarkupFileInfo file) { return(configuration.RouteTable.GetDefaultPresenter); }
protected virtual Func<IDotvvmPresenter> GetRoutePresenterFactory(RouteStrategyMarkupFileInfo file) { return configuration.RouteTable.GetDefaultPresenter; }
protected virtual object GetRouteDefaultParameters(RouteStrategyMarkupFileInfo file) { return null; }
protected virtual string GetRouteUrl(RouteStrategyMarkupFileInfo file) { var pathWithoutExtension = file.ViewsFolderRelativePath.Substring(0, file.ViewsFolderRelativePath.Length - ".dothtml".Length); return pathWithoutExtension; }
protected virtual string GetRouteName(RouteStrategyMarkupFileInfo file) { return GetRouteUrl(file).Replace('/', '_'); }