ASP.NET MVC5+ 中 "exists" 路由约束的文档在哪里?

Where is the documentation for the "exists" routing constraint in ASP.NET MVC5+?

在了解 MVC6 中的区域处理故事时,我 keep coming across blog posts 在路由模式中有 area:exists,但无论我如何努力搜索,我都找不到任何关于此的内容所有 Microsoft 文档和我发现的 none 博客文章都解释了它在做什么或提到了这些信息的来源。

哪里解释了这个约束,哪里有关于内置路由模式和约束的全面、最新、规范的文档?作为记录,我知道 this 页面,但它的结构更像是教程而不是规范参考。

如果来自 Microsoft 的任何人正在阅读此内容,http://www.asp.net/mvc/overview/api-reference 会导致一个几乎没有任何信息的页面和未同步的 table 内容,我无法找到我想要的内容想要内。并且您的 RouteAttribute class 参考没有指向任何解释 url 模式应该是什么样子的链接。

编辑

所以在深入挖掘之后,我发现了这个: https://github.com/aspnet/Mvc/blob/48bfdceea6d243c5ec8d6e00f450f8fe7cce59f7/src/Microsoft.AspNet.Mvc.Core/MvcCoreRouteOptionsSetup.cs#L26

所以它与 KnownRouteValueConstraint 有关,这让我想到了这个: https://github.com/aspnet/Mvc/blob/e0b8532735997c439e11fff68dd342d5af59f05f/src/Microsoft.AspNet.Mvc.Core/KnownRouteValueConstraint.cs#L26-L40

所以我想这意味着约束只是确保捕获的值不为空。我仍然不知道该信息的规范来源在哪里。

由于 ASP.NET 5/MVC 6 是 not yet officially released 而目前 API 还不稳定,因此文档尚未完成也就不足为奇了.

请注意 ASP.NET vNext 是开源的,因此在缺少文档的地方,您可以随时查看测试以尝试找出要做什么。 Here are some 测试内联约束 area:exists.

[Fact]
public async Task RoutingToANonExistantArea_WithExistConstraint_RoutesToCorrectAction()
{
    // Arrange
    var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
    var client = server.CreateClient();

    // Act
    var response = await client.GetAsync("http://localhost/area-exists/Users");

    // Assert
    Assert.Equal(HttpStatusCode.OK, response.StatusCode);
    var returnValue = await response.Content.ReadAsStringAsync();
    Assert.Equal("Users.Index", returnValue);
}

[Fact]
public async Task RoutingToANonExistantArea_WithoutExistConstraint_RoutesToIncorrectAction()
{
    // Arrange
    var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
    var client = server.CreateClient();

    // Act
    var response = await client.GetAsync("http://localhost/area-withoutexists/Users");

    // Assert
    var exception = response.GetServerException();
    Assert.Equal("The view 'Index' was not found." +
                 " The following locations were searched:__/Areas/Users/Views/Home/Index.cshtml__" +
                 "/Areas/Users/Views/Shared/Index.cshtml__/Views/Shared/Index.cshtml.",
                 exception.ExceptionMessage);
}