private void ConstructFastPathTable() { this.noTemplateHasQueryPart = true; foreach (KeyValuePair <UriTemplate, object> pair in this.templates) { UriTemplate key = pair.Key; if (!UriTemplateHelpers.CanMatchQueryTrivially(key)) { this.noTemplateHasQueryPart = false; } if (key.HasNoVariables && !key.HasWildcard) { if (this.fastPathTable == null) { this.fastPathTable = new Dictionary <string, FastPathInfo>(); } Uri uri = key.BindByPosition(this.originalUncanonicalizedBaseAddress, new string[0]); string uriPath = UriTemplateHelpers.GetUriPath(uri); if (!this.fastPathTable.ContainsKey(uriPath)) { FastPathInfo info = new FastPathInfo(); if (this.ComputeRelativeSegmentsAndLookup(uri, info.RelativePathSegments, info.Candidates)) { info.Freeze(); this.fastPathTable.Add(uriPath, info); } } } } }
void ConstructFastPathTable() { this.noTemplateHasQueryPart = true; foreach (KeyValuePair <UriTemplate, object> kvp in this.templates) { UriTemplate ut = kvp.Key; if (!UriTemplateHelpers.CanMatchQueryTrivially(ut)) { this.noTemplateHasQueryPart = false; } if (ut.HasNoVariables && !ut.HasWildcard) { // eligible for fast path if (this.fastPathTable == null) { this.fastPathTable = new Dictionary <string, FastPathInfo>(); } Uri uri = ut.BindByPosition(this.originalUncanonicalizedBaseAddress); string uriPath = UriTemplateHelpers.GetUriPath(uri); if (this.fastPathTable.ContainsKey(uriPath)) { // nothing to do, we've already seen it } else { FastPathInfo fpInfo = new FastPathInfo(); if (ComputeRelativeSegmentsAndLookup(uri, fpInfo.RelativePathSegments, fpInfo.Candidates)) { fpInfo.Freeze(); this.fastPathTable.Add(uriPath, fpInfo); } } } } }