Merge remote-tracking branch 'Mvc/rybrande/masterToSrc' into rybrande/MondoMaster

This commit is contained in:
Ryan Brandenburg 2018-11-27 15:47:27 -08:00
commit b465db3f53
983 changed files with 6949 additions and 26045 deletions

View File

@ -1,9 +1,7 @@
<Project>
<PropertyGroup>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">$(MicrosoftNETCoreApp21PackageVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.2' ">$(MicrosoftNETCoreApp22PackageVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>
<NETStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion>
<!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use -->
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
</PropertyGroup>
</Project>

View File

@ -28,10 +28,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Co
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Test", "test\Microsoft.AspNetCore.Mvc.Test\Microsoft.AspNetCore.Mvc.Test.csproj", "{5F945B82-FE5F-425C-956C-8BC2F2020254}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.WebApiCompatShim", "src\Microsoft.AspNetCore.Mvc.WebApiCompatShim\Microsoft.AspNetCore.Mvc.WebApiCompatShim.csproj", "{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.WebApiCompatShimTest", "test\Microsoft.AspNetCore.Mvc.WebApiCompatShimTest\Microsoft.AspNetCore.Mvc.WebApiCompatShimTest.csproj", "{5DE8E4D9-AACD-4B5F-819F-F091383FB996}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.TagHelpers", "src\Microsoft.AspNetCore.Mvc.TagHelpers\Microsoft.AspNetCore.Mvc.TagHelpers.csproj", "{B2347320-308E-4D2B-AEC8-005DFA68B0C9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.TagHelpers.Test", "test\Microsoft.AspNetCore.Mvc.TagHelpers.Test\Microsoft.AspNetCore.Mvc.TagHelpers.Test.csproj", "{860119ED-3DB1-424D-8D0A-30132A8A7D96}"
@ -193,26 +189,6 @@ Global
{5F945B82-FE5F-425C-956C-8BC2F2020254}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5F945B82-FE5F-425C-956C-8BC2F2020254}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{5F945B82-FE5F-425C-956C-8BC2F2020254}.Release|x86.ActiveCfg = Release|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Debug|x86.ActiveCfg = Debug|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Release|Any CPU.Build.0 = Release|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Release|x86.ActiveCfg = Release|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Debug|x86.ActiveCfg = Debug|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Release|Any CPU.Build.0 = Release|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Release|x86.ActiveCfg = Release|Any CPU
{B2347320-308E-4D2B-AEC8-005DFA68B0C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2347320-308E-4D2B-AEC8-005DFA68B0C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2347320-308E-4D2B-AEC8-005DFA68B0C9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@ -628,8 +604,6 @@ Global
{3F6E355E-4869-41D9-943B-D54771221A7F} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{A8AA326E-8EE8-4F11-B750-23028E0949D7} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{5F945B82-FE5F-425C-956C-8BC2F2020254} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
{5DE8E4D9-AACD-4B5F-819F-F091383FB996} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{B2347320-308E-4D2B-AEC8-005DFA68B0C9} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
{860119ED-3DB1-424D-8D0A-30132A8A7D96} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{F504357E-C2E1-4818-BA5C-9A2EAC25FEE5} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}

View File

@ -53,12 +53,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilesWebSite", "test\WebSit
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationModelWebSite", "test\WebSites\ApplicationModelWebSite\ApplicationModelWebSite.csproj", "{CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.WebApiCompatShim", "src\Microsoft.AspNetCore.Mvc.WebApiCompatShim\Microsoft.AspNetCore.Mvc.WebApiCompatShim.csproj", "{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApiCompatShimWebSite", "test\WebSites\WebApiCompatShimWebSite\WebApiCompatShimWebSite.csproj", "{B2B7BC91-688E-4C1E-A71F-CE948D958DDF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.WebApiCompatShimTest", "test\Microsoft.AspNetCore.Mvc.WebApiCompatShimTest\Microsoft.AspNetCore.Mvc.WebApiCompatShimTest.csproj", "{5DE8E4D9-AACD-4B5F-819F-F091383FB996}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.TagHelpers", "src\Microsoft.AspNetCore.Mvc.TagHelpers\Microsoft.AspNetCore.Mvc.TagHelpers.csproj", "{B2347320-308E-4D2B-AEC8-005DFA68B0C9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.TagHelpers.Test", "test\Microsoft.AspNetCore.Mvc.TagHelpers.Test\Microsoft.AspNetCore.Mvc.TagHelpers.Test.csproj", "{860119ED-3DB1-424D-8D0A-30132A8A7D96}"
@ -354,36 +348,6 @@ Global
{CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Release|x86.ActiveCfg = Release|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Debug|x86.ActiveCfg = Debug|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Release|Any CPU.Build.0 = Release|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}.Release|x86.ActiveCfg = Release|Any CPU
{B2B7BC91-688E-4C1E-A71F-CE948D958DDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2B7BC91-688E-4C1E-A71F-CE948D958DDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2B7BC91-688E-4C1E-A71F-CE948D958DDF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B2B7BC91-688E-4C1E-A71F-CE948D958DDF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B2B7BC91-688E-4C1E-A71F-CE948D958DDF}.Debug|x86.ActiveCfg = Debug|Any CPU
{B2B7BC91-688E-4C1E-A71F-CE948D958DDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2B7BC91-688E-4C1E-A71F-CE948D958DDF}.Release|Any CPU.Build.0 = Release|Any CPU
{B2B7BC91-688E-4C1E-A71F-CE948D958DDF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B2B7BC91-688E-4C1E-A71F-CE948D958DDF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B2B7BC91-688E-4C1E-A71F-CE948D958DDF}.Release|x86.ActiveCfg = Release|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Debug|x86.ActiveCfg = Debug|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Release|Any CPU.Build.0 = Release|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{5DE8E4D9-AACD-4B5F-819F-F091383FB996}.Release|x86.ActiveCfg = Release|Any CPU
{B2347320-308E-4D2B-AEC8-005DFA68B0C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2347320-308E-4D2B-AEC8-005DFA68B0C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2347320-308E-4D2B-AEC8-005DFA68B0C9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@ -1002,9 +966,6 @@ Global
{6DB9B8D0-80F7-4E70-BBB0-0B4C04D79A47} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{0EF9860B-10D7-452F-B0F4-A405B88BEBB3} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{CAE52CB7-0FAC-4B5B-8251-B0FF837DB657} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{23D30B8C-04B1-4577-A604-ED27EA1E4A0E} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
{B2B7BC91-688E-4C1E-A71F-CE948D958DDF} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{5DE8E4D9-AACD-4B5F-819F-F091383FB996} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{B2347320-308E-4D2B-AEC8-005DFA68B0C9} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
{860119ED-3DB1-424D-8D0A-30132A8A7D96} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{920F8A0E-6F7D-4BBE-84FF-840B89099BE6} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}

View File

@ -3,7 +3,7 @@ ASP.NET Core MVC
**Note: For ASP.NET MVC 5.x, Web API 2.x, and Web Pages 3.x (not ASP.NET Core), see https://github.com/aspnet/AspNetWebStack**
Travis: [![Travis](https://travis-ci.org/aspnet/Mvc.svg?branch=release/2.2)](https://travis-ci.org/aspnet/Mvc)
Travis: [![Travis](https://travis-ci.org/aspnet/Mvc.svg?branch=master)](https://travis-ci.org/aspnet/Mvc)
ASP.NET Core MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and gives you full control over markup for enjoyable, agile development. ASP.NET Core MVC includes many features that enable fast, TDD-friendly development for creating sophisticated applications that use the latest web standards.

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<TargetFrameworks Condition=" '$(DeveloperBuild)' != 'true' AND '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net461</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks Condition="'$(BenchmarksTargetFramework)' != ''">$(BenchmarksTargetFramework)</TargetFrameworks>
<DefineConstants Condition=" '$(GenerateSqlScripts)'=='true' ">$(DefineConstants);GENERATE_SQL_SCRIPTS</DefineConstants>
@ -38,6 +37,6 @@
Use All meta-package and not App to include Microsoft.EntityFrameworkCore.Sqlite.
-->
<ItemGroup Condition="'$(BenchmarksTargetFramework)' != ''">
<PackageReference Include="Microsoft.AspNetCore.All" Version="$(MicrosoftAspNetCoreAllPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="$(MicrosoftAspNetCoreAppPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -7,7 +7,7 @@
"PresetHeaders": "Json",
"ReadyStateText": "Application started.",
"Source": {
"BranchOrCommit": "release/2.2",
"BranchOrCommit": "master",
"Project": "benchmarkapps/BasicApi/BasicApi.csproj",
"Repository": "https://github.com/aspnet/mvc.git"
}
@ -19,20 +19,20 @@
},
"BasicApi.GetUsingQueryString": {
"ClientProperties": {
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/release/2.2/benchmarkapps/BasicApi/getWithToken.lua"
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/master/benchmarkapps/BasicApi/getWithToken.lua"
},
"Path": "/pet/findByStatus",
"Query": "?status=available"
},
"BasicApi.GetUsingRouteValue": {
"ClientProperties": {
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/release/2.2/benchmarkapps/BasicApi/getWithToken.lua"
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/master/benchmarkapps/BasicApi/getWithToken.lua"
},
"Path": "/pet/-1"
},
"BasicApi.GetUsingRouteValueWithoutAuthorization": {
"ClientProperties": {
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/release/2.2/benchmarkapps/BasicApi/getWithToken.lua"
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/master/benchmarkapps/BasicApi/getWithToken.lua"
},
"Path": "/pet/anonymous/-1"
},
@ -41,14 +41,14 @@
},
"BasicApi.Post": {
"ClientProperties": {
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/release/2.2/benchmarkapps/BasicApi/postJsonWithToken.lua"
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/master/benchmarkapps/BasicApi/postJsonWithToken.lua"
},
"Path": "/pet"
},
"BasicApi.PostWithoutDb": {
"Path": "/pet/add-pet",
"ClientProperties": {
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/release/2.2/benchmarkapps/BasicApi/postJsonWithToken.lua"
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/master/benchmarkapps/BasicApi/postJsonWithToken.lua"
}
}
}

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<TargetFrameworks Condition=" '$(DeveloperBuild)' != 'true' AND '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net461</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks Condition="'$(BenchmarksTargetFramework)' != ''">$(BenchmarksTargetFramework)</TargetFrameworks>
<DefineConstants Condition=" '$(GenerateSqlScripts)'=='true' ">$(DefineConstants);GENERATE_SQL_SCRIPTS</DefineConstants>
@ -38,7 +37,7 @@
Use All meta-package and not App to include Microsoft.EntityFrameworkCore.Sqlite.
-->
<ItemGroup Condition="'$(BenchmarksTargetFramework)' != ''">
<PackageReference Include="Microsoft.AspNetCore.All" Version="$(MicrosoftAspNetCoreAllPackageVersion)" />
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftAspNetCoreAllPackageVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="$(MicrosoftAspNetCoreAppPackageVersion)" />
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftAspNetCoreAppPackageVersion)" PrivateAssets="All" />
</ItemGroup>
</Project>

View File

@ -7,7 +7,7 @@
"PresetHeaders": "Html",
"ReadyStateText": "Application started.",
"Source": {
"BranchOrCommit": "release/2.2",
"BranchOrCommit": "master",
"Project": "benchmarkapps/BasicViews/BasicViews.csproj",
"Repository": "https://github.com/aspnet/mvc.git"
}
@ -20,19 +20,19 @@
},
"BasicViews.Post": {
"ClientProperties": {
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/release/2.2/benchmarkapps/BasicViews/postWithToken.lua"
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/master/benchmarkapps/BasicViews/postWithToken.lua"
},
"Path": "/Home/Index"
},
"BasicViews.PostIgnoringToken": {
"ClientProperties": {
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/release/2.2/benchmarkapps/BasicViews/postWithToken.lua"
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/master/benchmarkapps/BasicViews/postWithToken.lua"
},
"Path": "/Home/IndexWithoutToken"
},
"BasicViews.PostWithoutToken": {
"ClientProperties": {
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/release/2.2/benchmarkapps/BasicViews/post.lua"
"Scripts": "https://raw.githubusercontent.com/aspnet/Mvc/master/benchmarkapps/BasicViews/post.lua"
},
"Path": "/Home/IndexWithoutToken"
}

View File

@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks Condition="'$(BenchmarksTargetFramework)' != ''">$(BenchmarksTargetFramework)</TargetFrameworks>
</PropertyGroup>
<!-- These references are used when running locally -->
@ -16,8 +17,8 @@
These references are used when running on the Benchmarks Server.
-->
<ItemGroup Condition="'$(BenchmarksTargetFramework)' != ''">
<PackageReference Include="Microsoft.AspNetCore.App" Version="$(MicrosoftNETCoreApp22PackageVersion)" />
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETCoreApp22PackageVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="$(MicrosoftAspNetCoreAppPackageVersion)" />
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftAspNetCoreAppPackageVersion)" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />

View File

@ -0,0 +1,21 @@
using System;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Razor;
public static class HelperExtensions
{
public static Func<T1, IHtmlContent> Helper<T1>(
this RazorPageBase page,
Func<T1, Func<object, IHtmlContent>> helper
) => p1 => helper(p1)(null);
public static Func<T1, T2, IHtmlContent> Helper<T1, T2>(
this RazorPageBase page,
Func<T1, T2, Func<object, IHtmlContent>> helper
) => (p1, p2) => helper(p1, p2)(null);
public static Func<T1, T2, T3, IHtmlContent> Helper<T1, T2, T3>(
this RazorPageBase page,
Func<T1, T2, T3, Func<object, IHtmlContent>> helper
) => (p1, p2, p3) => helper(p1, p2, p3)(null);
}

View File

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<!-- Workaround https://github.com/dotnet/core-setup/issues/3726 -->
<GenerateDependencyFile>false</GenerateDependencyFile>
<_EnableAllInclusiveRazorSdk>true</_EnableAllInclusiveRazorSdk>
<RazorLangVersion>3.0</RazorLangVersion>
<RazorDefaultConfiguration>MVC-3.0</RazorDefaultConfiguration>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc\Microsoft.AspNetCore.Mvc.csproj" />
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" PrivateAssets="All" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,6 @@
namespace Microsoft.AspNetCore.Mvc.Performance
{
public class ViewAssemblyMarker
{
}
}

View File

@ -0,0 +1,7 @@
@using System;
@using Microsoft.AspNetCore.Html
@model System.String
@{Func<dynamic, IHtmlContent> SomeHelper = @<text>@{
@item
}</text>;}
@for (var i = 0; i < 100; i++){@SomeHelper(Model + i.ToString())}

View File

@ -0,0 +1,10 @@
@using System;
@using Microsoft.AspNetCore.Html
@model System.String
@{
var SomeHelper = this.Helper((string s) => @<text>@item</text>);
}
@for (var i = 0; i < 100; i++)
{
@SomeHelper(Model + i.ToString())
}

View File

@ -0,0 +1,7 @@
@using System;
@using Microsoft.AspNetCore.Html
@model System.String
@for (var i = 0; i < 100; i++)
{
await Html.RenderPartialAsync("~/Views/HelperPartial_Partial.cshtml", Model + i.ToString());
}

View File

@ -0,0 +1,7 @@
@using System;
@using Microsoft.AspNetCore.Html
@model System.String
@for (var i = 0; i < 100; i++)
{
Html.RenderPartial("~/Views/HelperPartial_Partial.cshtml", Model + i.ToString());
}

View File

@ -0,0 +1,6 @@
@using System;
@using Microsoft.AspNetCore.Html
@model System.String
@addTagHelper Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper, Microsoft.AspNetCore.Mvc.TagHelpers
@for (var i = 0; i < 100; i++)
{<partial name="~/Views/HelperPartial_Partial.cshtml" model="@(Model + i.ToString())" />}

View File

@ -0,0 +1,2 @@
@model System.String
@Model

View File

@ -0,0 +1,7 @@
@using System;
@using Microsoft.AspNetCore.Html
@model System.String
@{Func<string, IHtmlContent> SomeHelper = @<text>@{
@item
}</text>;}
@for (var i = 0; i < 100; i++){@SomeHelper(Model + i.ToString())}

View File

@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Logging.Abstractions;

View File

@ -0,0 +1,49 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.Hosting;
using Microsoft.AspNetCore.Routing;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.ObjectPool;
namespace Microsoft.AspNetCore.Mvc.Performance
{
public class HelperPerformanceBenchmark : RuntimePerformanceBenchmarkBase
{
private Random _rand = new Random();
public HelperPerformanceBenchmark() : base(
"~/Views/HelperTyped.cshtml",
"~/Views/HelperDynamic.cshtml",
"~/Views/HelperPartialSync.cshtml",
"~/Views/HelperPartialAsync.cshtml",
"~/Views/HelperExtensions.cshtml",
"~/Views/HelperPartialTagHelper.cshtml")
{
}
protected override object Model => _rand.Next().ToString();
}
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Exe</OutputType>
<ServerGarbageCollection>true</ServerGarbageCollection>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@ -9,11 +9,15 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc\Microsoft.AspNetCore.Mvc.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.Performance.Views\Microsoft.AspNetCore.Mvc.Performance.Views.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" Version="$(MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Runtime" Version="$(MicrosoftAspNetCoreRazorRuntimePackageVersion)" />
</ItemGroup>
</Project>

View File

@ -8,7 +8,6 @@ using BenchmarkDotNet.Attributes;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Patterns;

View File

@ -0,0 +1,212 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.Hosting;
using Microsoft.AspNetCore.Routing;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.ObjectPool;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Performance
{
public class RuntimePerformanceBenchmarkBase
{
private class NullLoggerFactory : ILoggerFactory, ILogger
{
void ILoggerFactory.AddProvider(ILoggerProvider provider) {}
ILogger ILoggerFactory.CreateLogger(string categoryName) => this;
void IDisposable.Dispose() {}
IDisposable ILogger.BeginScope<TState>(TState state) => null;
bool ILogger.IsEnabled(LogLevel logLevel) => false;
void ILogger.Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter) {}
}
private class BenchmarkViewExecutor : ViewExecutor
{
public BenchmarkViewExecutor(IOptions<MvcViewOptions> viewOptions, IHttpResponseStreamWriterFactory writerFactory, ICompositeViewEngine viewEngine, ITempDataDictionaryFactory tempDataFactory, DiagnosticListener diagnosticListener, IModelMetadataProvider modelMetadataProvider)
: base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticListener, modelMetadataProvider)
{
}
public StringBuilder StringBuilder { get; } = new StringBuilder();
public override async Task ExecuteAsync(
ActionContext actionContext,
IView view,
ViewDataDictionary viewData,
ITempDataDictionary tempData,
string contentType,
int? statusCode)
{
using (var stringWriter = new StringWriter(StringBuilder))
{
var viewContext = new ViewContext(
actionContext,
view,
viewData,
tempData,
stringWriter,
ViewOptions.HtmlHelperOptions);
await ExecuteAsync(viewContext, contentType, statusCode);
await stringWriter.FlushAsync();
}
}
}
private class BenchmarkHostingEnvironment : IHostingEnvironment
{
public BenchmarkHostingEnvironment()
{
ApplicationName = typeof(ViewAssemblyMarker).Assembly.FullName;
WebRootFileProvider = new NullFileProvider();
ContentRootFileProvider = new NullFileProvider();
ContentRootPath = AppContext.BaseDirectory;
WebRootPath = AppContext.BaseDirectory;
}
public string EnvironmentName { get; set; }
public string ApplicationName { get; set; }
public string WebRootPath { get; set; }
public IFileProvider WebRootFileProvider { get; set; }
public string ContentRootPath { get; set; }
public IFileProvider ContentRootFileProvider { get; set; }
}
protected RuntimePerformanceBenchmarkBase(params string[] viewPaths)
{
ViewPaths = viewPaths;
}
public virtual string[] ViewPaths { get; private set; }
[ParamsSource(nameof(ViewPaths))]
public string ViewPath;
protected IView View;
private ServiceProvider _serviceProvider;
private RouteData _routeData;
private ActionDescriptor _actionDescriptor;
private IServiceScope _requestScope;
private ICompositeViewEngine _viewEngine;
private BenchmarkViewExecutor _executor;
private ViewEngineResult _viewEngineResult;
private ActionContext _actionContext;
private ViewDataDictionary _viewDataDictionary;
private ITempDataDictionaryFactory _tempDataDictionaryFactory;
private ITempDataDictionary _tempData;
// runs once for every Document value
[GlobalSetup]
public void GlobalSetup()
{
var loader = new RazorCompiledItemLoader();
var viewsDll = Path.ChangeExtension(typeof(ViewAssemblyMarker).Assembly.Location, "Views.dll");
var viewsAssembly = Assembly.Load(File.ReadAllBytes(viewsDll));
var services = new ServiceCollection();
var listener = new DiagnosticListener(GetType().Assembly.FullName);
var partManager = new ApplicationPartManager();
partManager.ApplicationParts.Add(CompiledRazorAssemblyApplicationPartFactory.GetDefaultApplicationParts(viewsAssembly).Single());
var builder = services
.AddSingleton<ILoggerFactory, NullLoggerFactory>()
.AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>()
.AddSingleton<DiagnosticSource>(listener)
.AddSingleton(listener)
.AddSingleton<IHostingEnvironment, BenchmarkHostingEnvironment>()
.AddSingleton<ApplicationPartManager>(partManager)
.AddScoped<BenchmarkViewExecutor>()
.AddMvc();
_serviceProvider = services.BuildServiceProvider();
_routeData = new RouteData();
_actionDescriptor = new ActionDescriptor();
_tempDataDictionaryFactory = _serviceProvider.GetRequiredService<ITempDataDictionaryFactory>();
_viewEngine = _serviceProvider.GetRequiredService<ICompositeViewEngine>();
}
[GlobalCleanup]
public void GlobalCleanup()
{
_serviceProvider.Dispose();
}
[IterationSetup]
public virtual void IterationSetup()
{
_requestScope = _serviceProvider.CreateScope();
_viewEngineResult = _viewEngine.GetView(null, ViewPath, true);
_viewEngineResult.EnsureSuccessful(null);
_actionContext = new ActionContext(
new DefaultHttpContext()
{
RequestServices = _requestScope.ServiceProvider
},
_routeData,
_actionDescriptor);
_tempData = _tempDataDictionaryFactory.GetTempData(_actionContext.HttpContext);
_viewDataDictionary = new ViewDataDictionary(
_requestScope.ServiceProvider.GetRequiredService<IModelMetadataProvider>(),
_actionContext.ModelState);
_viewDataDictionary.Model = Model;
_executor = _requestScope.ServiceProvider.GetRequiredService<BenchmarkViewExecutor>();
}
[IterationCleanup]
public virtual void IterationCleanup()
{
if (_viewEngineResult.View is IDisposable d)
{
d.Dispose();
}
_requestScope.Dispose();
}
protected virtual object Model { get; } = null;
[Benchmark]
public async Task<string> RenderView()
{
await _executor.ExecuteAsync(
_actionContext,
_viewEngineResult.View,
_viewDataDictionary,
_tempData,
"text/html",
200);
return _executor.StringBuilder.ToString();
}
}
}

View File

@ -6,7 +6,6 @@ using BenchmarkDotNet.Attributes;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;

View File

@ -16,97 +16,94 @@
<BenchmarksOnlyMySqlConnectorPackageVersion>0.43.0</BenchmarksOnlyMySqlConnectorPackageVersion>
<BenchmarksOnlyNpgsqlEntityFrameworkCorePostgreSQLPackageVersion>2.1.1.1</BenchmarksOnlyNpgsqlEntityFrameworkCorePostgreSQLPackageVersion>
<BenchmarksOnlyPomeloEntityFrameworkCoreMySqlPackageVersion>2.1.1</BenchmarksOnlyPomeloEntityFrameworkCoreMySqlPackageVersion>
<InternalAspNetCoreAnalyzersPackageVersion>2.2.0-rtm-35519</InternalAspNetCoreAnalyzersPackageVersion>
<MicrosoftAspNetCoreAllPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreAllPackageVersion>
<MicrosoftAspNetCoreAnalyzerTestingPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreAnalyzerTestingPackageVersion>
<MicrosoftAspNetCoreAntiforgeryPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreAntiforgeryPackageVersion>
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
<MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
<MicrosoftAspNetCoreAuthenticationPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreAuthenticationPackageVersion>
<MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
<MicrosoftAspNetCoreChunkingCookieManagerSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreChunkingCookieManagerSourcesPackageVersion>
<MicrosoftAspNetCoreCookiePolicyPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreCookiePolicyPackageVersion>
<MicrosoftAspNetCoreCorsPackageVersion>2.2.0-a-rtm-fix-wildcard-16567</MicrosoftAspNetCoreCorsPackageVersion>
<MicrosoftAspNetCoreDiagnosticsAbstractionsPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreDiagnosticsAbstractionsPackageVersion>
<MicrosoftAspNetCoreDiagnosticsPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreDiagnosticsPackageVersion>
<InternalAspNetCoreAnalyzersPackageVersion>3.0.0-preview-181113-11</InternalAspNetCoreAnalyzersPackageVersion>
<MicrosoftAspNetCoreAnalyzerTestingPackageVersion>3.0.0-preview-181113-11</MicrosoftAspNetCoreAnalyzerTestingPackageVersion>
<MicrosoftAspNetCoreAntiforgeryPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAntiforgeryPackageVersion>
<MicrosoftAspNetCoreAppPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAppPackageVersion>
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
<MicrosoftAspNetCoreAuthenticationCorePackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
<MicrosoftAspNetCoreAuthenticationPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAuthenticationPackageVersion>
<MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
<MicrosoftAspNetCoreChunkingCookieManagerSourcesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreChunkingCookieManagerSourcesPackageVersion>
<MicrosoftAspNetCoreCookiePolicyPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreCookiePolicyPackageVersion>
<MicrosoftAspNetCoreCorsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreCorsPackageVersion>
<MicrosoftAspNetCoreDiagnosticsAbstractionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreDiagnosticsAbstractionsPackageVersion>
<MicrosoftAspNetCoreDiagnosticsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreDiagnosticsPackageVersion>
<MicrosoftAspNetCoreHostingAbstractions20PackageVersion>2.0.0</MicrosoftAspNetCoreHostingAbstractions20PackageVersion>
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
<MicrosoftAspNetCoreHostingPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreHostingPackageVersion>
<MicrosoftAspNetCoreHtmlAbstractionsPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreHtmlAbstractionsPackageVersion>
<MicrosoftAspNetCoreHttpExtensionsPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreHttpExtensionsPackageVersion>
<MicrosoftAspNetCoreHttpPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreHttpPackageVersion>
<MicrosoftAspNetCoreJsonPatchPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreJsonPatchPackageVersion>
<MicrosoftAspNetCoreLocalizationPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreLocalizationPackageVersion>
<MicrosoftAspNetCoreLocalizationRoutingPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreLocalizationRoutingPackageVersion>
<MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>
<MicrosoftAspNetCoreRangeHelperSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreRangeHelperSourcesPackageVersion>
<MicrosoftAspNetCoreRazorDesignPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreRazorDesignPackageVersion>
<MicrosoftAspNetCoreRazorLanguagePackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreRazorLanguagePackageVersion>
<MicrosoftAspNetCoreRazorRuntimePackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreRazorRuntimePackageVersion>
<MicrosoftAspNetCoreRazorTagHelpersTestingSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreRazorTagHelpersTestingSourcesPackageVersion>
<MicrosoftAspNetCoreResponseCachingAbstractionsPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreResponseCachingAbstractionsPackageVersion>
<MicrosoftAspNetCoreResponseCachingPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreResponseCachingPackageVersion>
<MicrosoftAspNetCoreRoutingAbstractionsPackageVersion>2.2.0-a-rtm-allow-required-parameters-17081</MicrosoftAspNetCoreRoutingAbstractionsPackageVersion>
<MicrosoftAspNetCoreRoutingPackageVersion>2.2.0-a-rtm-allow-required-parameters-17081</MicrosoftAspNetCoreRoutingPackageVersion>
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreServerKestrelPackageVersion>
<MicrosoftAspNetCoreSessionPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreSessionPackageVersion>
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreStaticFilesPackageVersion>
<MicrosoftAspNetCoreTestHostPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreTestHostPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftAspNetCoreWebUtilitiesPackageVersion>2.2.0-rtm-35519</MicrosoftAspNetCoreWebUtilitiesPackageVersion>
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
<MicrosoftAspNetCoreHostingPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreHostingPackageVersion>
<MicrosoftAspNetCoreHtmlAbstractionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreHtmlAbstractionsPackageVersion>
<MicrosoftAspNetCoreHttpExtensionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreHttpExtensionsPackageVersion>
<MicrosoftAspNetCoreHttpPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreHttpPackageVersion>
<MicrosoftAspNetCoreJsonPatchPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreJsonPatchPackageVersion>
<MicrosoftAspNetCoreLocalizationPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreLocalizationPackageVersion>
<MicrosoftAspNetCoreLocalizationRoutingPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreLocalizationRoutingPackageVersion>
<MicrosoftAspNetCoreRangeHelperSourcesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreRangeHelperSourcesPackageVersion>
<MicrosoftAspNetCoreRazorRuntimePackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreRazorRuntimePackageVersion>
<MicrosoftAspNetCoreRazorTagHelpersTestingSourcesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreRazorTagHelpersTestingSourcesPackageVersion>
<MicrosoftAspNetCoreResponseCachingAbstractionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreResponseCachingAbstractionsPackageVersion>
<MicrosoftAspNetCoreResponseCachingPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreResponseCachingPackageVersion>
<MicrosoftAspNetCoreRoutingAbstractionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreRoutingAbstractionsPackageVersion>
<MicrosoftAspNetCoreRoutingPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreRoutingPackageVersion>
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
<MicrosoftAspNetCoreServerKestrelPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreServerKestrelPackageVersion>
<MicrosoftAspNetCoreSessionPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreSessionPackageVersion>
<MicrosoftAspNetCoreStaticFilesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreStaticFilesPackageVersion>
<MicrosoftAspNetCoreTestHostPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreTestHostPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>3.0.0-preview-181113-11</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftAspNetCoreWebUtilitiesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreWebUtilitiesPackageVersion>
<MicrosoftAspNetWebApiClientPackageVersion>5.2.6</MicrosoftAspNetWebApiClientPackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>15.6.82</MicrosoftBuildUtilitiesCorePackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>15.8.166</MicrosoftBuildUtilitiesCorePackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>2.8.0</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>2.8.0</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftCodeAnalysisRazorPackageVersion>2.2.0-rtm-35519</MicrosoftCodeAnalysisRazorPackageVersion>
<MicrosoftCodeAnalysisRazorPackageVersion>3.0.0-alpha1-10742</MicrosoftCodeAnalysisRazorPackageVersion>
<MicrosoftDiaSymReaderNativePackageVersion>1.7.0</MicrosoftDiaSymReaderNativePackageVersion>
<MicrosoftExtensionsCachingMemoryPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsCachingMemoryPackageVersion>
<MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsConfigurationJsonPackageVersion>
<MicrosoftExtensionsConfigurationPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsConfigurationPackageVersion>
<MicrosoftExtensionsCopyOnWriteDictionarySourcesPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsCopyOnWriteDictionarySourcesPackageVersion>
<MicrosoftExtensionsDependencyInjectionPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsDependencyInjectionPackageVersion>
<MicrosoftExtensionsDependencyModelPackageVersion>2.1.0</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftExtensionsDiagnosticAdapterPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsDiagnosticAdapterPackageVersion>
<MicrosoftExtensionsFileProvidersAbstractionsPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsFileProvidersAbstractionsPackageVersion>
<MicrosoftExtensionsFileProvidersCompositePackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsFileProvidersCompositePackageVersion>
<MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>
<MicrosoftExtensionsFileSystemGlobbingPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsFileSystemGlobbingPackageVersion>
<MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion>
<MicrosoftExtensionsLocalizationPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsLocalizationPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingDebugPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsLoggingDebugPackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>
<MicrosoftExtensionsOptionsPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsOptionsPackageVersion>
<MicrosoftExtensionsParameterDefaultValueSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsParameterDefaultValueSourcesPackageVersion>
<MicrosoftExtensionsPrimitivesPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsPrimitivesPackageVersion>
<MicrosoftExtensionsPropertyActivatorSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsPropertyActivatorSourcesPackageVersion>
<MicrosoftExtensionsPropertyHelperSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsPropertyHelperSourcesPackageVersion>
<MicrosoftExtensionsSecurityHelperSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsSecurityHelperSourcesPackageVersion>
<MicrosoftExtensionsTypeNameHelperSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsTypeNameHelperSourcesPackageVersion>
<MicrosoftExtensionsValueStopwatchSourcesPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsValueStopwatchSourcesPackageVersion>
<MicrosoftExtensionsWebEncodersPackageVersion>2.2.0-rtm-35519</MicrosoftExtensionsWebEncodersPackageVersion>
<MicrosoftExtensionsCachingMemoryPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsCachingMemoryPackageVersion>
<MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
<MicrosoftExtensionsConfigurationJsonPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsConfigurationJsonPackageVersion>
<MicrosoftExtensionsConfigurationPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsConfigurationPackageVersion>
<MicrosoftExtensionsCopyOnWriteDictionarySourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsCopyOnWriteDictionarySourcesPackageVersion>
<MicrosoftExtensionsDependencyInjectionPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsDependencyInjectionPackageVersion>
<MicrosoftExtensionsDependencyModelPackageVersion>3.0.0-preview1-26907-05</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftExtensionsDiagnosticAdapterPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsDiagnosticAdapterPackageVersion>
<MicrosoftExtensionsFileProvidersAbstractionsPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsFileProvidersAbstractionsPackageVersion>
<MicrosoftExtensionsFileProvidersCompositePackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsFileProvidersCompositePackageVersion>
<MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>
<MicrosoftExtensionsFileSystemGlobbingPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsFileSystemGlobbingPackageVersion>
<MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion>
<MicrosoftExtensionsLocalizationPackageVersion>3.0.0-alpha1-10742</MicrosoftExtensionsLocalizationPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingDebugPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingDebugPackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>
<MicrosoftExtensionsOptionsPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsOptionsPackageVersion>
<MicrosoftExtensionsParameterDefaultValueSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsParameterDefaultValueSourcesPackageVersion>
<MicrosoftExtensionsPrimitivesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsPrimitivesPackageVersion>
<MicrosoftExtensionsPropertyActivatorSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsPropertyActivatorSourcesPackageVersion>
<MicrosoftExtensionsPropertyHelperSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsPropertyHelperSourcesPackageVersion>
<MicrosoftExtensionsSecurityHelperSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsSecurityHelperSourcesPackageVersion>
<MicrosoftExtensionsTypeNameHelperSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsTypeNameHelperSourcesPackageVersion>
<MicrosoftExtensionsValueStopwatchSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsValueStopwatchSourcesPackageVersion>
<MicrosoftExtensionsWebEncodersPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsWebEncodersPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.9</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.3</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNETCoreApp22PackageVersion>2.2.0-preview3-27014-02</MicrosoftNETCoreApp22PackageVersion>
<MicrosoftNetHttpHeadersPackageVersion>2.2.0-rtm-35519</MicrosoftNetHttpHeadersPackageVersion>
<MicrosoftNETSdkRazorPackageVersion>2.2.0-rtm-35519</MicrosoftNETSdkRazorPackageVersion>
<MicrosoftNETCoreAppPackageVersion>3.0.0-preview1-26907-05</MicrosoftNETCoreAppPackageVersion>
<MicrosoftNetHttpHeadersPackageVersion>3.0.0-alpha1-10742</MicrosoftNetHttpHeadersPackageVersion>
<MicrosoftNETSdkRazorPackageVersion>3.0.0-alpha1-10742</MicrosoftNETSdkRazorPackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
<MoqPackageVersion>4.10.0</MoqPackageVersion>
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
<NewtonsoftJsonBsonPackageVersion>1.0.1</NewtonsoftJsonBsonPackageVersion>
<NewtonsoftJsonPackageVersion>11.0.2</NewtonsoftJsonPackageVersion>
<SystemComponentModelAnnotationsPackageVersion>4.5.0</SystemComponentModelAnnotationsPackageVersion>
<SystemDiagnosticsDiagnosticSourcePackageVersion>4.5.0</SystemDiagnosticsDiagnosticSourcePackageVersion>
<SystemComponentModelAnnotationsPackageVersion>4.6.0-preview1-26907-04</SystemComponentModelAnnotationsPackageVersion>
<SystemDiagnosticsDiagnosticSourcePackageVersion>4.6.0-preview1-26907-04</SystemDiagnosticsDiagnosticSourcePackageVersion>
<SystemNetHttpPackageVersion>4.3.2</SystemNetHttpPackageVersion>
<SystemThreadingTasksExtensionsPackageVersion>4.5.1</SystemThreadingTasksExtensionsPackageVersion>
<SystemThreadingTasksExtensionsPackageVersion>4.6.0-preview1-26907-04</SystemThreadingTasksExtensionsPackageVersion>
<XunitAnalyzersPackageVersion>0.10.0</XunitAnalyzersPackageVersion>
<XunitPackageVersion>2.3.1</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.4.0</XunitRunnerVisualStudioPackageVersion>

View File

@ -3,6 +3,7 @@
<PropertyGroup>
<EnableBenchmarkValidation>true</EnableBenchmarkValidation>
<VSTestVerboseOutput Condition="'$(CI)' == 'true'">true</VSTestVerboseOutput>
</PropertyGroup>
<ItemGroup>
@ -14,12 +15,11 @@
<PropertyGroup>
<!-- These properties are use by the automation that updates dependencies.props -->
<LineupPackageId>Internal.AspNetCore.Universe.Lineup</LineupPackageId>
<LineupPackageVersion>2.2.0-*</LineupPackageVersion>
<LineupPackageRestoreSource>https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json</LineupPackageRestoreSource>
</PropertyGroup>
<ItemGroup>
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp21PackageVersion)" />
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp22PackageVersion)" />
<DotNetCoreRuntime Include="$(MicrosoftNETCoreAppPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,2 @@
@ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0runWithProcDump.ps1' %*; exit $LASTEXITCODE"

View File

@ -1,8 +1,8 @@
{
"sdk": {
"version": "2.2.100-preview2-009404"
"version": "3.0.100-preview-009750"
},
"msbuild-sdks": {
"Internal.AspNetCore.Sdk": "2.2.0-preview2-20181003.2"
"Internal.AspNetCore.Sdk": "3.0.0-build-20181114.5"
}
}

View File

@ -0,0 +1,37 @@
try
{
$cwd = $PSScriptRoot;
$job = Start-Job {
$dumpsFolder = "${using:cwd}/artifacts/dumps";
mkdir $dumpsFolder -Force;
$procDumpFolder = "${using:cwd}/obj";
mkdir $procDumpFolder -Force;
$procDumpFolder = Resolve-Path $procDumpFolder;
Invoke-WebRequest https://download.sysinternals.com/files/Procdump.zip -OutFile "$procDumpFolder/procdump.zip";
Expand-Archive "$procDumpFolder/procdump.zip" -DestinationPath "$procDumpFolder" -Force;
$sleepTime = (1 * 20 * 60)
Start-Sleep -Seconds $sleepTime;
Write-Host "Producing dumps in $dumpsFolder";
Write-Host "Process dumps to capture:"
$processes = Get-Process dotnet*, testhost*;
$processes | Format-Table;
Write-Host "Using ProcDump from $procDumpFolder/procdump.exe";
$processes |
Select-Object -ExpandProperty ID |
ForEach-Object { &"$procDumpFolder/procdump.exe" -accepteula -ma $_ $dumpsFolder }
}
Write-Host "Process dump capture job started. Running run.ps1 next";
./run.ps1 default-build @args
# Receive-Job $job
Stop-Job $job
Remove-Job $job
}
catch
{
write-host $_
exit -1;
}

View File

@ -0,0 +1,16 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc;
namespace MvcSandbox.Controllers
{
[Route("[controller]/[action]")]
public class LoginController : Controller
{
public IActionResult Index()
{
return View();
}
}
}

View File

@ -0,0 +1,28 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
namespace Microsoft.AspNetCore.Builder
{
public static class HealthChecksEndpointRouteBuilderExtensions
{
private static readonly Random _random = new Random();
public static IEndpointConventionBuilder MapHealthChecks(this IEndpointRouteBuilder builder, string pattern)
{
return builder.MapGet(
pattern,
async httpContext =>
{
await httpContext.Response.WriteAsync(_random.Next() % 2 == 0 ? "Up!" : "Down!");
});
}
}
}

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<TargetFrameworks Condition=" '$(DeveloperBuild)' != 'true' AND '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net461</TargetFrameworks>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
@ -11,10 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc\Microsoft.AspNetCore.Mvc.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="$(MicrosoftAspNetCoreDiagnosticsPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="$(MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="$(MicrosoftAspNetCoreRazorDesignPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(MicrosoftAspNetCoreServerIISIntegrationPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />

View File

@ -1,9 +1,15 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -20,14 +26,43 @@ namespace MvcSandbox
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
app.UseDeveloperExceptionPage();
app.UseStaticFiles();
app.UseMvc(routes =>
app.UseEndpointRouting(builder =>
{
routes.MapRoute(
builder.MapGet(
requestDelegate: WriteEndpoints,
pattern: "/endpoints",
displayName: "Home");
builder.MapControllerRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
builder.MapApplication();
builder.MapHealthChecks("/healthz");
});
app.UseDeveloperExceptionPage();
app.UseStaticFiles();
app.UseEndpoint();
}
private static Task WriteEndpoints(HttpContext httpContext)
{
var dataSource = httpContext.RequestServices.GetRequiredService<CompositeEndpointDataSource>();
var sb = new StringBuilder();
sb.AppendLine("Endpoints:");
foreach (var endpoint in dataSource.Endpoints.OfType<RouteEndpoint>().OrderBy(e => e.RoutePattern.RawText, StringComparer.OrdinalIgnoreCase))
{
sb.AppendLine($"- {endpoint.RoutePattern.RawText} '{endpoint.DisplayName}'");
}
var response = httpContext.Response;
response.StatusCode = 200;
response.ContentType = "text/plain";
return response.WriteAsync(sb.ToString());
}
public static void Main(string[] args)

View File

@ -109,8 +109,8 @@ namespace Microsoft.Extensions.ApiDescription.Tool.Commands
return false;
}
var finished = Task.WhenAny(resultTask, Task.Delay(TimeSpan.FromMinutes(1)));
if (!ReferenceEquals(resultTask, finished))
var finishedIndex = Task.WaitAny(resultTask, Task.Delay(TimeSpan.FromMinutes(1)));
if (finishedIndex != 0)
{
Reporter.WriteWarning(Resources.FormatMethodTimedOut(methodName, serviceName, 1));
return false;
@ -121,6 +121,8 @@ namespace Microsoft.Extensions.ApiDescription.Tool.Commands
using (var outStream = File.Create(context.OutputPath))
{
stream.CopyTo(outStream);
outStream.Flush();
}
}

View File

@ -6,6 +6,9 @@
<OutputType>Exe</OutputType>
<RootNamespace>Microsoft.Extensions.ApiDescription.Tool</RootNamespace>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<VerifyVersion>false</VerifyVersion>
<VersionPrefix>$(ExperimentalVersionPrefix)</VersionPrefix>
<VersionSuffix>$(ExperimentalVersionSuffix)</VersionSuffix>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">

View File

@ -4,7 +4,7 @@
<Description>ASP.NET Core MVC abstractions and interfaces for action invocation and dispatching, authorization, action filters, formatters, model binding, routing, validation, and more.
Commonly used types:
Microsoft.AspNetCore.Mvc.IActionResult</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>

View File

@ -5,10 +5,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Template;

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>ASP.NET Core MVC API explorer functionality for discovering metadata such as the list of controllers and actions, and their URLs and allowed HTTP methods.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>

View File

@ -7,12 +7,11 @@ using System.Diagnostics;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Infrastructure;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ActionConstraints
{
public class ActionConstraintCache
internal class ActionConstraintCache
{
private readonly IActionDescriptorCollectionProvider _collectionProvider;
private readonly IActionConstraintProvider[] _actionConstraintProviders;

View File

@ -2,9 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ActionConstraints
{
/// <summary>
/// A default implementation of <see cref="IActionConstraintProvider"/>.
@ -14,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <see cref="IActionConstraintMetadata"/> implements <see cref="IActionConstraint"/> or
/// <see cref="IActionConstraintFactory"/>/
/// </remarks>
public class DefaultActionConstraintProvider : IActionConstraintProvider
internal class DefaultActionConstraintProvider : IActionConstraintProvider
{
/// <inheritdoc />
public int Order => -1000;
@ -61,4 +60,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
}
}

View File

@ -4,12 +4,10 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ActionConstraints
{
public class HttpMethodActionConstraint : IActionConstraint
internal class HttpMethodActionConstraint : IActionConstraint
{
public static readonly int HttpMethodConstraintOrder = 100;

View File

@ -1,15 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.ActionConstraints;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ActionConstraints
{
/// <summary>
/// An <see cref="IActionConstraint"/> constraint that identifies a type which can be used to select an action
/// based on incoming request.
/// </summary>
public interface IConsumesActionConstraint : IActionConstraint
internal interface IConsumesActionConstraint : IActionConstraint
{
}
}
}

View File

@ -1,13 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc
{
/// <summary>
/// Represents data used to build an <c>ApiDescription</c>, stored as part of the
/// <see cref="Abstractions.ActionDescriptor.Properties"/>.
/// </summary>
public class ApiDescriptionActionData
internal class ApiDescriptionActionData
{
/// <summary>
/// The <c>ApiDescription.GroupName</c> of <c>ApiDescription</c> objects for the associated
@ -15,4 +15,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// </summary>
public string GroupName { get; set; }
}
}
}

View File

@ -0,0 +1,189 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Routing;
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
internal static class ActionAttributeRouteModel
{
public static IEnumerable<SelectorModel> FlattenSelectors(ActionModel actionModel)
{
// Loop through all attribute routes defined on the controller.
// These perform a cross-product with all of the action-level attribute routes.
var controllerSelectors = actionModel.Controller.Selectors
.Where(sm => sm.AttributeRouteModel != null)
.ToList();
// We also include metadata and action constraints from the controller
// even when there are no routes, or when an action overrides the route template.
SelectorModel additionalSelector = null;
if (actionModel.Controller.Selectors.Count > 0)
{
// This logic seems arbitrary but there's a good reason for it.
//
// When we build the controller level selectors, any metadata or action constraints
// that aren't IRouteTemplateProvider will be included in all selectors. So we
// pick any selector and then grab all of the stuff that isn't IRouteTemplateProvider
// then we've found all of the items that aren't routes.
//
// This is fragile wrt application model customizing the data - but no one has
// run into an issue with this and its pretty esoteric.
additionalSelector = new SelectorModel(actionModel.Controller.Selectors.First());
additionalSelector.AttributeRouteModel = null;
for (var i = additionalSelector.ActionConstraints.Count - 1; i >= 0; i--)
{
if (additionalSelector.ActionConstraints[i] is IRouteTemplateProvider)
{
additionalSelector.ActionConstraints.RemoveAt(i);
}
}
for (var i = additionalSelector.EndpointMetadata.Count - 1; i >= 0; i--)
{
if (additionalSelector.EndpointMetadata[i] is IRouteTemplateProvider)
{
additionalSelector.EndpointMetadata.RemoveAt(i);
}
}
}
var actionConstraints = new List<IActionConstraintMetadata>();
foreach (var actionSelector in actionModel.Selectors)
{
var actionRouteModel = actionSelector.AttributeRouteModel;
// We check the action to see if the template allows combination behavior
// (It doesn't start with / or ~/) so that in the case where we have multiple
// [Route] attributes on the controller we don't end up creating multiple
if (actionRouteModel != null && actionRouteModel.IsAbsoluteTemplate)
{
// We're overriding the routes from the controller, but any *unbound* constraints
// still apply.
var selector = new SelectorModel(actionSelector);
selector.AttributeRouteModel = AttributeRouteModel.CombineAttributeRouteModel(
left: null,
right: actionRouteModel);
AddActionConstraints(selector, additionalSelector?.ActionConstraints);
AddEndpointMetadata(selector, additionalSelector?.EndpointMetadata);
yield return selector;
}
else if (controllerSelectors.Count > 0)
{
for (var i = 0; i < controllerSelectors.Count; i++)
{
var controllerSelector = controllerSelectors[i];
// We're using the attribute routes from the controller
var selector = new SelectorModel(actionSelector);
selector.AttributeRouteModel = AttributeRouteModel.CombineAttributeRouteModel(
controllerSelector.AttributeRouteModel,
actionRouteModel);
AddActionConstraints(selector, controllerSelector.ActionConstraints);
AddEndpointMetadata(selector, controllerSelector.EndpointMetadata);
// No need to include the additional selector here because it would duplicate
// data in controllerSelector.
yield return selector;
}
}
else
{
// There are no routes on the controller, but any *unbound* constraints
// still apply.
var selector = new SelectorModel(actionSelector);
selector.AttributeRouteModel = AttributeRouteModel.CombineAttributeRouteModel(
left: null,
right: actionRouteModel);
AddActionConstraints(selector, additionalSelector?.ActionConstraints);
AddEndpointMetadata(selector, additionalSelector?.EndpointMetadata);
yield return selector;
}
}
}
private static void AddActionConstraints(SelectorModel selector, IList<IActionConstraintMetadata> actionConstraints)
{
if (actionConstraints != null)
{
for (var i = 0; i < actionConstraints.Count;i++)
{
selector.ActionConstraints.Add(actionConstraints[i]);
}
}
}
private static void AddEndpointMetadata(SelectorModel selector, IList<object> metadata)
{
if (metadata != null)
{
for (var i = 0; i < metadata.Count; i++)
{
selector.EndpointMetadata.Add(metadata[i]);
}
}
}
public static IEnumerable<(AttributeRouteModel route, SelectorModel actionSelector, SelectorModel controllerSelector)> GetAttributeRoutes(ActionModel actionModel)
{
var controllerAttributeRoutes = actionModel.Controller.Selectors
.Where(sm => sm.AttributeRouteModel != null)
.Select(sm => sm.AttributeRouteModel)
.ToList();
foreach (var actionSelectorModel in actionModel.Selectors)
{
var actionRouteModel = actionSelectorModel.AttributeRouteModel;
// We check the action to see if the template allows combination behavior
// (It doesn't start with / or ~/) so that in the case where we have multiple
// [Route] attributes on the controller we don't end up creating multiple
if (actionRouteModel != null && actionRouteModel.IsAbsoluteTemplate)
{
var route = AttributeRouteModel.CombineAttributeRouteModel(
left: null,
right: actionRouteModel);
yield return (route, actionSelectorModel, null);
}
else if (controllerAttributeRoutes.Count > 0)
{
for (var i = 0; i < actionModel.Controller.Selectors.Count; i++)
{
// We're using the attribute routes from the controller
var controllerSelector = actionModel.Controller.Selectors[i];
var route = AttributeRouteModel.CombineAttributeRouteModel(
controllerSelector.AttributeRouteModel,
actionRouteModel);
yield return (route, actionSelectorModel, controllerSelector);
}
}
else
{
var route = AttributeRouteModel.CombineAttributeRouteModel(
left: null,
right: actionRouteModel);
yield return (route, actionSelectorModel, null);
}
}
}
}
}

View File

@ -50,6 +50,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
ActionMethod = other.ActionMethod;
ActionName = other.ActionName;
RouteParameterTransformer = other.RouteParameterTransformer;
// Not making a deep copy of the controller, this action still belongs to the same controller.
Controller = other.Controller;
@ -93,6 +94,18 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
public IList<ParameterModel> Parameters { get; }
/// <summary>
/// Gets or sets an <see cref="IOutboundParameterTransformer"/> that will be used to transform
/// built-in route parameters such as <c>action</c>, <c>controller</c>, and <c>area</c> as well as
/// additional parameters specified by <see cref="RouteValues"/> into static segments in the route template.
/// </summary>
/// <remarks>
/// <para>
/// This feature only applies when using endpoint routing.
/// </para>
/// </remarks>
public IOutboundParameterTransformer RouteParameterTransformer { get; set; }
/// <summary>
/// Gets a collection of route values that must be present in the
/// <see cref="RouteData.Values"/> for the corresponding action to be selected.

View File

@ -7,7 +7,6 @@ using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

View File

@ -4,14 +4,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
/// <summary>
/// Applies conventions to a <see cref="ApplicationModel"/>.
/// </summary>
public static class ApplicationModelConventions
internal static class ApplicationModelConventions
{
/// <summary>
/// Applies conventions to a <see cref="ApplicationModel"/>.

View File

@ -0,0 +1,361 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
/// <summary>
/// A facade service for creating application models.
/// </summary>
internal class ApplicationModelFactory
{
private readonly IApplicationModelProvider[] _applicationModelProviders;
private readonly IList<IApplicationModelConvention> _conventions;
public ApplicationModelFactory(
IEnumerable<IApplicationModelProvider> applicationModelProviders,
IOptions<MvcOptions> options)
{
if (applicationModelProviders == null)
{
throw new ArgumentNullException(nameof(applicationModelProviders));
}
if (options == null)
{
throw new ArgumentNullException(nameof(options));
}
_applicationModelProviders = applicationModelProviders.OrderBy(p => p.Order).ToArray();
_conventions = options.Value.Conventions;
}
public ApplicationModel CreateApplicationModel(IEnumerable<TypeInfo> controllerTypes)
{
if (controllerTypes == null)
{
throw new ArgumentNullException(nameof(controllerTypes));
}
var context = new ApplicationModelProviderContext(controllerTypes);
for (var i = 0; i < _applicationModelProviders.Length; i++)
{
_applicationModelProviders[i].OnProvidersExecuting(context);
}
for (var i = _applicationModelProviders.Length - 1; i >= 0; i--)
{
_applicationModelProviders[i].OnProvidersExecuted(context);
}
ApplicationModelConventions.ApplyConventions(context.Result, _conventions);
return context.Result;
}
public static List<TResult> Flatten<TResult>(
ApplicationModel application,
Func<ApplicationModel, ControllerModel, ActionModel, SelectorModel, TResult> flattener)
{
var results = new List<TResult>();
var errors = new Dictionary<MethodInfo, IList<string>>();
var actionsByMethod = new Dictionary<MethodInfo, List<(ActionModel, SelectorModel)>>();
var actionsByRouteName = new Dictionary<string, List<(ActionModel, SelectorModel)>>(StringComparer.OrdinalIgnoreCase);
var routeTemplateErrors = new List<string>();
foreach (var controller in application.Controllers)
{
foreach (var action in controller.Actions)
{
foreach (var selector in ActionAttributeRouteModel.FlattenSelectors(action))
{
// PostProcess attribute routes so we can observe any errors.
ReplaceAttributeRouteTokens(controller, action, selector, routeTemplateErrors);
// Add to the data structures we use to find errors.
AddActionToMethodInfoMap(actionsByMethod, action, selector);
AddActionToRouteNameMap(actionsByRouteName, action, selector);
var result = flattener(application, controller, action, selector);
Debug.Assert(result != null);
results.Add(result);
}
}
}
var attributeRoutingConfigurationErrors = new Dictionary<MethodInfo, string>();
foreach (var (method, actions) in actionsByMethod)
{
ValidateActionGroupConfiguration(
method,
actions,
attributeRoutingConfigurationErrors);
}
if (attributeRoutingConfigurationErrors.Any())
{
var message = CreateAttributeRoutingAggregateErrorMessage(attributeRoutingConfigurationErrors.Values);
throw new InvalidOperationException(message);
}
var namedRoutedErrors = ValidateNamedAttributeRoutedActions(actionsByRouteName);
if (namedRoutedErrors.Any())
{
var message = CreateAttributeRoutingAggregateErrorMessage(namedRoutedErrors);
throw new InvalidOperationException(message);
}
if (routeTemplateErrors.Any())
{
var message = CreateAttributeRoutingAggregateErrorMessage(routeTemplateErrors);
throw new InvalidOperationException(message);
}
return results;
}
private static void ReplaceAttributeRouteTokens(
ControllerModel controller,
ActionModel action,
SelectorModel selector,
List<string> errors)
{
if (selector.AttributeRouteModel == null)
{
return;
}
try
{
var routeValues = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{ "action", action.ActionName },
{ "controller", controller.ControllerName },
};
foreach (var kvp in action.RouteValues)
{
routeValues.TryAdd(kvp.Key, kvp.Value);
}
foreach (var kvp in controller.RouteValues)
{
routeValues.TryAdd(kvp.Key, kvp.Value);
}
selector.AttributeRouteModel.Template = AttributeRouteModel.ReplaceTokens(
selector.AttributeRouteModel.Template,
routeValues,
action.RouteParameterTransformer);
if (selector.AttributeRouteModel.Name != null)
{
selector.AttributeRouteModel.Name = AttributeRouteModel.ReplaceTokens(
selector.AttributeRouteModel.Name,
routeValues,
action.RouteParameterTransformer);
}
}
catch (InvalidOperationException ex)
{
// Routing will throw an InvalidOperationException here if we can't parse/replace tokens
// in the template.
var message = Resources.FormatAttributeRoute_IndividualErrorMessage(
action.DisplayName,
Environment.NewLine,
ex.Message);
errors.Add(message);
}
}
private static void AddActionToMethodInfoMap(
Dictionary<MethodInfo, List<(ActionModel, SelectorModel)>> actionsByMethod,
ActionModel action,
SelectorModel selector)
{
if (!actionsByMethod.TryGetValue(action.ActionMethod, out var actions))
{
actions = new List<(ActionModel, SelectorModel)>();
actionsByMethod.Add(action.ActionMethod, actions);
}
actions.Add((action, selector));
}
private static void AddActionToRouteNameMap(
Dictionary<string, List<(ActionModel action, SelectorModel selector)>> actionsByRouteName,
ActionModel action,
SelectorModel selector)
{
var routeName = selector.AttributeRouteModel?.Name;
if (selector.AttributeRouteModel?.Name == null)
{
return;
}
if (!actionsByRouteName.TryGetValue(routeName, out var actions))
{
actions = new List<(ActionModel, SelectorModel)>();
actionsByRouteName.Add(routeName, actions);
}
actions.Add((action, selector));
}
private static List<string> AddErrorNumbers(IEnumerable<string> namedRoutedErrors)
{
return namedRoutedErrors
.Select((error, i) =>
Resources.FormatAttributeRoute_AggregateErrorMessage_ErrorNumber(
i + 1,
Environment.NewLine,
error))
.ToList();
}
private static List<string> ValidateNamedAttributeRoutedActions(
Dictionary<string, List<(ActionModel action, SelectorModel selector)>> actionsByRouteName)
{
var namedRouteErrors = new List<string>();
foreach (var (routeName, actions) in actionsByRouteName)
{
// We are looking for attribute routed actions that have the same name but
// different route templates. We pick the first template of the group and
// we compare it against the rest of the templates that have that same name
// associated.
// The moment we find one that is different we report the whole group to the
// user in the error message so that he can see the different actions and the
// different templates for a given named attribute route.
var template = actions[0].selector.AttributeRouteModel.Template;
for (var i = 1; i < actions.Count; i++)
{
var other = actions[i].selector.AttributeRouteModel.Template;
if (!template.Equals(other, StringComparison.OrdinalIgnoreCase))
{
var descriptions = actions.Select(a =>
{
return Resources.FormatAttributeRoute_DuplicateNames_Item(a.action.DisplayName, a.selector.AttributeRouteModel.Template);
});
var message = Resources.FormatAttributeRoute_DuplicateNames(routeName, Environment.NewLine, string.Join(Environment.NewLine, descriptions));
namedRouteErrors.Add(message);
break;
}
}
}
return namedRouteErrors;
}
private static void ValidateActionGroupConfiguration(
MethodInfo method,
List<(ActionModel action, SelectorModel selector)> actions,
IDictionary<MethodInfo, string> routingConfigurationErrors)
{
var hasAttributeRoutedActions = false;
var hasConventionallyRoutedActions = false;
for (var i = 0; i < actions.Count; i++)
{
if (actions[i].selector.AttributeRouteModel == null)
{
hasConventionallyRoutedActions = true;
}
else
{
hasAttributeRoutedActions = true;
}
}
// Validate that no method result in attribute and non attribute actions at the same time.
// By design, mixing attribute and conventionally actions in the same method is not allowed.
//
// Assuming the controller doesn't specify a route template, this example would not be allowed:
//
// [HttpGet]
// [HttpPost("Foo")]
// public void Foo() { }
if (hasAttributeRoutedActions && hasConventionallyRoutedActions)
{
var message = CreateMixedRoutedActionDescriptorsErrorMessage(method, actions);
routingConfigurationErrors.Add(method, message);
}
}
private static string CreateMixedRoutedActionDescriptorsErrorMessage(
MethodInfo method,
List<(ActionModel action, SelectorModel selector)> actions)
{
// Text to show as the attribute route template for conventionally routed actions.
var nullTemplate = Resources.AttributeRoute_NullTemplateRepresentation;
var actionDescriptions = new List<string>();
for (var i = 0; i < actions.Count; i++)
{
var (action, selector) = actions[i];
var routeTemplate = selector.AttributeRouteModel?.Template ?? nullTemplate;
var verbs = selector.ActionConstraints?.OfType<HttpMethodActionConstraint>().FirstOrDefault()?.HttpMethods;
var formattedVerbs = string.Empty;
if (verbs != null)
{
formattedVerbs = string.Join(", ", verbs.OrderBy(v => v, StringComparer.OrdinalIgnoreCase));
}
var description = Resources.FormatAttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod_Item(
action.DisplayName,
routeTemplate,
formattedVerbs);
actionDescriptions.Add(description);
}
// Sample error message:
//
// A method 'MyApplication.CustomerController.Index' must not define attributed actions and
// non attributed actions at the same time:
// Action: 'MyApplication.CustomerController.Index' - Route Template: 'Products' - HTTP Verbs: 'PUT'
// Action: 'MyApplication.CustomerController.Index' - Route Template: '(none)' - HTTP Verbs: 'POST'
//
// Use 'AcceptVerbsAttribute' to create a single route that allows multiple HTTP verbs and defines a route,
// or set a route template in all attributes that constrain HTTP verbs.
var formattedMethodInfo = $"{TypeNameHelper.GetTypeDisplayName(method.ReflectedType)}.{method.Name} ({method.ReflectedType.Assembly.GetName().Name})";
return Resources.FormatAttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod(
formattedMethodInfo,
Environment.NewLine,
string.Join(Environment.NewLine, actionDescriptions));
}
private static string CreateAttributeRoutingAggregateErrorMessage(IEnumerable<string> individualErrors)
{
var errorMessages = AddErrorNumbers(individualErrors);
var message = Resources.FormatAttributeRoute_AggregateErrorMessage(
Environment.NewLine,
string.Join(Environment.NewLine + Environment.NewLine, errorMessages));
return message;
}
}
}

View File

@ -5,12 +5,11 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Authorization;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public class AuthorizationApplicationModelProvider : IApplicationModelProvider
internal class AuthorizationApplicationModelProvider : IApplicationModelProvider
{
private readonly IAuthorizationPolicyProvider _policyProvider;

View File

@ -3,7 +3,7 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Microsoft.AspNetCore.Mvc.ApplicationModels

View File

@ -0,0 +1,259 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Routing;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
/// <summary>
/// Creates instances of <see cref="ControllerActionDescriptor"/> from application model
/// types.
/// </summary>
internal static class ControllerActionDescriptorBuilder
{
public static IList<ControllerActionDescriptor> Build(ApplicationModel application)
{
return ApplicationModelFactory.Flatten(application, CreateActionDescriptor);
}
private static ControllerActionDescriptor CreateActionDescriptor(
ApplicationModel application,
ControllerModel controller,
ActionModel action,
SelectorModel selector)
{
var actionDescriptor = new ControllerActionDescriptor
{
ActionName = action.ActionName,
MethodInfo = action.ActionMethod,
};
actionDescriptor.ControllerName = controller.ControllerName;
actionDescriptor.ControllerTypeInfo = controller.ControllerType;
AddControllerPropertyDescriptors(actionDescriptor, controller);
AddActionConstraints(actionDescriptor, selector);
AddEndpointMetadata(actionDescriptor, selector);
AddAttributeRoute(actionDescriptor, selector);
AddParameterDescriptors(actionDescriptor, action);
AddActionFilters(actionDescriptor, action.Filters, controller.Filters, application.Filters);
AddApiExplorerInfo(actionDescriptor, application, controller, action);
AddRouteValues(actionDescriptor, controller, action);
AddProperties(actionDescriptor, action, controller, application);
return actionDescriptor;
}
private static void AddControllerPropertyDescriptors(ActionDescriptor actionDescriptor, ControllerModel controller)
{
actionDescriptor.BoundProperties = controller.ControllerProperties
.Where(p => p.BindingInfo != null)
.Select(CreateParameterDescriptor)
.ToList();
}
private static void AddParameterDescriptors(ActionDescriptor actionDescriptor, ActionModel action)
{
var parameterDescriptors = new List<ParameterDescriptor>();
foreach (var parameter in action.Parameters)
{
var parameterDescriptor = CreateParameterDescriptor(parameter);
parameterDescriptors.Add(parameterDescriptor);
}
actionDescriptor.Parameters = parameterDescriptors;
}
private static ParameterDescriptor CreateParameterDescriptor(ParameterModel parameterModel)
{
var parameterDescriptor = new ControllerParameterDescriptor()
{
Name = parameterModel.ParameterName,
ParameterType = parameterModel.ParameterInfo.ParameterType,
BindingInfo = parameterModel.BindingInfo,
ParameterInfo = parameterModel.ParameterInfo,
};
return parameterDescriptor;
}
private static ParameterDescriptor CreateParameterDescriptor(PropertyModel propertyModel)
{
var parameterDescriptor = new ControllerBoundPropertyDescriptor()
{
BindingInfo = propertyModel.BindingInfo,
Name = propertyModel.PropertyName,
ParameterType = propertyModel.PropertyInfo.PropertyType,
PropertyInfo = propertyModel.PropertyInfo,
};
return parameterDescriptor;
}
private static void AddApiExplorerInfo(
ControllerActionDescriptor actionDescriptor,
ApplicationModel application,
ControllerModel controller,
ActionModel action)
{
var isVisible =
action.ApiExplorer?.IsVisible ??
controller.ApiExplorer?.IsVisible ??
application.ApiExplorer?.IsVisible ??
false;
var isVisibleSetOnActionOrController =
action.ApiExplorer?.IsVisible ??
controller.ApiExplorer?.IsVisible ??
false;
// ApiExplorer isn't supported on conventional-routed actions, but we still allow you to configure
// it at the application level when you have a mix of controller types. We'll just skip over enabling
// ApiExplorer for conventional-routed controllers when this happens.
var isVisibleSetOnApplication = application.ApiExplorer?.IsVisible ?? false;
if (isVisibleSetOnActionOrController && !IsAttributeRouted(actionDescriptor))
{
// ApiExplorer is only supported on attribute routed actions.
throw new InvalidOperationException(Resources.FormatApiExplorer_UnsupportedAction(
actionDescriptor.DisplayName));
}
else if (isVisibleSetOnApplication && !IsAttributeRouted(actionDescriptor))
{
// This is the case where we're going to be lenient, just ignore it.
}
else if (isVisible)
{
Debug.Assert(IsAttributeRouted(actionDescriptor));
var apiExplorerActionData = new ApiDescriptionActionData()
{
GroupName = action.ApiExplorer?.GroupName ?? controller.ApiExplorer?.GroupName,
};
actionDescriptor.SetProperty(apiExplorerActionData);
}
}
private static void AddProperties(
ControllerActionDescriptor actionDescriptor,
ActionModel action,
ControllerModel controller,
ApplicationModel application)
{
foreach (var item in application.Properties)
{
actionDescriptor.Properties[item.Key] = item.Value;
}
foreach (var item in controller.Properties)
{
actionDescriptor.Properties[item.Key] = item.Value;
}
foreach (var item in action.Properties)
{
actionDescriptor.Properties[item.Key] = item.Value;
}
}
private static void AddActionFilters(
ControllerActionDescriptor actionDescriptor,
IEnumerable<IFilterMetadata> actionFilters,
IEnumerable<IFilterMetadata> controllerFilters,
IEnumerable<IFilterMetadata> globalFilters)
{
actionDescriptor.FilterDescriptors =
actionFilters.Select(f => new FilterDescriptor(f, FilterScope.Action))
.Concat(controllerFilters.Select(f => new FilterDescriptor(f, FilterScope.Controller)))
.Concat(globalFilters.Select(f => new FilterDescriptor(f, FilterScope.Global)))
.OrderBy(d => d, FilterDescriptorOrderComparer.Comparer)
.ToList();
}
private static void AddActionConstraints(ControllerActionDescriptor actionDescriptor, SelectorModel selectorModel)
{
if (selectorModel.ActionConstraints?.Count > 0)
{
actionDescriptor.ActionConstraints = new List<IActionConstraintMetadata>(selectorModel.ActionConstraints);
}
}
private static void AddEndpointMetadata(ControllerActionDescriptor actionDescriptor, SelectorModel selectorModel)
{
if (selectorModel.EndpointMetadata?.Count > 0)
{
actionDescriptor.EndpointMetadata = new List<object>(selectorModel.EndpointMetadata);
}
}
private static void AddAttributeRoute(ControllerActionDescriptor actionDescriptor, SelectorModel selectorModel)
{
if (selectorModel.AttributeRouteModel != null)
{
actionDescriptor.AttributeRouteInfo = new AttributeRouteInfo
{
Template = selectorModel.AttributeRouteModel.Template,
Order = selectorModel.AttributeRouteModel.Order ?? 0,
Name = selectorModel.AttributeRouteModel.Name,
SuppressLinkGeneration = selectorModel.AttributeRouteModel.SuppressLinkGeneration,
SuppressPathMatching = selectorModel.AttributeRouteModel.SuppressPathMatching,
};
}
}
public static void AddRouteValues(
ControllerActionDescriptor actionDescriptor,
ControllerModel controller,
ActionModel action)
{
// Apply all the constraints defined on the action, then controller (for example, [Area])
// to the actions. Also keep track of all the constraints that require preventing actions
// without the constraint to match. For example, actions without an [Area] attribute on their
// controller should not match when a value has been given for area when matching a url or
// generating a link.
foreach (var kvp in action.RouteValues)
{
// Skip duplicates
if (!actionDescriptor.RouteValues.ContainsKey(kvp.Key))
{
actionDescriptor.RouteValues.Add(kvp.Key, kvp.Value);
}
}
foreach (var kvp in controller.RouteValues)
{
// Skip duplicates - this also means that a value on the action will take precedence
if (!actionDescriptor.RouteValues.ContainsKey(kvp.Key))
{
actionDescriptor.RouteValues.Add(kvp.Key, kvp.Value);
}
}
// Lastly add the 'default' values
if (!actionDescriptor.RouteValues.ContainsKey("action"))
{
actionDescriptor.RouteValues.Add("action", action.ActionName ?? string.Empty);
}
if (!actionDescriptor.RouteValues.ContainsKey("controller"))
{
actionDescriptor.RouteValues.Add("controller", controller.ControllerName);
}
}
private static bool IsAttributeRouted(ActionDescriptor actionDescriptor)
{
return actionDescriptor.AttributeRouteInfo != null;
}
}
}

View File

@ -3,45 +3,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public class ControllerActionDescriptorProvider : IActionDescriptorProvider
internal class ControllerActionDescriptorProvider : IActionDescriptorProvider
{
private readonly ApplicationPartManager _partManager;
private readonly IApplicationModelProvider[] _applicationModelProviders;
private readonly IEnumerable<IApplicationModelConvention> _conventions;
private readonly ApplicationModelFactory _applicationModelFactory;
public ControllerActionDescriptorProvider(
ApplicationPartManager partManager,
IEnumerable<IApplicationModelProvider> applicationModelProviders,
IOptions<MvcOptions> optionsAccessor)
ApplicationModelFactory applicationModelFactory)
{
if (partManager == null)
{
throw new ArgumentNullException(nameof(partManager));
}
if (applicationModelProviders == null)
if (applicationModelFactory == null)
{
throw new ArgumentNullException(nameof(applicationModelProviders));
}
if (optionsAccessor == null)
{
throw new ArgumentNullException(nameof(optionsAccessor));
throw new ArgumentNullException(nameof(applicationModelFactory));
}
_partManager = partManager;
_applicationModelProviders = applicationModelProviders.OrderBy(p => p.Order).ToArray();
_conventions = optionsAccessor.Value.Conventions;
_applicationModelFactory = applicationModelFactory;
}
public int Order => -1000;
@ -63,7 +52,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <inheritdoc />
public void OnProvidersExecuted(ActionDescriptorProviderContext context)
{
// After all of the providers have run, we need to provide a 'null' for each all of route values that
// After all of the providers have run, we need to provide a 'null' for each all of route values that
// participate in action selection.
//
// This is important for scenarios like Razor Pages, that use the 'page' route value. An action that
@ -95,29 +84,11 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
protected internal IEnumerable<ControllerActionDescriptor> GetDescriptors()
{
var applicationModel = BuildModel();
ApplicationModelConventions.ApplyConventions(applicationModel, _conventions);
return ControllerActionDescriptorBuilder.Build(applicationModel);
}
protected internal ApplicationModel BuildModel()
internal IEnumerable<ControllerActionDescriptor> GetDescriptors()
{
var controllerTypes = GetControllerTypes();
var context = new ApplicationModelProviderContext(controllerTypes);
for (var i = 0; i < _applicationModelProviders.Length; i++)
{
_applicationModelProviders[i].OnProvidersExecuting(context);
}
for (var i = _applicationModelProviders.Length - 1; i >= 0; i--)
{
_applicationModelProviders[i].OnProvidersExecuted(context);
}
return context.Result;
var application = _applicationModelFactory.CreateApplicationModel(controllerTypes);
return ControllerActionDescriptorBuilder.Build(application);
}
private IEnumerable<TypeInfo> GetControllerTypes()

View File

@ -7,7 +7,6 @@ using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Routing;
@ -15,9 +14,9 @@ using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public class DefaultApplicationModelProvider : IApplicationModelProvider
internal class DefaultApplicationModelProvider : IApplicationModelProvider
{
private readonly MvcOptions _mvcOptions;
private readonly IModelMetadataProvider _modelMetadataProvider;
@ -39,7 +38,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
public int Order => -1000;
/// <inheritdoc />
public virtual void OnProvidersExecuting(ApplicationModelProviderContext context)
public void OnProvidersExecuting(ApplicationModelProviderContext context)
{
if (context == null)
{
@ -98,7 +97,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
/// <inheritdoc />
public virtual void OnProvidersExecuted(ApplicationModelProviderContext context)
public void OnProvidersExecuted(ApplicationModelProviderContext context)
{
// Intentionally empty.
}
@ -108,7 +107,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// </summary>
/// <param name="typeInfo">The <see cref="TypeInfo"/>.</param>
/// <returns>A <see cref="ControllerModel"/> for the given <see cref="TypeInfo"/>.</returns>
protected virtual ControllerModel CreateControllerModel(TypeInfo typeInfo)
internal ControllerModel CreateControllerModel(TypeInfo typeInfo)
{
if (typeInfo == null)
{
@ -215,7 +214,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// </summary>
/// <param name="propertyInfo">The <see cref="PropertyInfo"/>.</param>
/// <returns>A <see cref="PropertyModel"/> for the given <see cref="PropertyInfo"/>.</returns>
protected virtual PropertyModel CreatePropertyModel(PropertyInfo propertyInfo)
internal PropertyModel CreatePropertyModel(PropertyInfo propertyInfo)
{
if (propertyInfo == null)
{
@ -263,7 +262,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// An <see cref="ActionModel"/> instance for the given action <see cref="MethodInfo"/> or
/// <c>null</c> if the <paramref name="methodInfo"/> does not represent an action.
/// </returns>
protected virtual ActionModel CreateActionModel(
internal ActionModel CreateActionModel(
TypeInfo typeInfo,
MethodInfo methodInfo)
{
@ -381,7 +380,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <remarks>
/// Override this method to provide custom logic to determine which methods are considered actions.
/// </remarks>
protected virtual bool IsAction(TypeInfo typeInfo, MethodInfo methodInfo)
internal bool IsAction(TypeInfo typeInfo, MethodInfo methodInfo)
{
if (typeInfo == null)
{
@ -445,7 +444,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// </summary>
/// <param name="parameterInfo">The <see cref="ParameterInfo"/>.</param>
/// <returns>A <see cref="ParameterModel"/> for the given <see cref="ParameterInfo"/>.</returns>
protected virtual ParameterModel CreateParameterModel(ParameterInfo parameterInfo)
internal ParameterModel CreateParameterModel(ParameterInfo parameterInfo)
{
if (parameterInfo == null)
{

View File

@ -3,7 +3,6 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Routing.Template;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;
@ -99,14 +98,14 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
private bool ParameterExistsInAnyRoute(ActionModel action, string parameterName)
{
foreach (var (route, _, _) in ActionAttributeRouteModel.GetAttributeRoutes(action))
foreach (var selector in ActionAttributeRouteModel.FlattenSelectors(action))
{
if (route == null)
if (selector.AttributeRouteModel == null)
{
continue;
}
var parsedTemplate = TemplateParser.Parse(route.Template);
var parsedTemplate = TemplateParser.Parse(selector.AttributeRouteModel.Template);
if (parsedTemplate.GetParameter(parameterName) != null)
{
return true;

View File

@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
if (ShouldApply(action))
{
action.Properties[typeof(IOutboundParameterTransformer)] = _parameterTransformer;
action.RouteParameterTransformer = _parameterTransformer;
}
}

View File

@ -14,10 +14,10 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
{
internal static HashSet<string> ReferenceAssemblies { get; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
// The deps file for the Microsoft.AspNetCore.All shared runtime is authored in a way where it does not say
// The deps file for the Microsoft.AspNetCore.App shared runtime is authored in a way where it does not say
// it depends on Microsoft.AspNetCore.Mvc even though it does. Explicitly list it so that referencing this runtime causes
// assembly discovery to work correctly.
"Microsoft.AspNetCore.All",
"Microsoft.AspNetCore.App",
"Microsoft.AspNetCore.Mvc",
"Microsoft.AspNetCore.Mvc.Abstractions",
"Microsoft.AspNetCore.Mvc.ApiExplorer",
@ -28,7 +28,6 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
"Microsoft.AspNetCore.Mvc.Formatters.Xml",
"Microsoft.AspNetCore.Mvc.Localization",
"Microsoft.AspNetCore.Mvc.Razor",
"Microsoft.AspNetCore.Mvc.Razor.Extensions",
"Microsoft.AspNetCore.Mvc.RazorPages",
"Microsoft.AspNetCore.Mvc.TagHelpers",
"Microsoft.AspNetCore.Mvc.ViewFeatures",
@ -154,7 +153,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
// Internal for unit testing
internal static IEnumerable<RuntimeLibrary> GetCandidateLibraries(DependencyContext dependencyContext)
{
// When using Microsoft.AspNetCore.App \ Microsoft.AspNetCore.All shared runtimes, entries in the RuntimeLibraries
// When using the Microsoft.AspNetCore.App shared runtimes, entries in the RuntimeLibraries
// get "erased" and it is no longer accurate to query to determine a library's dependency closure.
// We'll use CompileLibraries to calculate the dependency graph and runtime library to resolve assemblies to inspect.
var candidatesResolver = new CandidateResolver(dependencyContext.CompileLibraries, ReferenceAssemblies);

View File

@ -8,9 +8,9 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization.Policy;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

View File

@ -0,0 +1,24 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Routing;
namespace Microsoft.AspNetCore.Builder
{
internal class DefaultEndpointConventionBuilder : IEndpointConventionBuilder
{
public DefaultEndpointConventionBuilder()
{
Conventions = new List<Action<EndpointModel>>();
}
public List<Action<EndpointModel>> Conventions { get; }
public void Apply(Action<EndpointModel> convention)
{
Conventions.Add(convention);
}
}
}

View File

@ -4,10 +4,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
@ -90,9 +89,7 @@ namespace Microsoft.AspNetCore.Builder
if (options.Value.EnableEndpointRouting)
{
var mvcEndpointDataSource = app.ApplicationServices
.GetRequiredService<IEnumerable<EndpointDataSource>>()
.OfType<MvcEndpointDataSource>()
.First();
.GetRequiredService<MvcEndpointDataSource>();
var parameterPolicyFactory = app.ApplicationServices
.GetRequiredService<ParameterPolicyFactory>();
@ -122,11 +119,21 @@ namespace Microsoft.AspNetCore.Builder
}
}
// Include all controllers with attribute routing and Razor pages
var defaultEndpointConventionBuilder = new DefaultEndpointConventionBuilder();
mvcEndpointDataSource.AttributeRoutingConventionResolvers.Add((actionDescriptor) =>
{
return defaultEndpointConventionBuilder;
});
if (!app.Properties.TryGetValue(EndpointRoutingRegisteredKey, out _))
{
// Matching middleware has not been registered yet
// For back-compat register middleware so an endpoint is matched and then immediately used
app.UseEndpointRouting();
app.UseEndpointRouting(routerBuilder =>
{
routerBuilder.DataSources.Add(mvcEndpointDataSource);
});
}
return app.UseEndpoint();

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Routing.Patterns;
namespace Microsoft.AspNetCore.Builder
{
internal class MvcEndpointInfo
internal class MvcEndpointInfo : DefaultEndpointConventionBuilder
{
public MvcEndpointInfo(
string name,

View File

@ -0,0 +1,121 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Builder
{
public static class MvcEndpointRouteBuilderExtensions
{
public static IEndpointConventionBuilder MapApplication(
this IEndpointRouteBuilder routeBuilder)
{
return MapActionDescriptors(routeBuilder, null);
}
public static IEndpointConventionBuilder MapAssembly<TContainingType>(
this IEndpointRouteBuilder routeBuilder)
{
return MapActionDescriptors(routeBuilder, typeof(TContainingType));
}
private static IEndpointConventionBuilder MapActionDescriptors(
this IEndpointRouteBuilder routeBuilder,
Type containingType)
{
var mvcEndpointDataSource = routeBuilder.DataSources.OfType<MvcEndpointDataSource>().FirstOrDefault();
if (mvcEndpointDataSource == null)
{
mvcEndpointDataSource = routeBuilder.ServiceProvider.GetRequiredService<MvcEndpointDataSource>();
routeBuilder.DataSources.Add(mvcEndpointDataSource);
}
var conventionBuilder = new DefaultEndpointConventionBuilder();
var assemblyFilter = containingType?.Assembly;
mvcEndpointDataSource.AttributeRoutingConventionResolvers.Add(actionDescriptor =>
{
// Filter a descriptor by the assembly
// Note that this will only filter actions on controllers
// Does not support filtering Razor pages embedded in assemblies
if (assemblyFilter != null)
{
if (actionDescriptor is ControllerActionDescriptor controllerActionDescriptor)
{
if (controllerActionDescriptor.ControllerTypeInfo.Assembly != assemblyFilter)
{
return null;
}
}
}
return conventionBuilder;
});
return conventionBuilder;
}
public static IEndpointConventionBuilder MapControllerRoute(
this IEndpointRouteBuilder routeBuilder,
string name,
string template)
{
return MapControllerRoute(routeBuilder, name, template, defaults: null);
}
public static IEndpointConventionBuilder MapControllerRoute(
this IEndpointRouteBuilder routeBuilder,
string name,
string template,
object defaults)
{
return MapControllerRoute(routeBuilder, name, template, defaults, constraints: null);
}
public static IEndpointConventionBuilder MapControllerRoute(
this IEndpointRouteBuilder routeBuilder,
string name,
string template,
object defaults,
object constraints)
{
return MapControllerRoute(routeBuilder, name, template, defaults, constraints, dataTokens: null);
}
public static IEndpointConventionBuilder MapControllerRoute(
this IEndpointRouteBuilder routeBuilder,
string name,
string template,
object defaults,
object constraints,
object dataTokens)
{
var mvcEndpointDataSource = routeBuilder.DataSources.OfType<MvcEndpointDataSource>().FirstOrDefault();
if (mvcEndpointDataSource == null)
{
mvcEndpointDataSource = routeBuilder.ServiceProvider.GetRequiredService<MvcEndpointDataSource>();
routeBuilder.DataSources.Add(mvcEndpointDataSource);
}
var endpointInfo = new MvcEndpointInfo(
name,
template,
new RouteValueDictionary(defaults),
new RouteValueDictionary(constraints),
new RouteValueDictionary(dataTokens),
routeBuilder.ServiceProvider.GetRequiredService<ParameterPolicyFactory>());
mvcEndpointDataSource.ConventionalEndpointInfos.Add(endpointInfo);
return endpointInfo;
}
}
}

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

View File

@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Net.Http.Headers;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;

View File

@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc

View File

@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;

View File

@ -4,9 +4,9 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Controllers
{
public delegate Task ControllerBinderDelegate(
internal delegate Task ControllerBinderDelegate(
ControllerContext controllerContext,
object controller,
Dictionary<string, object> arguments);

View File

@ -7,10 +7,10 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Controllers
{
// Note: changes made to binding behavior in type should also be made to PageBinderFactory.
public static class ControllerBinderDelegateProvider
internal static class ControllerBinderDelegateProvider
{
public static ControllerBinderDelegate CreateBinderDelegate(
ParameterBinder parameterBinder,

View File

@ -5,11 +5,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
namespace Microsoft.AspNetCore.Mvc.Controllers
{
public class ControllerFactoryProvider : IControllerFactoryProvider
internal class ControllerFactoryProvider : IControllerFactoryProvider
{
private readonly IControllerActivatorProvider _activatorProvider;
private readonly Func<ControllerContext, object> _factoryCreateController;
@ -19,10 +18,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
public ControllerFactoryProvider(
IControllerActivatorProvider activatorProvider,
IControllerFactory controllerFactory,
#pragma warning disable PUB0001 // Pubternal type in public API
IEnumerable<IControllerPropertyActivator> propertyActivators
#pragma warning restore PUB0001
)
IEnumerable<IControllerPropertyActivator> propertyActivators)
{
if (activatorProvider == null)
{

View File

@ -3,14 +3,14 @@
using System;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Infrastructure;
namespace Microsoft.AspNetCore.Mvc.Controllers
{
/// <summary>
/// <see cref="IControllerActivator"/> that uses type activation to create controllers.
/// </summary>
public class DefaultControllerActivator : IControllerActivator
internal class DefaultControllerActivator : IControllerActivator
{
private readonly ITypeActivatorCache _typeActivatorCache;
@ -18,9 +18,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
/// Creates a new <see cref="DefaultControllerActivator"/>.
/// </summary>
/// <param name="typeActivatorCache">The <see cref="ITypeActivatorCache"/>.</param>
#pragma warning disable PUB0001 // Pubternal type in public API
public DefaultControllerActivator(ITypeActivatorCache typeActivatorCache)
#pragma warning restore PUB0001
{
if (typeActivatorCache == null)
{
@ -31,7 +29,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
}
/// <inheritdoc />
public virtual object Create(ControllerContext controllerContext)
public object Create(ControllerContext controllerContext)
{
if (controllerContext == null)
{
@ -59,7 +57,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
}
/// <inheritdoc />
public virtual void Release(ControllerContext context, object controller)
public void Release(ControllerContext context, object controller)
{
if (context == null)
{
@ -71,8 +69,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
throw new ArgumentNullException(nameof(controller));
}
var disposable = controller as IDisposable;
if (disposable != null)
if (controller is IDisposable disposable)
{
disposable.Dispose();
}

View File

@ -5,14 +5,13 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
namespace Microsoft.AspNetCore.Mvc.Controllers
{
/// <summary>
/// Default implementation for <see cref="IControllerFactory"/>.
/// </summary>
public class DefaultControllerFactory : IControllerFactory
internal class DefaultControllerFactory : IControllerFactory
{
private readonly IControllerActivator _controllerActivator;
private readonly IControllerPropertyActivator[] _propertyActivators;
@ -29,10 +28,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
/// </param>
public DefaultControllerFactory(
IControllerActivator controllerActivator,
#pragma warning disable PUB0001 // Pubternal type in public API
IEnumerable<IControllerPropertyActivator> propertyActivators
#pragma warning restore PUB0001
)
IEnumerable<IControllerPropertyActivator> propertyActivators)
{
if (controllerActivator == null)
{
@ -48,13 +44,8 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
_propertyActivators = propertyActivators.ToArray();
}
/// <summary>
/// The <see cref="IControllerActivator"/> used to create a controller.
/// </summary>
protected IControllerActivator ControllerActivator => _controllerActivator;
/// <inheritdoc />
public virtual object CreateController(ControllerContext context)
public object CreateController(ControllerContext context)
{
if (context == null)
{
@ -78,7 +69,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
}
/// <inheritdoc />
public virtual void ReleaseController(ControllerContext context, object controller)
public void ReleaseController(ControllerContext context, object controller)
{
if (context == null)
{

View File

@ -6,13 +6,12 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Controllers
{
public class DefaultControllerPropertyActivator : IControllerPropertyActivator
internal class DefaultControllerPropertyActivator : IControllerPropertyActivator
{
private static readonly Func<Type, PropertyActivator<ControllerContext>[]> _getPropertiesToActivate =
GetPropertiesToActivate;

View File

@ -2,11 +2,10 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc.Controllers;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Controllers
{
public interface IControllerPropertyActivator
internal interface IControllerPropertyActivator
{
void Activate(ControllerContext context, object controller);

View File

@ -4,14 +4,15 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.Extensions.DependencyInjection
{
public class ApiBehaviorOptionsSetup :
internal class ApiBehaviorOptionsSetup :
ConfigureCompatibilityOptions<ApiBehaviorOptions>,
IConfigureOptions<ApiBehaviorOptions>
{

View File

@ -3,14 +3,13 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Allows fine grained configuration of MVC services.
/// </summary>
public class MvcBuilder : IMvcBuilder
internal class MvcBuilder : IMvcBuilder
{
/// <summary>
/// Initializes a new <see cref="MvcBuilder"/> instance.
@ -39,4 +38,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <inheritdoc />
public ApplicationPartManager PartManager { get; }
}
}
}

View File

@ -3,14 +3,13 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Allows fine grained configuration of essential MVC services.
/// </summary>
public class MvcCoreBuilder : IMvcCoreBuilder
internal class MvcCoreBuilder : IMvcCoreBuilder
{
/// <summary>
/// Initializes a new <see cref="MvcCoreBuilder"/> instance.
@ -41,4 +40,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <inheritdoc />
public IServiceCollection Services { get; }
}
}
}

View File

@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Microsoft.Extensions.DependencyInjection

View File

@ -6,12 +6,12 @@ using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Sets up MVC default options for <see cref="RouteOptions"/>.
/// </summary>
public class MvcCoreRouteOptionsSetup : IConfigureOptions<RouteOptions>
internal class MvcCoreRouteOptionsSetup : IConfigureOptions<RouteOptions>
{
/// <summary>
/// Configures the <see cref="RouteOptions"/>.

View File

@ -13,7 +13,6 @@ using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
@ -159,7 +158,7 @@ namespace Microsoft.Extensions.DependencyInjection
// Action Discovery
//
// These are consumed only when creating action descriptors, then they can be deallocated
services.TryAddSingleton<ApplicationModelFactory>();
services.TryAddEnumerable(
ServiceDescriptor.Transient<IApplicationModelProvider, DefaultApplicationModelProvider>());
services.TryAddEnumerable(
@ -270,8 +269,7 @@ namespace Microsoft.Extensions.DependencyInjection
//
// Endpoint Routing / Endpoints
//
services.TryAddEnumerable(
ServiceDescriptor.Singleton<EndpointDataSource, MvcEndpointDataSource>());
services.TryAddSingleton<MvcEndpointDataSource>();
services.TryAddSingleton<MvcEndpointInvokerFactory>();
//

View File

@ -1,15 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// A marker class used to determine if all the MVC services were added
/// to the <see cref="IServiceCollection"/> before MVC is configured.
/// </summary>
public class MvcMarkerService
internal class MvcMarkerService
{
}
}
}

View File

@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc

View File

@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Net.Http.Headers;

View File

@ -5,7 +5,6 @@ using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Net.Http.Headers;

View File

@ -4,14 +4,13 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter implementation which delegates to the controller for action filter interfaces.
/// </summary>
public class ControllerActionFilter : IAsyncActionFilter, IOrderedFilter
internal class ControllerActionFilter : IAsyncActionFilter, IOrderedFilter
{
// Controller-filter methods run farthest from the action by default.
/// <inheritdoc />
@ -55,7 +54,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
private static async Task ExecuteActionFilter(
ActionExecutingContext context,
ActionExecutingContext context,
ActionExecutionDelegate next,
IActionFilter actionFilter)
{
@ -66,4 +65,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
}
}

View File

@ -4,14 +4,13 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter implementation which delegates to the controller for result filter interfaces.
/// </summary>
public class ControllerResultFilter : IAsyncResultFilter, IOrderedFilter
internal class ControllerResultFilter : IAsyncResultFilter, IOrderedFilter
{
// Controller-filter methods run farthest from the result by default.
/// <inheritdoc />
@ -66,4 +65,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
}
}

View File

@ -4,11 +4,10 @@
using System;
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public class DefaultFilterProvider : IFilterProvider
internal class DefaultFilterProvider : IFilterProvider
{
public int Order => -1000;
@ -35,7 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
{
}
public virtual void ProvideFilter(FilterProviderContext context, FilterItem filterItem)
public void ProvideFilter(FilterProviderContext context, FilterItem filterItem)
{
if (filterItem.Filter != null)
{
@ -44,8 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = filterItem.Descriptor.Filter;
var filterFactory = filter as IFilterFactory;
if (filterFactory == null)
if (!(filter is IFilterFactory filterFactory))
{
filterItem.Filter = filter;
filterItem.IsReusable = true;
@ -72,9 +70,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
Debug.Assert(actualFilter != null, "actualFilter should not be null");
Debug.Assert(filterMetadata != null, "filterMetadata should not be null");
var container = actualFilter as IFilterContainer;
if (container != null)
if (actualFilter is IFilterContainer container)
{
container.FilterDefinition = filterMetadata;
}

View File

@ -3,16 +3,15 @@
using System;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter that sets <see cref="IHttpMaxRequestBodySizeFeature.MaxRequestBodySize"/>
/// to <c>null</c>.
/// </summary>
public class DisableRequestSizeLimitFilter : IAuthorizationFilter, IRequestSizePolicy
internal class DisableRequestSizeLimitFilter : IAuthorizationFilter, IRequestSizePolicy
{
private readonly ILogger _logger;
@ -29,8 +28,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// to <c>null</c>.
/// </summary>
/// <param name="context">The <see cref="AuthorizationFilterContext"/>.</param>
/// <remarks>If <see cref="IHttpMaxRequestBodySizeFeature"/> is not enabled or is read-only,
/// the <see cref="DisableRequestSizeLimitAttribute"/> is not applied.</remarks>
/// <remarks>If <see cref="IHttpMaxRequestBodySizeFeature"/> is not enabled or is read-only,
/// the <see cref="DisableRequestSizeLimitAttribute"/> is not applied.</remarks>
public void OnAuthorization(AuthorizationFilterContext context)
{
if (context == null)

View File

@ -1,9 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A one-way cursor for filters.
@ -25,7 +23,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// Result
///
/// </remarks>
public struct FilterCursor
internal struct FilterCursor
{
private readonly IFilterMetadata[] _filters;
private int _index;

View File

@ -1,9 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public readonly struct FilterCursorItem<TFilter, TFilterAsync>
internal readonly struct FilterCursorItem<TFilter, TFilterAsync>
{
public FilterCursorItem(TFilter filter, TFilterAsync filterAsync)
{

View File

@ -5,9 +5,9 @@ using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public class FilterDescriptorOrderComparer : IComparer<FilterDescriptor>
internal class FilterDescriptorOrderComparer : IComparer<FilterDescriptor>
{
public static FilterDescriptorOrderComparer Comparer { get; } = new FilterDescriptorOrderComparer();

View File

@ -4,11 +4,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public static class FilterFactory
internal static class FilterFactory
{
public static FilterFactoryResult GetAllFilters(
IFilterProvider[] filterProviders,

View File

@ -1,11 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public readonly struct FilterFactoryResult
internal readonly struct FilterFactoryResult
{
public FilterFactoryResult(
FilterItem[] cacheableFilters,

View File

@ -1,19 +1,17 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A feature in <see cref="Microsoft.AspNetCore.Http.HttpContext.Features"/> which is used to capture the
/// currently executing context of a resource filter. This feature is used in the final middleware
/// of a middleware filter's pipeline to keep the request flow through the rest of the MVC layers.
/// </summary>
public interface IMiddlewareFilterFeature
internal interface IMiddlewareFilterFeature
{
ResourceExecutingContext ResourceExecutingContext { get; }
ResourceExecutionDelegate ResourceExecutionDelegate { get; }
}
}
}

View File

@ -1,14 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter which sets the appropriate headers related to Response caching.
/// </summary>
public interface IResponseCacheFilter : IFilterMetadata
internal interface IResponseCacheFilter : IFilterMetadata
{
}
}
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter which executes a user configured middleware pipeline.

View File

@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc

View File

@ -7,12 +7,12 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// Builds a middleware pipeline after receiving the pipeline from a pipeline provider
/// </summary>
public class MiddlewareFilterBuilder
internal class MiddlewareFilterBuilder
{
// 'GetOrAdd' call on the dictionary is not thread safe and we might end up creating the pipeline more
// once. To prevent this Lazy<> is used. In the worst case multiple Lazy<> objects are created for multiple

View File

@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
internal class MiddlewareFilterBuilderStartupFilter : IStartupFilter
{
@ -23,4 +23,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
}
}

View File

@ -8,13 +8,13 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// Calls into user provided 'Configure' methods for configuring a middleware pipeline. The semantics of finding
/// the 'Configure' methods is similar to the application Startup class.
/// </summary>
public class MiddlewareFilterConfigurationProvider
internal class MiddlewareFilterConfigurationProvider
{
public Action<IApplicationBuilder> CreateConfigureDelegate(Type configurationType)
{

Some files were not shown because too many files have changed in this diff Show More