private static void AddRouteData(PortalRequest request, PortalResponse response, Route route) { if (route == null) { return; } request.MergeTokens(route.GetTokens(request.Path)); NameValueCollection queryString = request.QueryString; if (queryString.Count > 0) { RouteTokens queryTokens = new RouteTokens(); foreach (string s in queryString) { queryTokens.Add(s, queryString[s]); } request.MergeTokens(queryTokens); } request.ControllerName = route.ControllerName ?? request.GetTokenValue(ControllerNameToken); foreach (TileDefinition tile in route.Tiles) { response.Tiles.Add(tile); } if (!Compare.IsNullOrEmpty(route.PageTitle)) { request.Title = FormattableObject.ToString(request.Tokens.ToDictonary(), route.PageTitle, null); } }
internal void MergeTokens(RouteTokens tokens) { if (tokens == null) { return; } if (Tokens == null) { Tokens = new RouteTokens(); } Tokens.Merge(tokens); }
void IPortalRequest.AddToken(string name, string value) { Argument.Assert.IsNotNullOrEmpty(name, nameof(name)); if (!Compare.IsNullOrEmpty(value)) { value = value.Trim(segmentSeperatorCharArray); } if (Tokens == null) { Tokens = new RouteTokens(); } Tokens.Add(name, value); }