Further stylistic tweaks

This commit is contained in:
SteveSandersonMS
2016-05-31 22:29:27 +01:00
parent 5bb92d02dd
commit cb289fd387
10 changed files with 64 additions and 42 deletions

View File

@@ -24,9 +24,14 @@ namespace Microsoft.AspNetCore.SpaServices
string routeKey,
RouteValueDictionary values,
RouteDirection routeDirection)
=> !HasDotInLastSegment(values[_clientRouteTokenName] as string ?? string.Empty);
{
return !HasDotInLastSegment(values[_clientRouteTokenName] as string ?? string.Empty);
}
private bool HasDotInLastSegment(string uri)
=> uri.IndexOf('.', uri.LastIndexOf('/') + 1) >= 0;
{
var lastSegmentStartPos = uri.LastIndexOf('/');
return uri.IndexOf('.', lastSegmentStartPos + 1) >= 0;
}
}
}

View File

@@ -17,13 +17,15 @@ namespace Microsoft.AspNetCore.Builder
object defaults,
object constraints = null,
object dataTokens = null)
=> MapSpaFallbackRoute(
{
MapSpaFallbackRoute(
routeBuilder,
name,
/* templatePrefix */ null,
defaults,
constraints,
dataTokens);
}
public static void MapSpaFallbackRoute(
this IRouteBuilder routeBuilder,
@@ -34,7 +36,6 @@ namespace Microsoft.AspNetCore.Builder
object dataTokens = null)
{
var template = CreateRouteTemplate(templatePrefix);
var constraintsDict = ObjectToDictionary(constraints);
constraintsDict.Add(ClientRouteTokenName, new SpaRouteConstraint(ClientRouteTokenName));