react to breaking change in routing

This commit is contained in:
Ryan Nowak 2015-12-18 10:54:14 -08:00
parent 8fb187bf09
commit d25ea4be6d
1 changed files with 5 additions and 20 deletions

View File

@ -10,27 +10,12 @@ namespace InlineConstraintSample.Web
{ {
public class Startup public class Startup
{ {
// Set up application services
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.ConfigureRouting( services.AddRouting( routeOptions =>
routeOptions => routeOptions.ConstraintMap.Add(
"IsbnDigitScheme10",
typeof(IsbnDigitScheme10Constraint)));
services.ConfigureRouting(
routeOptions => routeOptions.ConstraintMap.Add(
"IsbnDigitScheme13",
typeof(IsbnDigitScheme10Constraint)));
// Update an existing constraint from ConstraintMap for test purpose.
services.ConfigureRouting(
routeOptions =>
{ {
if (routeOptions.ConstraintMap.ContainsKey("IsbnDigitScheme13")) routeOptions.ConstraintMap.Add("IsbnDigitScheme10", typeof(IsbnDigitScheme10Constraint));
{ routeOptions.ConstraintMap.Add("IsbnDigitScheme13", typeof(IsbnDigitScheme13Constraint));
routeOptions.ConstraintMap["IsbnDigitScheme13"] = typeof(IsbnDigitScheme13Constraint);
}
}); });
// Add MVC services to the services container // Add MVC services to the services container