diff --git a/src/Mvc/Directory.Build.targets b/src/Mvc/Directory.Build.targets
index 73b97f2807..51a6545f0c 100644
--- a/src/Mvc/Directory.Build.targets
+++ b/src/Mvc/Directory.Build.targets
@@ -1,9 +1,7 @@
$(MicrosoftNETCoreApp21PackageVersion)
- $(MicrosoftNETCoreApp22PackageVersion)
+ $(MicrosoftNETCoreAppPackageVersion)
$(NETStandardLibrary20PackageVersion)
-
- 99.9
diff --git a/src/Mvc/Mvc.NoFun.sln b/src/Mvc/Mvc.NoFun.sln
index d67abd6f60..0a8840d257 100644
--- a/src/Mvc/Mvc.NoFun.sln
+++ b/src/Mvc/Mvc.NoFun.sln
@@ -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}
diff --git a/src/Mvc/Mvc.sln b/src/Mvc/Mvc.sln
index dcd83f09ca..00eabf0c6a 100644
--- a/src/Mvc/Mvc.sln
+++ b/src/Mvc/Mvc.sln
@@ -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}
diff --git a/src/Mvc/README.md b/src/Mvc/README.md
index 775ed6bd0c..babc35f1d9 100644
--- a/src/Mvc/README.md
+++ b/src/Mvc/README.md
@@ -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: [](https://travis-ci.org/aspnet/Mvc)
+Travis: [](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.
diff --git a/src/Mvc/benchmarkapps/BasicApi/BasicApi.csproj b/src/Mvc/benchmarkapps/BasicApi/BasicApi.csproj
index ec6e654069..397424ebfd 100644
--- a/src/Mvc/benchmarkapps/BasicApi/BasicApi.csproj
+++ b/src/Mvc/benchmarkapps/BasicApi/BasicApi.csproj
@@ -1,7 +1,6 @@
- netcoreapp2.2
- $(TargetFrameworks);net461
+ netcoreapp3.0
$(BenchmarksTargetFramework)
$(DefineConstants);GENERATE_SQL_SCRIPTS
@@ -38,6 +37,6 @@
Use All meta-package and not App to include Microsoft.EntityFrameworkCore.Sqlite.
-->
-
+
diff --git a/src/Mvc/benchmarkapps/BasicApi/benchmarks.json b/src/Mvc/benchmarkapps/BasicApi/benchmarks.json
index aff5eb280d..c1497d0465 100644
--- a/src/Mvc/benchmarkapps/BasicApi/benchmarks.json
+++ b/src/Mvc/benchmarkapps/BasicApi/benchmarks.json
@@ -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"
}
}
}
diff --git a/src/Mvc/benchmarkapps/BasicViews/BasicViews.csproj b/src/Mvc/benchmarkapps/BasicViews/BasicViews.csproj
index 6e62f39598..ba832b8e25 100644
--- a/src/Mvc/benchmarkapps/BasicViews/BasicViews.csproj
+++ b/src/Mvc/benchmarkapps/BasicViews/BasicViews.csproj
@@ -1,7 +1,6 @@
- netcoreapp2.2
- $(TargetFrameworks);net461
+ netcoreapp3.0
$(BenchmarksTargetFramework)
$(DefineConstants);GENERATE_SQL_SCRIPTS
@@ -38,7 +37,7 @@
Use All meta-package and not App to include Microsoft.EntityFrameworkCore.Sqlite.
-->
-
-
+
+
diff --git a/src/Mvc/benchmarkapps/BasicViews/benchmarks.json b/src/Mvc/benchmarkapps/BasicViews/benchmarks.json
index 6a50d9386d..75e77df4c5 100644
--- a/src/Mvc/benchmarkapps/BasicViews/benchmarks.json
+++ b/src/Mvc/benchmarkapps/BasicViews/benchmarks.json
@@ -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"
}
diff --git a/src/Mvc/benchmarkapps/RazorRendering/RazorRendering.csproj b/src/Mvc/benchmarkapps/RazorRendering/RazorRendering.csproj
index dc531b3fdf..c599280493 100644
--- a/src/Mvc/benchmarkapps/RazorRendering/RazorRendering.csproj
+++ b/src/Mvc/benchmarkapps/RazorRendering/RazorRendering.csproj
@@ -1,6 +1,7 @@
- netcoreapp2.2
+ netcoreapp3.0
+ $(BenchmarksTargetFramework)
@@ -16,8 +17,8 @@
These references are used when running on the Benchmarks Server.
-->
-
-
+
+
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/HelperExtensions.cs b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/HelperExtensions.cs
new file mode 100644
index 0000000000..460ffef86f
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/HelperExtensions.cs
@@ -0,0 +1,21 @@
+using System;
+using Microsoft.AspNetCore.Html;
+using Microsoft.AspNetCore.Mvc.Razor;
+
+public static class HelperExtensions
+{
+ public static Func Helper(
+ this RazorPageBase page,
+ Func> helper
+ ) => p1 => helper(p1)(null);
+
+ public static Func Helper(
+ this RazorPageBase page,
+ Func> helper
+ ) => (p1, p2) => helper(p1, p2)(null);
+
+ public static Func Helper(
+ this RazorPageBase page,
+ Func> helper
+ ) => (p1, p2, p3) => helper(p1, p2, p3)(null);
+}
\ No newline at end of file
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Microsoft.AspNetCore.Mvc.Performance.Views.csproj b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Microsoft.AspNetCore.Mvc.Performance.Views.csproj
new file mode 100644
index 0000000000..ad01f2e69e
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Microsoft.AspNetCore.Mvc.Performance.Views.csproj
@@ -0,0 +1,18 @@
+
+
+
+ netcoreapp3.0
+
+ false
+
+ <_EnableAllInclusiveRazorSdk>true
+ 3.0
+ MVC-3.0
+
+
+
+
+
+
+
+
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/ViewAssemblyMarker.cs b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/ViewAssemblyMarker.cs
new file mode 100644
index 0000000000..bf2dfcd02d
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/ViewAssemblyMarker.cs
@@ -0,0 +1,6 @@
+namespace Microsoft.AspNetCore.Mvc.Performance
+{
+ public class ViewAssemblyMarker
+ {
+ }
+}
\ No newline at end of file
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelloWorld.cshtml b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelloWorld.cshtml
new file mode 100644
index 0000000000..70c379b63f
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelloWorld.cshtml
@@ -0,0 +1 @@
+Hello world
\ No newline at end of file
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperDynamic.cshtml b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperDynamic.cshtml
new file mode 100644
index 0000000000..8a476f9847
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperDynamic.cshtml
@@ -0,0 +1,7 @@
+@using System;
+@using Microsoft.AspNetCore.Html
+@model System.String
+@{Func SomeHelper = @@{
+@item
+};}
+@for (var i = 0; i < 100; i++){@SomeHelper(Model + i.ToString())}
\ No newline at end of file
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperExtensions.cshtml b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperExtensions.cshtml
new file mode 100644
index 0000000000..583a755d1b
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperExtensions.cshtml
@@ -0,0 +1,10 @@
+@using System;
+@using Microsoft.AspNetCore.Html
+@model System.String
+@{
+ var SomeHelper = this.Helper((string s) => @@item);
+}
+@for (var i = 0; i < 100; i++)
+{
+ @SomeHelper(Model + i.ToString())
+}
\ No newline at end of file
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartialAsync.cshtml b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartialAsync.cshtml
new file mode 100644
index 0000000000..d8bc51b756
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartialAsync.cshtml
@@ -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());
+}
\ No newline at end of file
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartialSync.cshtml b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartialSync.cshtml
new file mode 100644
index 0000000000..cd17862b20
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartialSync.cshtml
@@ -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());
+}
\ No newline at end of file
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartialTagHelper.cshtml b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartialTagHelper.cshtml
new file mode 100644
index 0000000000..dc76d33bf2
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartialTagHelper.cshtml
@@ -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++)
+{}
\ No newline at end of file
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartial_Partial.cshtml b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartial_Partial.cshtml
new file mode 100644
index 0000000000..da3f4178ae
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperPartial_Partial.cshtml
@@ -0,0 +1,2 @@
+@model System.String
+@Model
\ No newline at end of file
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperTyped.cshtml b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperTyped.cshtml
new file mode 100644
index 0000000000..4eec71bbbf
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperTyped.cshtml
@@ -0,0 +1,7 @@
+@using System;
+@using Microsoft.AspNetCore.Html
+@model System.String
+@{Func SomeHelper = @@{
+@item
+};}
+@for (var i = 0; i < 100; i++){@SomeHelper(Model + i.ToString())}
\ No newline at end of file
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/ActionSelectorBenchmark.cs b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/ActionSelectorBenchmark.cs
index d207316ddc..38d363e9c0 100644
--- a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/ActionSelectorBenchmark.cs
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/ActionSelectorBenchmark.cs
@@ -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;
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/HelperPerformanceBenchmark.cs b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/HelperPerformanceBenchmark.cs
new file mode 100644
index 0000000000..572a11a73b
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/HelperPerformanceBenchmark.cs
@@ -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();
+ }
+}
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/Microsoft.AspNetCore.Mvc.Performance.csproj b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/Microsoft.AspNetCore.Mvc.Performance.csproj
index da89cbef0a..c4cbacc80a 100644
--- a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/Microsoft.AspNetCore.Mvc.Performance.csproj
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/Microsoft.AspNetCore.Mvc.Performance.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.1
+ netcoreapp3.0
Exe
true
true
@@ -9,11 +9,15 @@
+
+
+
+
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/MvcEndpointDatasourceBenchmark.cs b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/MvcEndpointDatasourceBenchmark.cs
index 028293dd28..efdb91d2f6 100644
--- a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/MvcEndpointDatasourceBenchmark.cs
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/MvcEndpointDatasourceBenchmark.cs
@@ -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;
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/RuntimePerformanceBenchmarkBase.cs b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/RuntimePerformanceBenchmarkBase.cs
new file mode 100644
index 0000000000..a763cba861
--- /dev/null
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/RuntimePerformanceBenchmarkBase.cs
@@ -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 state) => null;
+ bool ILogger.IsEnabled(LogLevel logLevel) => false;
+ void ILogger.Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) {}
+ }
+
+ private class BenchmarkViewExecutor : ViewExecutor
+ {
+ public BenchmarkViewExecutor(IOptions 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()
+ .AddSingleton()
+ .AddSingleton(listener)
+ .AddSingleton(listener)
+ .AddSingleton()
+ .AddSingleton(partManager)
+ .AddScoped()
+ .AddMvc();
+
+ _serviceProvider = services.BuildServiceProvider();
+ _routeData = new RouteData();
+ _actionDescriptor = new ActionDescriptor();
+ _tempDataDictionaryFactory = _serviceProvider.GetRequiredService();
+ _viewEngine = _serviceProvider.GetRequiredService();
+ }
+
+ [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(),
+ _actionContext.ModelState);
+ _viewDataDictionary.Model = Model;
+
+ _executor = _requestScope.ServiceProvider.GetRequiredService();
+ }
+
+ [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 RenderView()
+ {
+ await _executor.ExecuteAsync(
+ _actionContext,
+ _viewEngineResult.View,
+ _viewDataDictionary,
+ _tempData,
+ "text/html",
+ 200);
+ return _executor.StringBuilder.ToString();
+ }
+ }
+}
diff --git a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/ValidationVisitorBenchmarkBase.cs b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/ValidationVisitorBenchmarkBase.cs
index cfa12d5f1b..8d66120fd2 100644
--- a/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/ValidationVisitorBenchmarkBase.cs
+++ b/src/Mvc/benchmarks/Microsoft.AspNetCore.Mvc.Performance/ValidationVisitorBenchmarkBase.cs
@@ -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;
diff --git a/src/Mvc/build/dependencies.props b/src/Mvc/build/dependencies.props
index 063add026b..6f2f0187d0 100644
--- a/src/Mvc/build/dependencies.props
+++ b/src/Mvc/build/dependencies.props
@@ -16,97 +16,94 @@
0.43.0
2.1.1.1
2.1.1
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-a-rtm-fix-wildcard-16567
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-preview-181113-11
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
2.0.0
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-a-rtm-allow-required-parameters-17081
- 2.2.0-a-rtm-allow-required-parameters-17081
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
+ 3.0.0-preview-181113-11
+ 3.0.0-alpha1-10742
5.2.6
- 15.6.82
+ 15.8.166
2.8.0
2.8.0
- 2.2.0-rtm-35519
+ 3.0.0-alpha1-10742
1.7.0
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.1.0
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview1-26907-05
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-alpha1-10742
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
+ 3.0.0-preview-181113-11
2.0.9
2.1.3
- 2.2.0-preview3-27014-02
- 2.2.0-rtm-35519
- 2.2.0-rtm-35519
+ 3.0.0-preview1-26907-05
+ 3.0.0-alpha1-10742
+ 3.0.0-alpha1-10742
15.6.1
4.10.0
2.0.3
1.0.1
11.0.2
- 4.5.0
- 4.5.0
+ 4.6.0-preview1-26907-04
+ 4.6.0-preview1-26907-04
4.3.2
- 4.5.1
+ 4.6.0-preview1-26907-04
0.10.0
2.3.1
2.4.0
diff --git a/src/Mvc/build/repo.props b/src/Mvc/build/repo.props
index 3bd17f1b84..4ec5530115 100644
--- a/src/Mvc/build/repo.props
+++ b/src/Mvc/build/repo.props
@@ -3,6 +3,7 @@
true
+ true
@@ -14,12 +15,11 @@
Internal.AspNetCore.Universe.Lineup
- 2.2.0-*
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json
-
+
diff --git a/src/Mvc/buildWithProcDump.cmd b/src/Mvc/buildWithProcDump.cmd
new file mode 100644
index 0000000000..c20f050402
--- /dev/null
+++ b/src/Mvc/buildWithProcDump.cmd
@@ -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"
diff --git a/src/Mvc/global.json b/src/Mvc/global.json
index b5a5299b58..6df6220662 100644
--- a/src/Mvc/global.json
+++ b/src/Mvc/global.json
@@ -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"
}
}
diff --git a/src/Mvc/runWithProcDump.ps1 b/src/Mvc/runWithProcDump.ps1
new file mode 100644
index 0000000000..03d665d662
--- /dev/null
+++ b/src/Mvc/runWithProcDump.ps1
@@ -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;
+}
\ No newline at end of file
diff --git a/src/Mvc/samples/MvcSandbox/Controllers/LoginController.cs b/src/Mvc/samples/MvcSandbox/Controllers/LoginController.cs
new file mode 100644
index 0000000000..5110850fbf
--- /dev/null
+++ b/src/Mvc/samples/MvcSandbox/Controllers/LoginController.cs
@@ -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();
+ }
+ }
+}
diff --git a/src/Mvc/samples/MvcSandbox/HealthChecks/HealthChecksEndpointRouteBuilderExtensions.cs b/src/Mvc/samples/MvcSandbox/HealthChecks/HealthChecksEndpointRouteBuilderExtensions.cs
new file mode 100644
index 0000000000..b89acdd2b4
--- /dev/null
+++ b/src/Mvc/samples/MvcSandbox/HealthChecks/HealthChecksEndpointRouteBuilderExtensions.cs
@@ -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!");
+ });
+ }
+ }
+}
diff --git a/src/Mvc/samples/MvcSandbox/MvcSandbox.csproj b/src/Mvc/samples/MvcSandbox/MvcSandbox.csproj
index d9e021ff7a..b1668d4793 100644
--- a/src/Mvc/samples/MvcSandbox/MvcSandbox.csproj
+++ b/src/Mvc/samples/MvcSandbox/MvcSandbox.csproj
@@ -1,8 +1,7 @@
- netcoreapp2.2
- $(TargetFrameworks);net461
+ netcoreapp3.0
@@ -11,10 +10,7 @@
-
-
-
diff --git a/src/Mvc/samples/MvcSandbox/Startup.cs b/src/Mvc/samples/MvcSandbox/Startup.cs
index d9f96bf08b..dac9f9d057 100644
--- a/src/Mvc/samples/MvcSandbox/Startup.cs
+++ b/src/Mvc/samples/MvcSandbox/Startup.cs
@@ -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();
+
+ var sb = new StringBuilder();
+ sb.AppendLine("Endpoints:");
+ foreach (var endpoint in dataSource.Endpoints.OfType().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)
diff --git a/src/Mvc/src/GetDocumentInsider/Commands/GetDocumentCommandWorker.cs b/src/Mvc/src/GetDocumentInsider/Commands/GetDocumentCommandWorker.cs
index af02bd7cc3..f16e5dc8ab 100644
--- a/src/Mvc/src/GetDocumentInsider/Commands/GetDocumentCommandWorker.cs
+++ b/src/Mvc/src/GetDocumentInsider/Commands/GetDocumentCommandWorker.cs
@@ -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();
}
}
diff --git a/src/Mvc/src/GetDocumentInsider/GetDocumentInsider.csproj b/src/Mvc/src/GetDocumentInsider/GetDocumentInsider.csproj
index 03d6440c1f..d0ca03bbfd 100644
--- a/src/Mvc/src/GetDocumentInsider/GetDocumentInsider.csproj
+++ b/src/Mvc/src/GetDocumentInsider/GetDocumentInsider.csproj
@@ -6,6 +6,9 @@
Exe
Microsoft.Extensions.ApiDescription.Tool
netcoreapp2.0;net461
+ false
+ $(ExperimentalVersionPrefix)
+ $(ExperimentalVersionSuffix)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Abstractions/Microsoft.AspNetCore.Mvc.Abstractions.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Abstractions/Microsoft.AspNetCore.Mvc.Abstractions.csproj
index 34f0f5e6a1..a9b297c080 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Abstractions/Microsoft.AspNetCore.Mvc.Abstractions.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Abstractions/Microsoft.AspNetCore.Mvc.Abstractions.csproj
@@ -4,7 +4,7 @@
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
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ApiExplorer/DefaultApiDescriptionProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ApiExplorer/DefaultApiDescriptionProvider.cs
index 6fd8c7e65f..d79f2f148d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ApiExplorer/DefaultApiDescriptionProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ApiExplorer/DefaultApiDescriptionProvider.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ApiExplorer/Microsoft.AspNetCore.Mvc.ApiExplorer.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ApiExplorer/Microsoft.AspNetCore.Mvc.ApiExplorer.csproj
index 308a2f225b..ae3e8a7f34 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ApiExplorer/Microsoft.AspNetCore.Mvc.ApiExplorer.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ApiExplorer/Microsoft.AspNetCore.Mvc.ApiExplorer.csproj
@@ -2,7 +2,7 @@
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.
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionConstraintCache.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/ActionConstraintCache.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionConstraintCache.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/ActionConstraintCache.cs
index 384d48bffa..238fbfba82 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionConstraintCache.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/ActionConstraintCache.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultActionConstraintProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/DefaultActionConstraintProvider.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultActionConstraintProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/DefaultActionConstraintProvider.cs
index 571f3ebebf..fe44d25be7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultActionConstraintProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/DefaultActionConstraintProvider.cs
@@ -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
{
///
/// A default implementation of .
@@ -14,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// implements or
/// /
///
- public class DefaultActionConstraintProvider : IActionConstraintProvider
+ internal class DefaultActionConstraintProvider : IActionConstraintProvider
{
///
public int Order => -1000;
@@ -61,4 +60,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/HttpMethodActionConstraint.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/HttpMethodActionConstraint.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/HttpMethodActionConstraint.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/HttpMethodActionConstraint.cs
index e310493486..4385e734e5 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/HttpMethodActionConstraint.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/HttpMethodActionConstraint.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IConsumesActionConstraint.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/IConsumesActionConstraint.cs
similarity index 69%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IConsumesActionConstraint.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/IConsumesActionConstraint.cs
index b004cbdcf3..9e368fe825 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IConsumesActionConstraint.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ActionConstraints/IConsumesActionConstraint.cs
@@ -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
{
///
/// An constraint that identifies a type which can be used to select an action
/// based on incoming request.
///
- public interface IConsumesActionConstraint : IActionConstraint
+ internal interface IConsumesActionConstraint : IActionConstraint
{
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ApiDescriptionActionData.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApiExplorer/ApiDescriptionActionData.cs
similarity index 86%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ApiDescriptionActionData.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApiExplorer/ApiDescriptionActionData.cs
index 1a24b3d8bd..bba3427bd7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ApiDescriptionActionData.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApiExplorer/ApiDescriptionActionData.cs
@@ -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
{
///
/// Represents data used to build an ApiDescription, stored as part of the
/// .
///
- public class ApiDescriptionActionData
+ internal class ApiDescriptionActionData
{
///
/// The ApiDescription.GroupName of ApiDescription objects for the associated
@@ -15,4 +15,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
///
public string GroupName { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/ActionAttributeRouteModel.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/ActionAttributeRouteModel.cs
new file mode 100644
index 0000000000..b7a60f3362
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/ActionAttributeRouteModel.cs
@@ -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 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();
+
+ 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 actionConstraints)
+ {
+ if (actionConstraints != null)
+ {
+ for (var i = 0; i < actionConstraints.Count;i++)
+ {
+ selector.ActionConstraints.Add(actionConstraints[i]);
+ }
+ }
+ }
+
+ private static void AddEndpointMetadata(SelectorModel selector, IList
/// The .
/// A for the given .
- protected virtual ParameterModel CreateParameterModel(ParameterInfo parameterInfo)
+ internal ParameterModel CreateParameterModel(ParameterInfo parameterInfo)
{
if (parameterInfo == null)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/InferParameterBindingInfoConvention.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/InferParameterBindingInfoConvention.cs
index 9a3839308a..0148be60b9 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/InferParameterBindingInfoConvention.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/InferParameterBindingInfoConvention.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/RouteTokenTransformerConvention.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/RouteTokenTransformerConvention.cs
index 004e4a22c3..44492420c1 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/RouteTokenTransformerConvention.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/RouteTokenTransformerConvention.cs
@@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
if (ShouldApply(action))
{
- action.Properties[typeof(IOutboundParameterTransformer)] = _parameterTransformer;
+ action.RouteParameterTransformer = _parameterTransformer;
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationAssembliesProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationAssembliesProvider.cs
index 08149805ff..b1d414a8ca 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationAssembliesProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationAssembliesProvider.cs
@@ -14,10 +14,10 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
{
internal static HashSet ReferenceAssemblies { get; } = new HashSet(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 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);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Authorization/AuthorizeFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Authorization/AuthorizeFilter.cs
index 29cf7cc085..df87c8d9f0 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Authorization/AuthorizeFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Authorization/AuthorizeFilter.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/DefaultEndpointConventionBuilder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/DefaultEndpointConventionBuilder.cs
new file mode 100644
index 0000000000..8427ba5c3b
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/DefaultEndpointConventionBuilder.cs
@@ -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>();
+ }
+
+ public List> Conventions { get; }
+
+ public void Apply(Action convention)
+ {
+ Conventions.Add(convention);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/MvcApplicationBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/MvcApplicationBuilderExtensions.cs
index 06e26ed407..2d873de87c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/MvcApplicationBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/MvcApplicationBuilderExtensions.cs
@@ -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>()
- .OfType()
- .First();
+ .GetRequiredService();
var parameterPolicyFactory = app.ApplicationServices
.GetRequiredService();
@@ -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();
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/MvcEndpointInfo.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/MvcEndpointInfo.cs
index 161189b871..5712fa6a55 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/MvcEndpointInfo.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/MvcEndpointInfo.cs
@@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Routing.Patterns;
namespace Microsoft.AspNetCore.Builder
{
- internal class MvcEndpointInfo
+ internal class MvcEndpointInfo : DefaultEndpointConventionBuilder
{
public MvcEndpointInfo(
string name,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/MvcEndpointRouteBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/MvcEndpointRouteBuilderExtensions.cs
new file mode 100644
index 0000000000..bef1b53372
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Builder/MvcEndpointRouteBuilderExtensions.cs
@@ -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(
+ this IEndpointRouteBuilder routeBuilder)
+ {
+ return MapActionDescriptors(routeBuilder, typeof(TContainingType));
+ }
+
+ private static IEndpointConventionBuilder MapActionDescriptors(
+ this IEndpointRouteBuilder routeBuilder,
+ Type containingType)
+ {
+ var mvcEndpointDataSource = routeBuilder.DataSources.OfType().FirstOrDefault();
+
+ if (mvcEndpointDataSource == null)
+ {
+ mvcEndpointDataSource = routeBuilder.ServiceProvider.GetRequiredService();
+ 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().FirstOrDefault();
+
+ if (mvcEndpointDataSource == null)
+ {
+ mvcEndpointDataSource = routeBuilder.ServiceProvider.GetRequiredService();
+ routeBuilder.DataSources.Add(mvcEndpointDataSource);
+ }
+
+ var endpointInfo = new MvcEndpointInfo(
+ name,
+ template,
+ new RouteValueDictionary(defaults),
+ new RouteValueDictionary(constraints),
+ new RouteValueDictionary(dataTokens),
+ routeBuilder.ServiceProvider.GetRequiredService());
+
+ mvcEndpointDataSource.ConventionalEndpointInfos.Add(endpointInfo);
+
+ return endpointInfo;
+ }
+ }
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ChallengeResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ChallengeResult.cs
index 7f7f0249ca..a0bcd94b00 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ChallengeResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ChallengeResult.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ConsumesAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ConsumesAttribute.cs
index 30a103a531..6893124313 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ConsumesAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ConsumesAttribute.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ContentResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ContentResult.cs
index 29c9ddab2d..6fd602d5c3 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ContentResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ContentResult.cs
@@ -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
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ControllerBase.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ControllerBase.cs
index 3cc780746a..22078bb2a5 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ControllerBase.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ControllerBase.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerBinderDelegate.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/ControllerBinderDelegate.cs
similarity index 78%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerBinderDelegate.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/ControllerBinderDelegate.cs
index 6a986160f0..dcfbe994f8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerBinderDelegate.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/ControllerBinderDelegate.cs
@@ -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 arguments);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerBinderDelegateProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/ControllerBinderDelegateProvider.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerBinderDelegateProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/ControllerBinderDelegateProvider.cs
index 20d600281e..bceb513944 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerBinderDelegateProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/ControllerBinderDelegateProvider.cs
@@ -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,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/ControllerFactoryProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/ControllerFactoryProvider.cs
index 8b70db1f79..5c0ee05088 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/ControllerFactoryProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/ControllerFactoryProvider.cs
@@ -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 _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 propertyActivators
-#pragma warning restore PUB0001
- )
+ IEnumerable propertyActivators)
{
if (activatorProvider == null)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/DefaultControllerActivator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/DefaultControllerActivator.cs
index 9de77f768c..9d40ddf8ef 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/DefaultControllerActivator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/DefaultControllerActivator.cs
@@ -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
{
///
/// that uses type activation to create controllers.
///
- public class DefaultControllerActivator : IControllerActivator
+ internal class DefaultControllerActivator : IControllerActivator
{
private readonly ITypeActivatorCache _typeActivatorCache;
@@ -18,9 +18,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
/// Creates a new .
///
/// The .
-#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
}
///
- public virtual object Create(ControllerContext controllerContext)
+ public object Create(ControllerContext controllerContext)
{
if (controllerContext == null)
{
@@ -59,7 +57,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
}
///
- 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();
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/DefaultControllerFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/DefaultControllerFactory.cs
index 8c10083810..065b8ebc5c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/DefaultControllerFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/DefaultControllerFactory.cs
@@ -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
{
///
/// Default implementation for .
///
- 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
///
public DefaultControllerFactory(
IControllerActivator controllerActivator,
-#pragma warning disable PUB0001 // Pubternal type in public API
- IEnumerable propertyActivators
-#pragma warning restore PUB0001
- )
+ IEnumerable propertyActivators)
{
if (controllerActivator == null)
{
@@ -48,13 +44,8 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
_propertyActivators = propertyActivators.ToArray();
}
- ///
- /// The used to create a controller.
- ///
- protected IControllerActivator ControllerActivator => _controllerActivator;
-
///
- public virtual object CreateController(ControllerContext context)
+ public object CreateController(ControllerContext context)
{
if (context == null)
{
@@ -78,7 +69,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
}
///
- public virtual void ReleaseController(ControllerContext context, object controller)
+ public void ReleaseController(ControllerContext context, object controller)
{
if (context == null)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultControllerPropertyActivator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/DefaultControllerPropertyActivator.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultControllerPropertyActivator.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/DefaultControllerPropertyActivator.cs
index 857a4b23cb..20f0b74ecc 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultControllerPropertyActivator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/DefaultControllerPropertyActivator.cs
@@ -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[]> _getPropertiesToActivate =
GetPropertiesToActivate;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IControllerPropertyActivatorFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/IControllerPropertyActivatorFactory.cs
similarity index 73%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IControllerPropertyActivatorFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/IControllerPropertyActivatorFactory.cs
index 441dee9898..95d9cff4a5 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IControllerPropertyActivatorFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Controllers/IControllerPropertyActivatorFactory.cs
@@ -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);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ApiBehaviorOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/ApiBehaviorOptionsSetup.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ApiBehaviorOptionsSetup.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/ApiBehaviorOptionsSetup.cs
index 02ae3bc30d..6203729684 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ApiBehaviorOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/ApiBehaviorOptionsSetup.cs
@@ -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,
IConfigureOptions
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcBuilder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcBuilder.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcBuilder.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcBuilder.cs
index d2a0db532e..2a339145df 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcBuilder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcBuilder.cs
@@ -3,14 +3,13 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
-using Microsoft.Extensions.DependencyInjection;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.Extensions.DependencyInjection
{
///
/// Allows fine grained configuration of MVC services.
///
- public class MvcBuilder : IMvcBuilder
+ internal class MvcBuilder : IMvcBuilder
{
///
/// Initializes a new instance.
@@ -39,4 +38,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
///
public ApplicationPartManager PartManager { get; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreBuilder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreBuilder.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreBuilder.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreBuilder.cs
index 89a9897afd..b6674f6520 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreBuilder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreBuilder.cs
@@ -3,14 +3,13 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
-using Microsoft.Extensions.DependencyInjection;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.Extensions.DependencyInjection
{
///
/// Allows fine grained configuration of essential MVC services.
///
- public class MvcCoreBuilder : IMvcCoreBuilder
+ internal class MvcCoreBuilder : IMvcCoreBuilder
{
///
/// Initializes a new instance.
@@ -41,4 +40,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
///
public IServiceCollection Services { get; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreMvcCoreBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreMvcCoreBuilderExtensions.cs
index 57499c930a..37677903ef 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreMvcCoreBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreMvcCoreBuilderExtensions.cs
@@ -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
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreRouteOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreRouteOptionsSetup.cs
similarity index 87%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreRouteOptionsSetup.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreRouteOptionsSetup.cs
index 6ed400f506..85af370d9f 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreRouteOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreRouteOptionsSetup.cs
@@ -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
{
///
/// Sets up MVC default options for .
///
- public class MvcCoreRouteOptionsSetup : IConfigureOptions
+ internal class MvcCoreRouteOptionsSetup : IConfigureOptions
{
///
/// Configures the .
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreServiceCollectionExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreServiceCollectionExtensions.cs
index 95a4afb21b..8ea71b7178 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreServiceCollectionExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreServiceCollectionExtensions.cs
@@ -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();
services.TryAddEnumerable(
ServiceDescriptor.Transient());
services.TryAddEnumerable(
@@ -270,8 +269,7 @@ namespace Microsoft.Extensions.DependencyInjection
//
// Endpoint Routing / Endpoints
//
- services.TryAddEnumerable(
- ServiceDescriptor.Singleton());
+ services.TryAddSingleton();
services.TryAddSingleton();
//
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcMarkerService.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcMarkerService.cs
similarity index 74%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcMarkerService.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcMarkerService.cs
index c2eb80ada2..337a1baca5 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcMarkerService.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcMarkerService.cs
@@ -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
{
///
/// A marker class used to determine if all the MVC services were added
/// to the before MVC is configured.
///
- public class MvcMarkerService
+ internal class MvcMarkerService
{
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DisableRequestSizeLimitAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DisableRequestSizeLimitAttribute.cs
index b92092667e..0c327e28a6 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DisableRequestSizeLimitAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DisableRequestSizeLimitAttribute.cs
@@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/FileContentResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/FileContentResult.cs
index 99385c9bd3..0c33859001 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/FileContentResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/FileContentResult.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/FileStreamResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/FileStreamResult.cs
index 486069a5ea..59f0348e78 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/FileStreamResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/FileStreamResult.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ControllerActionFilter.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ControllerActionFilter.cs
index 93e4c4774a..c169d8173c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ControllerActionFilter.cs
@@ -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
{
///
/// A filter implementation which delegates to the controller for action filter interfaces.
///
- public class ControllerActionFilter : IAsyncActionFilter, IOrderedFilter
+ internal class ControllerActionFilter : IAsyncActionFilter, IOrderedFilter
{
// Controller-filter methods run farthest from the action by default.
///
@@ -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
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerResultFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ControllerResultFilter.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerResultFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ControllerResultFilter.cs
index 3e30debccc..3352c92a9d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerResultFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ControllerResultFilter.cs
@@ -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
{
///
/// A filter implementation which delegates to the controller for result filter interfaces.
///
- public class ControllerResultFilter : IAsyncResultFilter, IOrderedFilter
+ internal class ControllerResultFilter : IAsyncResultFilter, IOrderedFilter
{
// Controller-filter methods run farthest from the result by default.
///
@@ -66,4 +65,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultFilterProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/DefaultFilterProvider.cs
similarity index 84%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultFilterProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/DefaultFilterProvider.cs
index 3e7f685494..03c7c62004 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultFilterProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/DefaultFilterProvider.cs
@@ -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;
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DisableRequestSizeLimitFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/DisableRequestSizeLimitFilter.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DisableRequestSizeLimitFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/DisableRequestSizeLimitFilter.cs
index 51595bbaa6..75818a6373 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DisableRequestSizeLimitFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/DisableRequestSizeLimitFilter.cs
@@ -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
{
///
/// A filter that sets
/// to null.
///
- public class DisableRequestSizeLimitFilter : IAuthorizationFilter, IRequestSizePolicy
+ internal class DisableRequestSizeLimitFilter : IAuthorizationFilter, IRequestSizePolicy
{
private readonly ILogger _logger;
@@ -29,8 +28,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// to null.
///
/// The .
- /// If is not enabled or is read-only,
- /// the is not applied.
+ /// If is not enabled or is read-only,
+ /// the is not applied.
public void OnAuthorization(AuthorizationFilterContext context)
{
if (context == null)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterCursor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterCursor.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterCursor.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterCursor.cs
index b297712bd0..73caf18f3f 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterCursor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterCursor.cs
@@ -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
{
///
/// A one-way cursor for filters.
@@ -25,7 +23,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// Result
///
///
- public struct FilterCursor
+ internal struct FilterCursor
{
private readonly IFilterMetadata[] _filters;
private int _index;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterCursorItem.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterCursorItem.cs
similarity index 79%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterCursorItem.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterCursorItem.cs
index a62aa1b8cc..c925d49ab2 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterCursorItem.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterCursorItem.cs
@@ -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
+ internal readonly struct FilterCursorItem
{
public FilterCursorItem(TFilter filter, TFilterAsync filterAsync)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterDescriptorOrderComparer.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterDescriptorOrderComparer.cs
similarity index 88%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterDescriptorOrderComparer.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterDescriptorOrderComparer.cs
index daadc073d4..1e43ed8280 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterDescriptorOrderComparer.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterDescriptorOrderComparer.cs
@@ -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
+ internal class FilterDescriptorOrderComparer : IComparer
{
public static FilterDescriptorOrderComparer Comparer { get; } = new FilterDescriptorOrderComparer();
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterFactory.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterFactory.cs
index 4f53acfef5..cc7563703b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterFactory.cs
@@ -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,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterFactoryResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterFactoryResult.cs
similarity index 79%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterFactoryResult.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterFactoryResult.cs
index 69e39cfea9..2f03f4d305 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterFactoryResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterFactoryResult.cs
@@ -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,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IMiddlewareFilterFeature.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/IMiddlewareFilterFeature.cs
similarity index 83%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IMiddlewareFilterFeature.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/IMiddlewareFilterFeature.cs
index 43af488b8a..cc9bcd38af 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IMiddlewareFilterFeature.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/IMiddlewareFilterFeature.cs
@@ -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
{
///
/// A feature in 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.
///
- public interface IMiddlewareFilterFeature
+ internal interface IMiddlewareFilterFeature
{
ResourceExecutingContext ResourceExecutingContext { get; }
ResourceExecutionDelegate ResourceExecutionDelegate { get; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IResponseCacheFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/IResponseCacheFilter.cs
similarity index 67%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IResponseCacheFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/IResponseCacheFilter.cs
index 5b53c254dd..9d43079624 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IResponseCacheFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/IResponseCacheFilter.cs
@@ -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
{
///
/// A filter which sets the appropriate headers related to Response caching.
///
- public interface IResponseCacheFilter : IFilterMetadata
+ internal interface IResponseCacheFilter : IFilterMetadata
{
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilter.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilter.cs
index 11ac93d5ab..d84bd188c8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilter.cs
@@ -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
{
///
/// A filter which executes a user configured middleware pipeline.
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterAttribute.cs
index 019f1551f3..be4b3f8270 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterAttribute.cs
@@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterBuilder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterBuilder.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterBuilder.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterBuilder.cs
index 6257968f90..de689d3e2c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterBuilder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterBuilder.cs
@@ -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
{
///
/// Builds a middleware pipeline after receiving the pipeline from a pipeline provider
///
- 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
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterBuilderStartupFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterBuilderStartupFilter.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterBuilderStartupFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterBuilderStartupFilter.cs
index d568da7b51..563942e57c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterBuilderStartupFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterBuilderStartupFilter.cs
@@ -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
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterConfigurationProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterConfigurationProvider.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterConfigurationProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterConfigurationProvider.cs
index ca05f4d6df..a22b126333 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterConfigurationProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterConfigurationProvider.cs
@@ -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
{
///
/// 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.
///
- public class MiddlewareFilterConfigurationProvider
+ internal class MiddlewareFilterConfigurationProvider
{
public Action CreateConfigureDelegate(Type configurationType)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterFeature.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterFeature.cs
similarity index 69%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterFeature.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterFeature.cs
index d33378d6f7..7a0da41b91 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MiddlewareFilterFeature.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/MiddlewareFilterFeature.cs
@@ -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 class MiddlewareFilterFeature : IMiddlewareFilterFeature
+ internal class MiddlewareFilterFeature : IMiddlewareFilterFeature
{
public ResourceExecutingContext ResourceExecutingContext { get; set; }
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/RequestFormLimitsFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/RequestFormLimitsFilter.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/RequestFormLimitsFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/RequestFormLimitsFilter.cs
index c60e7e2ea2..175e888d95 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/RequestFormLimitsFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/RequestFormLimitsFilter.cs
@@ -3,15 +3,14 @@
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
{
///
/// A filter that configures for the current request.
///
- public class RequestFormLimitsFilter : IAuthorizationFilter, IRequestFormLimitsPolicy
+ internal class RequestFormLimitsFilter : IAuthorizationFilter, IRequestFormLimitsPolicy
{
private readonly ILogger _logger;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/RequestSizeLimitFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/RequestSizeLimitFilter.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/RequestSizeLimitFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/RequestSizeLimitFilter.cs
index c5653f99a5..7cc2390c23 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/RequestSizeLimitFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/RequestSizeLimitFilter.cs
@@ -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
{
///
- /// A filter that sets the
+ /// A filter that sets the
/// to the specified .
///
- public class RequestSizeLimitFilter : IAuthorizationFilter, IRequestSizePolicy
+ internal class RequestSizeLimitFilter : IAuthorizationFilter, IRequestSizePolicy
{
private readonly ILogger _logger;
@@ -30,7 +29,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// Sets the to .
///
/// The .
- /// If is not enabled or is read-only,
+ /// If is not enabled or is read-only,
/// the is not applied.
public void OnAuthorization(AuthorizationFilterContext context)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResponseCacheFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ResponseCacheFilter.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResponseCacheFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ResponseCacheFilter.cs
index 55d63fc975..8996ff90de 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResponseCacheFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ResponseCacheFilter.cs
@@ -2,15 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
///
/// An which sets the appropriate headers related to response caching.
///
- public class ResponseCacheFilter : IActionFilter, IResponseCacheFilter
+ internal class ResponseCacheFilter : IActionFilter, IResponseCacheFilter
{
private readonly ResponseCacheFilterExecutor _executor;
private readonly ILogger _logger;
@@ -105,4 +104,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
{
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResponseCacheFilterExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ResponseCacheFilterExecutor.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResponseCacheFilterExecutor.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ResponseCacheFilterExecutor.cs
index 02100b838e..cdff970483 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResponseCacheFilterExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Filters/ResponseCacheFilterExecutor.cs
@@ -2,16 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using System.Diagnostics;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.ResponseCaching;
using Microsoft.Net.Http.Headers;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
- public class ResponseCacheFilterExecutor
+ internal class ResponseCacheFilterExecutor
{
private readonly CacheProfile _cacheProfile;
private int? _cacheDuration;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ForbidResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ForbidResult.cs
index b967d74c08..78e4fc1274 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ForbidResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ForbidResult.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AcceptHeaderParser.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/AcceptHeaderParser.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AcceptHeaderParser.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/AcceptHeaderParser.cs
index 289e151226..16e26b2165 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AcceptHeaderParser.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/AcceptHeaderParser.cs
@@ -5,9 +5,9 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
- public static class AcceptHeaderParser
+ internal static class AcceptHeaderParser
{
public static IList ParseAcceptHeader(IList acceptHeaders)
{
@@ -78,7 +78,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
}
// We deliberately want to ignore media types that we are not capable of parsing.
- // This is due to the fact that some browsers will send invalid media types like
+ // This is due to the fact that some browsers will send invalid media types like
// ; q=0.9 or */;q=0.2, etc.
// In this scenario, our recovery action consists of advancing the pointer to the
// next separator and moving on.
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/FormatFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/FormatFilter.cs
index e70f0130c9..5ba22953e5 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/FormatFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/FormatFilter.cs
@@ -6,8 +6,6 @@ using System.Globalization;
using System.Linq;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Formatters.Internal;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/HttpParseResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/HttpParseResult.cs
similarity index 73%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/HttpParseResult.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/HttpParseResult.cs
index 84e76f08d4..71b0f57a7e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/HttpParseResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/HttpParseResult.cs
@@ -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.Formatters.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
- public enum HttpParseResult
+ internal enum HttpParseResult
{
Parsed,
NotParsed,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/HttpTokenParsingRules.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/HttpTokenParsingRules.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/HttpTokenParsingRules.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/HttpTokenParsingRules.cs
index a93f26d916..1f478eb564 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/HttpTokenParsingRules.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/HttpTokenParsingRules.cs
@@ -4,9 +4,9 @@
using System.Diagnostics.Contracts;
using System.Text;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
- public static class HttpTokenParsingRules
+ internal static class HttpTokenParsingRules
{
private static readonly bool[] TokenChars;
private const int MaxNestedCount = 5;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IFormatFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/IFormatFilter.cs
similarity index 87%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IFormatFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/IFormatFilter.cs
index 911ca2d247..185b0cfb3c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/IFormatFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/IFormatFilter.cs
@@ -3,12 +3,12 @@
using Microsoft.AspNetCore.Mvc.Filters;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
///
/// A filter that produces the desired content type for the request.
///
- public interface IFormatFilter : IFilterMetadata
+ internal interface IFormatFilter : IFilterMetadata
{
///
/// Gets the format value for the request associated with the provided .
@@ -17,4 +17,4 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
/// A format value, or null if a format cannot be determined for the request.
string GetFormat(ActionContext context);
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/MediaType.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/MediaType.cs
index 7c557ed4cc..8e7103d588 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/MediaType.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/MediaType.cs
@@ -5,7 +5,6 @@ using System;
using System.Globalization;
using System.Text;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Formatters.Internal;
using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNetCore.Mvc.Formatters
@@ -393,9 +392,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
/// The media type to parse.
/// The position at which the parsing starts.
/// The parsed media type with its associated quality.
-#pragma warning disable PUB0001 // Pubternal type in public API
public static MediaTypeSegmentWithQuality CreateMediaTypeSegmentWithQuality(string mediaType, int start)
-#pragma warning restore PUB0001
{
var parsedMediaType = new MediaType(mediaType, start, length: null);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MediaTypeSegmentWithQuality.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/MediaTypeSegmentWithQuality.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MediaTypeSegmentWithQuality.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/MediaTypeSegmentWithQuality.cs
index 52d6281ed1..66714ae17b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MediaTypeSegmentWithQuality.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/MediaTypeSegmentWithQuality.cs
@@ -3,7 +3,7 @@
using Microsoft.Extensions.Primitives;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
///
/// A media type with its associated quality.
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResponseContentTypeHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/ResponseContentTypeHelper.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResponseContentTypeHelper.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/ResponseContentTypeHelper.cs
index 936ef92973..cc6dde7a08 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResponseContentTypeHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Formatters/ResponseContentTypeHelper.cs
@@ -4,11 +4,10 @@
using System.Diagnostics;
using System.Text;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Formatters;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
- public static class ResponseContentTypeHelper
+ internal static class ResponseContentTypeHelper
{
///
/// Gets the content type and encoding that need to be used for the response.
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionInvokerFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionInvokerFactory.cs
similarity index 87%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionInvokerFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionInvokerFactory.cs
index b654ea26a8..58b08b4b31 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionInvokerFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionInvokerFactory.cs
@@ -4,11 +4,10 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
- public class ActionInvokerFactory : IActionInvokerFactory
+ internal class ActionInvokerFactory : IActionInvokerFactory
{
private readonly IActionInvokerProvider[] _actionInvokerProviders;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionMethodExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionMethodExecutor.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionMethodExecutor.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionMethodExecutor.cs
index 806b97d1e5..3829e404de 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionMethodExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionMethodExecutor.cs
@@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
internal abstract class ActionMethodExecutor
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionResultTypeMapper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionResultTypeMapper.cs
similarity index 84%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionResultTypeMapper.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionResultTypeMapper.cs
index 82f1d02998..de9a74eeb4 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionResultTypeMapper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionResultTypeMapper.cs
@@ -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.Infrastructure;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
- public class ActionResultTypeMapper : IActionResultTypeMapper
+ internal class ActionResultTypeMapper : IActionResultTypeMapper
{
public Type GetResultDataType(Type returnType)
{
@@ -15,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
throw new ArgumentNullException(nameof(returnType));
}
- if (returnType.IsGenericType &&
+ if (returnType.IsGenericType &&
returnType.GetGenericTypeDefinition() == typeof(ActionResult<>))
{
return returnType.GetGenericArguments()[0];
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionSelector.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionSelector.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionSelector.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionSelector.cs
index 5dba1a7654..834862f568 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionSelector.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionSelector.cs
@@ -15,12 +15,12 @@ using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
///
/// A default implementation.
///
- public class ActionSelector : IActionSelector
+ internal class ActionSelector : IActionSelector
{
private static readonly IReadOnlyList EmptyActions = Array.Empty();
@@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
///
/// The set of actions that satisfy all constraints.
/// A list of the best matching actions.
- protected virtual IReadOnlyList SelectBestActions(IReadOnlyList actions)
+ private IReadOnlyList SelectBestActions(IReadOnlyList actions)
{
return actions;
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AmbiguousActionException.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/AmbiguousActionException.cs
similarity index 83%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AmbiguousActionException.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/AmbiguousActionException.cs
index 6b1a34d893..afe28c0209 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AmbiguousActionException.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/AmbiguousActionException.cs
@@ -4,13 +4,13 @@
using System;
using System.Runtime.Serialization;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
///
/// An exception which indicates multiple matches in action selection.
///
[Serializable]
- public class AmbiguousActionException : InvalidOperationException
+ internal class AmbiguousActionException : InvalidOperationException
{
public AmbiguousActionException(string message)
: base(message)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ClientErrorResultFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ClientErrorResultFilter.cs
index 1ef66b1a33..b9babd87a0 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ClientErrorResultFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ClientErrorResultFilter.cs
@@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Infrastructure
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ContentResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ContentResultExecutor.cs
index 7a1f333b3a..f73e1b72ea 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ContentResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ContentResultExecutor.cs
@@ -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 System.Text;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Infrastructure
@@ -36,14 +35,12 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
var response = context.HttpContext.Response;
- string resolvedContentType;
- Encoding resolvedContentTypeEncoding;
ResponseContentTypeHelper.ResolveContentTypeAndEncoding(
result.ContentType,
response.ContentType,
DefaultContentType,
- out resolvedContentType,
- out resolvedContentTypeEncoding);
+ out var resolvedContentType,
+ out var resolvedContentTypeEncoding);
response.ContentType = resolvedContentType;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvoker.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvoker.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvoker.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvoker.cs
index 767ed08505..099797fbe8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvoker.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvoker.cs
@@ -8,14 +8,13 @@ using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
- public class ControllerActionInvoker : ResourceInvoker, IActionInvoker
+ internal class ControllerActionInvoker : ResourceInvoker, IActionInvoker
{
private readonly ControllerActionInvokerCacheEntry _cacheEntry;
private readonly ControllerContext _controllerContext;
@@ -27,12 +26,12 @@ namespace Microsoft.AspNetCore.Mvc.Internal
internal ControllerActionInvoker(
ILogger logger,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
IActionResultTypeMapper mapper,
ControllerContext controllerContext,
ControllerActionInvokerCacheEntry cacheEntry,
IFilterMetadata[] filters)
- : base(diagnosticSource, logger, mapper, controllerContext, filters, controllerContext.ValueProviderFactories)
+ : base(diagnosticListener, logger, mapper, controllerContext, filters, controllerContext.ValueProviderFactories)
{
if (cacheEntry == null)
{
@@ -115,7 +114,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (IAsyncActionFilter)state;
var actionExecutingContext = _actionExecutingContext;
- _diagnosticSource.BeforeOnActionExecution(actionExecutingContext, filter);
+ _diagnosticListener.BeforeOnActionExecution(actionExecutingContext, filter);
_logger.BeforeExecutingMethodOnFilter(
MvcCoreLoggerExtensions.ActionFilter,
nameof(IAsyncActionFilter.OnActionExecutionAsync),
@@ -153,7 +152,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
};
}
- _diagnosticSource.AfterOnActionExecution(_actionExecutedContext, filter);
+ _diagnosticListener.AfterOnActionExecution(_actionExecutedContext, filter);
_logger.AfterExecutingMethodOnFilter(
MvcCoreLoggerExtensions.ActionFilter,
nameof(IAsyncActionFilter.OnActionExecutionAsync),
@@ -170,7 +169,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (IActionFilter)state;
var actionExecutingContext = _actionExecutingContext;
- _diagnosticSource.BeforeOnActionExecuting(actionExecutingContext, filter);
+ _diagnosticListener.BeforeOnActionExecuting(actionExecutingContext, filter);
_logger.BeforeExecutingMethodOnFilter(
MvcCoreLoggerExtensions.ActionFilter,
nameof(IActionFilter.OnActionExecuting),
@@ -178,7 +177,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
filter.OnActionExecuting(actionExecutingContext);
- _diagnosticSource.AfterOnActionExecuting(actionExecutingContext, filter);
+ _diagnosticListener.AfterOnActionExecuting(actionExecutingContext, filter);
_logger.AfterExecutingMethodOnFilter(
MvcCoreLoggerExtensions.ActionFilter,
nameof(IActionFilter.OnActionExecuting),
@@ -220,7 +219,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (IActionFilter)state;
var actionExecutedContext = _actionExecutedContext;
- _diagnosticSource.BeforeOnActionExecuted(actionExecutedContext, filter);
+ _diagnosticListener.BeforeOnActionExecuted(actionExecutedContext, filter);
_logger.BeforeExecutingMethodOnFilter(
MvcCoreLoggerExtensions.ActionFilter,
nameof(IActionFilter.OnActionExecuted),
@@ -228,7 +227,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
filter.OnActionExecuted(actionExecutedContext);
- _diagnosticSource.AfterOnActionExecuted(actionExecutedContext, filter);
+ _diagnosticListener.AfterOnActionExecuted(actionExecutedContext, filter);
_logger.AfterExecutingMethodOnFilter(
MvcCoreLoggerExtensions.ActionFilter,
nameof(IActionFilter.OnActionExecuted),
@@ -336,13 +335,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var actionMethodExecutor = _cacheEntry.ActionMethodExecutor;
var orderedArguments = PrepareArguments(arguments, objectMethodExecutor);
- var diagnosticSource = _diagnosticSource;
+ var diagnosticListener = _diagnosticListener;
var logger = _logger;
IActionResult result = null;
try
{
- diagnosticSource.BeforeActionMethod(
+ diagnosticListener.BeforeActionMethod(
controllerContext,
arguments,
controller);
@@ -363,7 +362,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
finally
{
- diagnosticSource.AfterActionMethod(
+ diagnosticListener.AfterActionMethod(
controllerContext,
arguments,
controllerContext,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvokerCache.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerCache.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvokerCache.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerCache.cs
index 0c6bd2adc1..e7628769e4 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvokerCache.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerCache.cs
@@ -12,9 +12,9 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
- public class ControllerActionInvokerCache
+ internal class ControllerActionInvokerCache
{
private readonly IActionDescriptorCollectionProvider _collectionProvider;
private readonly ParameterBinder _parameterBinder;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvokerCacheEntry.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerCacheEntry.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvokerCacheEntry.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerCacheEntry.cs
index 6b06f0e02b..17810cf866 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvokerCacheEntry.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerCacheEntry.cs
@@ -2,12 +2,13 @@
// 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;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
- public class ControllerActionInvokerCacheEntry
+ internal class ControllerActionInvokerCacheEntry
{
internal ControllerActionInvokerCacheEntry(
FilterItem[] cachedFilters,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvokerProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerProvider.cs
similarity index 88%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvokerProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerProvider.cs
index b9b135ff52..b05bd104dd 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionInvokerProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerProvider.cs
@@ -7,34 +7,33 @@ using System.Diagnostics;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Controllers;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
- public class ControllerActionInvokerProvider : IActionInvokerProvider
+ internal class ControllerActionInvokerProvider : IActionInvokerProvider
{
private readonly ControllerActionInvokerCache _controllerActionInvokerCache;
private readonly IReadOnlyList _valueProviderFactories;
private readonly int _maxModelValidationErrors;
private readonly ILogger _logger;
- private readonly DiagnosticSource _diagnosticSource;
+ private readonly DiagnosticListener _diagnosticListener;
private readonly IActionResultTypeMapper _mapper;
public ControllerActionInvokerProvider(
ControllerActionInvokerCache controllerActionInvokerCache,
IOptions optionsAccessor,
ILoggerFactory loggerFactory,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
IActionResultTypeMapper mapper)
{
_controllerActionInvokerCache = controllerActionInvokerCache;
_valueProviderFactories = optionsAccessor.Value.ValueProviderFactories.ToArray();
_maxModelValidationErrors = optionsAccessor.Value.MaxModelValidationErrors;
_logger = loggerFactory.CreateLogger();
- _diagnosticSource = diagnosticSource;
+ _diagnosticListener = diagnosticListener;
_mapper = mapper;
}
@@ -59,7 +58,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var invoker = new ControllerActionInvoker(
_logger,
- _diagnosticSource,
+ _diagnosticListener,
_mapper,
controllerContext,
cacheResult.cacheEntry,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/CopyOnWriteList.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/CopyOnWriteList.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/CopyOnWriteList.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/CopyOnWriteList.cs
index a051b69cff..44252104de 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/CopyOnWriteList.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/CopyOnWriteList.cs
@@ -4,9 +4,9 @@
using System.Collections;
using System.Collections.Generic;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
- public class CopyOnWriteList : IList
+ internal class CopyOnWriteList : IList
{
private readonly IReadOnlyList _source;
private List _copy;
@@ -16,9 +16,9 @@ namespace Microsoft.AspNetCore.Mvc.Internal
_source = source;
}
- protected IReadOnlyList Readable => _copy ?? _source;
+ private IReadOnlyList Readable => _copy ?? _source;
- protected List Writable
+ private List Writable
{
get
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/DefaultOutputFormatterSelector.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/DefaultOutputFormatterSelector.cs
index 61a62ec63f..bafe6d239d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/DefaultOutputFormatterSelector.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/DefaultOutputFormatterSelector.cs
@@ -7,8 +7,6 @@ using System.Collections.ObjectModel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Formatters;
-using Microsoft.AspNetCore.Mvc.Formatters.Internal;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileContentResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileContentResultExecutor.cs
index 6d194c52f8..e4c2aef2c2 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileContentResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileContentResultExecutor.cs
@@ -4,7 +4,6 @@
using System;
using System.IO;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileResultExecutorBase.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileResultExecutorBase.cs
index 8c2ecb98a2..bfd5546bed 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileResultExecutorBase.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileResultExecutorBase.cs
@@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Http.Headers;
using Microsoft.AspNetCore.Internal;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileStreamResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileStreamResultExecutor.cs
index 6cb300eff1..df3a6feb28 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileStreamResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/FileStreamResultExecutor.cs
@@ -3,7 +3,6 @@
using System;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/IActionSelector.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/IActionSelector.cs
index 30c9902e7d..d372b39d8b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/IActionSelector.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/IActionSelector.cs
@@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
/// The associated with the current request.
/// The set of candidates.
/// The best candidate for the current request or null.
- ///
+ ///
/// Thrown when action selection results in an ambiguity.
///
///
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ITypeActivatorCache.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ITypeActivatorCache.cs
similarity index 70%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ITypeActivatorCache.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ITypeActivatorCache.cs
index a097b29910..d5487d9425 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ITypeActivatorCache.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ITypeActivatorCache.cs
@@ -3,13 +3,13 @@
using System;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
///
- /// Caches instances produced by
- /// .
+ /// Caches instances produced by
+ /// .
///
- public interface ITypeActivatorCache
+ internal interface ITypeActivatorCache
{
///
/// Creates an instance of .
@@ -19,4 +19,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// The of the to create.
TInstance CreateInstance(IServiceProvider serviceProvider, Type optionType);
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/LocalRedirectResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/LocalRedirectResultExecutor.cs
index 9ae7a3bda5..e44d5deb97 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/LocalRedirectResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/LocalRedirectResultExecutor.cs
@@ -5,7 +5,6 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpRequestStreamReaderFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/MemoryPoolHttpRequestStreamReaderFactory.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpRequestStreamReaderFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/MemoryPoolHttpRequestStreamReaderFactory.cs
index 88f6f8428c..aff1df69a9 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpRequestStreamReaderFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/MemoryPoolHttpRequestStreamReaderFactory.cs
@@ -5,15 +5,14 @@ using System;
using System.Buffers;
using System.IO;
using System.Text;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.WebUtilities;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
///
/// An that uses pooled buffers.
///
- public class MemoryPoolHttpRequestStreamReaderFactory : IHttpRequestStreamReaderFactory
+ internal class MemoryPoolHttpRequestStreamReaderFactory : IHttpRequestStreamReaderFactory
{
///
/// The default size of created char buffers.
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpResponseStreamWriterFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/MemoryPoolHttpResponseStreamWriterFactory.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpResponseStreamWriterFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/MemoryPoolHttpResponseStreamWriterFactory.cs
index 91dd31e0c7..56978067c5 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpResponseStreamWriterFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/MemoryPoolHttpResponseStreamWriterFactory.cs
@@ -5,15 +5,14 @@ using System;
using System.Buffers;
using System.IO;
using System.Text;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.WebUtilities;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
///
/// An that uses pooled buffers.
///
- public class MemoryPoolHttpResponseStreamWriterFactory : IHttpResponseStreamWriterFactory
+ internal class MemoryPoolHttpResponseStreamWriterFactory : IHttpResponseStreamWriterFactory
{
///
/// The default size of buffers s will allocate.
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ModelStateInvalidFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ModelStateInvalidFilter.cs
index c535bb118b..2cfc4ec773 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ModelStateInvalidFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ModelStateInvalidFilter.cs
@@ -4,7 +4,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Infrastructure
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ModelStateInvalidFilterFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ModelStateInvalidFilterFactory.cs
index 3f5c81dc98..6fe848ae9e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ModelStateInvalidFilterFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ModelStateInvalidFilterFactory.cs
@@ -9,7 +9,7 @@ using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
- internal sealed class ModelStateInvalidFilterFactory : IFilterFactory, IOrderedFilter
+ internal class ModelStateInvalidFilterFactory : IFilterFactory, IOrderedFilter
{
public int Order => ModelStateInvalidFilter.FilterOrder;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/MvcCoreMvcOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/MvcCoreMvcOptionsSetup.cs
index 7b89b69ee6..81ba0b2ace 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/MvcCoreMvcOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/MvcCoreMvcOptionsSetup.cs
@@ -8,7 +8,6 @@ using System.Threading;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NonDisposableStream.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/NonDisposableStream.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NonDisposableStream.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/NonDisposableStream.cs
index 9cc9a46ea4..a5260ae63b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NonDisposableStream.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/NonDisposableStream.cs
@@ -6,14 +6,14 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
///
/// Stream that delegates to an inner stream.
/// This Stream is present so that the inner stream is not closed
/// even when Close() or Dispose() is called.
///
- public class NonDisposableStream : Stream
+ internal class NonDisposableStream : Stream
{
private readonly Stream _innerStream;
@@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
///
/// The inner stream this object delegates to.
///
- protected Stream InnerStream => _innerStream;
+ private Stream InnerStream => _innerStream;
///
public override bool CanRead => _innerStream.CanRead;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ObjectResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ObjectResultExecutor.cs
index d48d213532..6c5179d222 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ObjectResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ObjectResultExecutor.cs
@@ -9,7 +9,6 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Formatters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Infrastructure
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ParameterDefaultValues.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ParameterDefaultValues.cs
similarity index 94%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ParameterDefaultValues.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ParameterDefaultValues.cs
index 8263da1650..b7259fc9b7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ParameterDefaultValues.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ParameterDefaultValues.cs
@@ -6,9 +6,9 @@ using System.ComponentModel;
using System.Reflection;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
- public static class ParameterDefaultValues
+ internal static class ParameterDefaultValues
{
public static object[] GetParameterDefaultValues(MethodInfo methodInfo)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/PhysicalFileResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/PhysicalFileResultExecutor.cs
index fa4757212d..1702e2b340 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/PhysicalFileResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/PhysicalFileResultExecutor.cs
@@ -7,7 +7,6 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectResultExecutor.cs
index e8f80b17da..8a480cc237 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectResultExecutor.cs
@@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToActionResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToActionResultExecutor.cs
index b1b131274b..187968c1af 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToActionResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToActionResultExecutor.cs
@@ -5,7 +5,6 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToPageResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToPageResultExecutor.cs
index ee1c060e87..3e87985983 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToPageResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToPageResultExecutor.cs
@@ -5,7 +5,6 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToRouteResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToRouteResultExecutor.cs
index 04e15feacf..268ddd37cc 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToRouteResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/RedirectToRouteResultExecutor.cs
@@ -5,7 +5,6 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResourceInvoker.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ResourceInvoker.cs
similarity index 94%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResourceInvoker.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ResourceInvoker.cs
index 2b73da1c0f..ff969d90b0 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ResourceInvoker.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ResourceInvoker.cs
@@ -8,16 +8,15 @@ using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
- public abstract class ResourceInvoker
+ internal abstract class ResourceInvoker
{
- protected readonly DiagnosticSource _diagnosticSource;
+ protected readonly DiagnosticListener _diagnosticListener;
protected readonly ILogger _logger;
protected readonly IActionResultTypeMapper _mapper;
protected readonly ActionContext _actionContext;
@@ -38,14 +37,14 @@ namespace Microsoft.AspNetCore.Mvc.Internal
protected object _instance;
public ResourceInvoker(
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
ILogger logger,
IActionResultTypeMapper mapper,
ActionContext actionContext,
IFilterMetadata[] filters,
IList valueProviderFactories)
{
- _diagnosticSource = diagnosticSource ?? throw new ArgumentNullException(nameof(diagnosticSource));
+ _diagnosticListener = diagnosticListener ?? throw new ArgumentNullException(nameof(diagnosticListener));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
_actionContext = actionContext ?? throw new ArgumentNullException(nameof(actionContext));
@@ -59,7 +58,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
{
try
{
- _diagnosticSource.BeforeAction(
+ _diagnosticListener.BeforeAction(
_actionContext.ActionDescriptor,
_actionContext.HttpContext,
_actionContext.RouteData);
@@ -89,7 +88,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
finally
{
- _diagnosticSource.AfterAction(
+ _diagnosticListener.AfterAction(
_actionContext.ActionDescriptor,
_actionContext.HttpContext,
_actionContext.RouteData);
@@ -130,7 +129,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
{
var actionContext = _actionContext;
- _diagnosticSource.BeforeActionResult(actionContext, result);
+ _diagnosticListener.BeforeActionResult(actionContext, result);
_logger.BeforeExecutingActionResult(result);
try
@@ -139,7 +138,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
finally
{
- _diagnosticSource.AfterActionResult(actionContext, result);
+ _diagnosticListener.AfterActionResult(actionContext, result);
_logger.AfterExecutingActionResult(result);
}
}
@@ -196,7 +195,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (IAsyncAuthorizationFilter)state;
var authorizationContext = _authorizationContext;
- _diagnosticSource.BeforeOnAuthorizationAsync(authorizationContext, filter);
+ _diagnosticListener.BeforeOnAuthorizationAsync(authorizationContext, filter);
_logger.BeforeExecutingMethodOnFilter(
FilterTypeConstants.AuthorizationFilter,
nameof(IAsyncAuthorizationFilter.OnAuthorizationAsync),
@@ -220,7 +219,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (IAsyncAuthorizationFilter)state;
var authorizationContext = _authorizationContext;
- _diagnosticSource.AfterOnAuthorizationAsync(authorizationContext, filter);
+ _diagnosticListener.AfterOnAuthorizationAsync(authorizationContext, filter);
_logger.AfterExecutingMethodOnFilter(
FilterTypeConstants.AuthorizationFilter,
nameof(IAsyncAuthorizationFilter.OnAuthorizationAsync),
@@ -242,7 +241,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (IAuthorizationFilter)state;
var authorizationContext = _authorizationContext;
- _diagnosticSource.BeforeOnAuthorization(authorizationContext, filter);
+ _diagnosticListener.BeforeOnAuthorization(authorizationContext, filter);
_logger.BeforeExecutingMethodOnFilter(
FilterTypeConstants.AuthorizationFilter,
nameof(IAuthorizationFilter.OnAuthorization),
@@ -250,7 +249,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
filter.OnAuthorization(authorizationContext);
- _diagnosticSource.AfterOnAuthorization(authorizationContext, filter);
+ _diagnosticListener.AfterOnAuthorization(authorizationContext, filter);
_logger.AfterExecutingMethodOnFilter(
FilterTypeConstants.AuthorizationFilter,
nameof(IAuthorizationFilter.OnAuthorization),
@@ -333,7 +332,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (IAsyncResourceFilter)state;
var resourceExecutingContext = _resourceExecutingContext;
- _diagnosticSource.BeforeOnResourceExecution(resourceExecutingContext, filter);
+ _diagnosticListener.BeforeOnResourceExecution(resourceExecutingContext, filter);
_logger.BeforeExecutingMethodOnFilter(
FilterTypeConstants.ResourceFilter,
nameof(IAsyncResourceFilter.OnResourceExecutionAsync),
@@ -364,7 +363,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
Result = _resourceExecutingContext.Result,
};
- _diagnosticSource.AfterOnResourceExecution(_resourceExecutedContext, filter);
+ _diagnosticListener.AfterOnResourceExecution(_resourceExecutedContext, filter);
_logger.AfterExecutingMethodOnFilter(
FilterTypeConstants.ResourceFilter,
nameof(IAsyncResourceFilter.OnResourceExecutionAsync),
@@ -388,7 +387,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (IResourceFilter)state;
var resourceExecutingContext = _resourceExecutingContext;
- _diagnosticSource.BeforeOnResourceExecuting(resourceExecutingContext, filter);
+ _diagnosticListener.BeforeOnResourceExecuting(resourceExecutingContext, filter);
_logger.BeforeExecutingMethodOnFilter(
FilterTypeConstants.ResourceFilter,
nameof(IResourceFilter.OnResourceExecuting),
@@ -396,7 +395,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
filter.OnResourceExecuting(resourceExecutingContext);
- _diagnosticSource.AfterOnResourceExecuting(resourceExecutingContext, filter);
+ _diagnosticListener.AfterOnResourceExecuting(resourceExecutingContext, filter);
_logger.AfterExecutingMethodOnFilter(
FilterTypeConstants.ResourceFilter,
nameof(IResourceFilter.OnResourceExecuting),
@@ -432,7 +431,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (IResourceFilter)state;
var resourceExecutedContext = _resourceExecutedContext;
- _diagnosticSource.BeforeOnResourceExecuted(resourceExecutedContext, filter);
+ _diagnosticListener.BeforeOnResourceExecuted(resourceExecutedContext, filter);
_logger.BeforeExecutingMethodOnFilter(
FilterTypeConstants.ResourceFilter,
nameof(IResourceFilter.OnResourceExecuted),
@@ -440,7 +439,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
filter.OnResourceExecuted(resourceExecutedContext);
- _diagnosticSource.AfterOnResourceExecuted(resourceExecutedContext, filter);
+ _diagnosticListener.AfterOnResourceExecuted(resourceExecutedContext, filter);
_logger.AfterExecutingMethodOnFilter(
FilterTypeConstants.ResourceFilter,
nameof(IResourceFilter.OnResourceExecuted),
@@ -528,7 +527,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
// we'll call the filter. Otherwise there's nothing to do.
if (exceptionContext?.Exception != null && !exceptionContext.ExceptionHandled)
{
- _diagnosticSource.BeforeOnExceptionAsync(exceptionContext, filter);
+ _diagnosticListener.BeforeOnExceptionAsync(exceptionContext, filter);
_logger.BeforeExecutingMethodOnFilter(
FilterTypeConstants.ExceptionFilter,
nameof(IAsyncExceptionFilter.OnExceptionAsync),
@@ -555,7 +554,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (IAsyncExceptionFilter)state;
var exceptionContext = _exceptionContext;
- _diagnosticSource.AfterOnExceptionAsync(exceptionContext, filter);
+ _diagnosticListener.AfterOnExceptionAsync(exceptionContext, filter);
_logger.AfterExecutingMethodOnFilter(
FilterTypeConstants.ExceptionFilter,
nameof(IAsyncExceptionFilter.OnExceptionAsync),
@@ -595,7 +594,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
// we'll call the filter. Otherwise there's nothing to do.
if (exceptionContext?.Exception != null && !exceptionContext.ExceptionHandled)
{
- _diagnosticSource.BeforeOnException(exceptionContext, filter);
+ _diagnosticListener.BeforeOnException(exceptionContext, filter);
_logger.BeforeExecutingMethodOnFilter(
FilterTypeConstants.ExceptionFilter,
nameof(IExceptionFilter.OnException),
@@ -603,7 +602,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
filter.OnException(exceptionContext);
- _diagnosticSource.AfterOnException(exceptionContext, filter);
+ _diagnosticListener.AfterOnException(exceptionContext, filter);
_logger.AfterExecutingMethodOnFilter(
FilterTypeConstants.ExceptionFilter,
nameof(IExceptionFilter.OnException),
@@ -632,7 +631,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
// either by setting ExceptionHandled, or nulling out the Exception or setting a result
// on the ExceptionContext.
//
- // We need to execute the result (if any) and then exit gracefully which unwinding Resource
+ // We need to execute the result (if any) and then exit gracefully which unwinding Resource
// filters.
Debug.Assert(state != null);
@@ -905,7 +904,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (TFilterAsync)state;
var resultExecutingContext = _resultExecutingContext;
- _diagnosticSource.BeforeOnResultExecution(resultExecutingContext, filter);
+ _diagnosticListener.BeforeOnResultExecution(resultExecutingContext, filter);
_logger.BeforeExecutingMethodOnFilter(
resultFilterKind,
nameof(IAsyncResultFilter.OnResultExecutionAsync),
@@ -945,7 +944,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
};
}
- _diagnosticSource.AfterOnResultExecution(_resultExecutedContext, filter);
+ _diagnosticListener.AfterOnResultExecution(_resultExecutedContext, filter);
_logger.AfterExecutingMethodOnFilter(
resultFilterKind,
nameof(IAsyncResultFilter.OnResultExecutionAsync),
@@ -962,7 +961,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (TFilter)state;
var resultExecutingContext = _resultExecutingContext;
- _diagnosticSource.BeforeOnResultExecuting(resultExecutingContext, filter);
+ _diagnosticListener.BeforeOnResultExecuting(resultExecutingContext, filter);
_logger.BeforeExecutingMethodOnFilter(
resultFilterKind,
nameof(IResultFilter.OnResultExecuting),
@@ -970,7 +969,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
filter.OnResultExecuting(resultExecutingContext);
- _diagnosticSource.AfterOnResultExecuting(resultExecutingContext, filter);
+ _diagnosticListener.AfterOnResultExecuting(resultExecutingContext, filter);
_logger.AfterExecutingMethodOnFilter(
resultFilterKind,
nameof(IResultFilter.OnResultExecuting),
@@ -1012,7 +1011,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = (TFilter)state;
var resultExecutedContext = _resultExecutedContext;
- _diagnosticSource.BeforeOnResultExecuted(resultExecutedContext, filter);
+ _diagnosticListener.BeforeOnResultExecuted(resultExecutedContext, filter);
_logger.BeforeExecutingMethodOnFilter(
resultFilterKind,
nameof(IResultFilter.OnResultExecuted),
@@ -1020,7 +1019,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
filter.OnResultExecuted(resultExecutedContext);
- _diagnosticSource.AfterOnResultExecuted(resultExecutedContext, filter);
+ _diagnosticListener.AfterOnResultExecuted(resultExecutedContext, filter);
_logger.AfterExecutingMethodOnFilter(
resultFilterKind,
nameof(IResultFilter.OnResultExecuted),
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/TypeActivatorCache.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/TypeActivatorCache.cs
similarity index 86%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/TypeActivatorCache.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/TypeActivatorCache.cs
index 36c0d947d3..f94f491a81 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/TypeActivatorCache.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/TypeActivatorCache.cs
@@ -5,13 +5,13 @@ using System;
using System.Collections.Concurrent;
using Microsoft.Extensions.DependencyInjection;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
///
- /// Caches instances produced by
- /// .
+ /// Caches instances produced by
+ /// .
///
- public class TypeActivatorCache : ITypeActivatorCache
+ internal class TypeActivatorCache : ITypeActivatorCache
{
private readonly Func _createFactory =
(type) => ActivatorUtilities.CreateFactory(type, Type.EmptyTypes);
@@ -37,4 +37,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
return (TInstance)createFactory(serviceProvider, arguments: null);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/VirtualFileResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/VirtualFileResultExecutor.cs
index d9702a572f..97a0584b9f 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/VirtualFileResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/VirtualFileResultExecutor.cs
@@ -8,7 +8,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionAttributeRouteModel.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionAttributeRouteModel.cs
deleted file mode 100644
index 45fe4b2578..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionAttributeRouteModel.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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.ApplicationModels;
-
-namespace Microsoft.AspNetCore.Mvc.Internal
-{
- public static class ActionAttributeRouteModel
- {
- 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);
- }
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionDescriptorBuilder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionDescriptorBuilder.cs
deleted file mode 100644
index 21ec3aee6b..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ControllerActionDescriptorBuilder.cs
+++ /dev/null
@@ -1,637 +0,0 @@
-// 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.Abstractions;
-using Microsoft.AspNetCore.Mvc.ActionConstraints;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
-using Microsoft.AspNetCore.Mvc.Controllers;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Routing;
-using Microsoft.AspNetCore.Routing;
-using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;
-
-namespace Microsoft.AspNetCore.Mvc.Internal
-{
- ///
- /// Creates instances of from .
- ///
- public static class ControllerActionDescriptorBuilder
- {
- // This is the default order for attribute routes whose order calculated from
- // the controller model is null.
- private const int DefaultAttributeRouteOrder = 0;
-
- ///
- /// Creates instances of from .
- ///
- /// The .
- /// The list of .
- public static IList Build(ApplicationModel application)
- {
- var actions = new List();
-
- var methodInfoMap = new MethodToActionMap();
-
- var routeTemplateErrors = new List();
- var attributeRoutingConfigurationErrors = new Dictionary();
-
- foreach (var controller in application.Controllers)
- {
- // Only add properties which are explicitly marked to bind.
- // The attribute check is required for ModelBinder attribute.
- var controllerPropertyDescriptors = controller.ControllerProperties
- .Where(p => p.BindingInfo != null)
- .Select(CreateParameterDescriptor)
- .ToList();
- foreach (var action in controller.Actions)
- {
- // Controllers with multiple [Route] attributes (or user defined implementation of
- // IRouteTemplateProvider) will generate one action descriptor per IRouteTemplateProvider
- // instance.
- // Actions with multiple [Http*] attributes or other (IRouteTemplateProvider implementations
- // have already been identified as different actions during action discovery.
- var actionDescriptors = CreateActionDescriptors(application, controller, action);
-
- foreach (var actionDescriptor in actionDescriptors)
- {
- actionDescriptor.ControllerName = controller.ControllerName;
- actionDescriptor.ControllerTypeInfo = controller.ControllerType;
-
- AddApiExplorerInfo(actionDescriptor, application, controller, action);
- AddRouteValues(actionDescriptor, controller, action);
- AddProperties(actionDescriptor, action, controller, application);
-
- actionDescriptor.BoundProperties = controllerPropertyDescriptors;
-
- if (IsAttributeRoutedAction(actionDescriptor))
- {
- // Replaces tokens like [controller]/[action] in the route template with the actual values
- // for this action.
- ReplaceAttributeRouteTokens(actionDescriptor, routeTemplateErrors);
- }
- }
-
- methodInfoMap.AddToMethodInfo(action, actionDescriptors);
- actions.AddRange(actionDescriptors);
- }
- }
-
- var actionsByRouteName = new Dictionary>(
- StringComparer.OrdinalIgnoreCase);
-
- // Keeps track of all the methods that we've validated to avoid visiting each action group
- // more than once.
- var validatedMethods = new HashSet();
-
- foreach (var actionDescriptor in actions)
- {
- if (!validatedMethods.Contains(actionDescriptor.MethodInfo))
- {
- ValidateActionGroupConfiguration(
- methodInfoMap,
- actionDescriptor,
- attributeRoutingConfigurationErrors);
-
- validatedMethods.Add(actionDescriptor.MethodInfo);
- }
-
- var attributeRouteInfo = actionDescriptor.AttributeRouteInfo;
- if (attributeRouteInfo?.Name != null)
- {
- // Build a map of attribute route name to action descriptors to ensure that all
- // attribute routes with a given name have the same template.
- AddActionToNamedGroup(actionsByRouteName, attributeRouteInfo.Name, actionDescriptor);
- }
- }
-
- 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 actions;
- }
-
- private static IList CreateActionDescriptors(
- ApplicationModel application,
- ControllerModel controller,
- ActionModel action)
- {
- var defaultControllerConstraints = Enumerable.Empty();
- var defaultControllerEndpointMetadata = Enumerable.Empty();
- if (controller.Selectors.Count > 0)
- {
- defaultControllerConstraints = controller.Selectors[0].ActionConstraints
- .Where(constraint => !(constraint is IRouteTemplateProvider));
- defaultControllerEndpointMetadata = controller.Selectors[0].EndpointMetadata;
- }
-
- var actionDescriptors = new List();
- foreach (var result in ActionAttributeRouteModel.GetAttributeRoutes(action))
- {
- var actionSelector = result.actionSelector;
- var controllerSelector = result.controllerSelector;
-
- var actionDescriptor = CreateActionDescriptor(action, result.route);
- actionDescriptors.Add(actionDescriptor);
- AddActionFilters(actionDescriptor, action.Filters, controller.Filters, application.Filters);
-
- var controllerConstraints = defaultControllerConstraints;
-
- if (controllerSelector?.AttributeRouteModel?.Attribute is IActionConstraintMetadata actionConstraint)
- {
- // Use the attribute route as a constraint if the controller selector participated in creating this route.
- controllerConstraints = controllerConstraints.Concat(new[] { actionConstraint });
- }
-
- AddActionConstraints(actionDescriptor, actionSelector, controllerConstraints);
-
- // Metadata for the action is more significant so order it before the controller metadata
- var actionDescriptorMetadata = actionSelector.EndpointMetadata.ToList();
- actionDescriptorMetadata.AddRange(defaultControllerEndpointMetadata);
-
- actionDescriptor.EndpointMetadata = actionDescriptorMetadata;
- }
-
- return actionDescriptors;
- }
-
- private static ControllerActionDescriptor CreateActionDescriptor(ActionModel action, AttributeRouteModel routeModel)
- {
- var parameterDescriptors = new List();
- foreach (var parameter in action.Parameters)
- {
- var parameterDescriptor = CreateParameterDescriptor(parameter);
- parameterDescriptors.Add(parameterDescriptor);
- }
-
- var actionDescriptor = new ControllerActionDescriptor
- {
- ActionName = action.ActionName,
- MethodInfo = action.ActionMethod,
- Parameters = parameterDescriptors,
- AttributeRouteInfo = CreateAttributeRouteInfo(routeModel),
- };
-
- return actionDescriptor;
- }
-
- 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 && !IsAttributeRoutedAction(actionDescriptor))
- {
- // ApiExplorer is only supported on attribute routed actions.
- throw new InvalidOperationException(Resources.FormatApiExplorer_UnsupportedAction(
- actionDescriptor.DisplayName));
- }
- else if (isVisibleSetOnApplication && !IsAttributeRoutedAction(actionDescriptor))
- {
- // This is the case where we're going to be lenient, just ignore it.
- }
- else if (isVisible)
- {
- Debug.Assert(IsAttributeRoutedAction(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 actionFilters,
- IEnumerable controllerFilters,
- IEnumerable 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 AttributeRouteInfo CreateAttributeRouteInfo(AttributeRouteModel routeModel)
- {
- if (routeModel == null)
- {
- return null;
- }
-
- return new AttributeRouteInfo
- {
- Template = routeModel.Template,
- Order = routeModel.Order ?? DefaultAttributeRouteOrder,
- Name = routeModel.Name,
- SuppressLinkGeneration = routeModel.SuppressLinkGeneration,
- SuppressPathMatching = routeModel.SuppressPathMatching,
- };
- }
-
- private static void AddActionConstraints(
- ControllerActionDescriptor actionDescriptor,
- SelectorModel selectorModel,
- IEnumerable controllerConstraints)
- {
- var constraints = new List();
-
- if (selectorModel.ActionConstraints != null)
- {
- constraints.AddRange(selectorModel.ActionConstraints);
- }
-
- if (controllerConstraints != null)
- {
- constraints.AddRange(controllerConstraints);
- }
-
- if (constraints.Count > 0)
- {
- actionDescriptor.ActionConstraints = constraints;
- }
- }
-
- 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 void ReplaceAttributeRouteTokens(
- ControllerActionDescriptor actionDescriptor,
- IList routeTemplateErrors)
- {
- try
- {
- actionDescriptor.Properties.TryGetValue(typeof(IOutboundParameterTransformer), out var transformer);
- var routeTokenTransformer = transformer as IOutboundParameterTransformer;
-
- actionDescriptor.AttributeRouteInfo.Template = AttributeRouteModel.ReplaceTokens(
- actionDescriptor.AttributeRouteInfo.Template,
- actionDescriptor.RouteValues,
- routeTokenTransformer);
-
- if (actionDescriptor.AttributeRouteInfo.Name != null)
- {
- actionDescriptor.AttributeRouteInfo.Name = AttributeRouteModel.ReplaceTokens(
- actionDescriptor.AttributeRouteInfo.Name,
- actionDescriptor.RouteValues,
- routeTokenTransformer);
- }
- }
- catch (InvalidOperationException ex)
- {
- // Routing will throw an InvalidOperationException here if we can't parse/replace tokens
- // in the template.
- var message = Resources.FormatAttributeRoute_IndividualErrorMessage(
- actionDescriptor.DisplayName,
- Environment.NewLine,
- ex.Message);
-
- routeTemplateErrors.Add(message);
- }
- }
-
- private static void AddActionToNamedGroup(
- IDictionary> actionsByRouteName,
- string routeName,
- ControllerActionDescriptor actionDescriptor)
- {
- if (actionsByRouteName.TryGetValue(routeName, out var namedActionGroup))
- {
- namedActionGroup.Add(actionDescriptor);
- }
- else
- {
- namedActionGroup = new List();
- namedActionGroup.Add(actionDescriptor);
- actionsByRouteName.Add(routeName, namedActionGroup);
- }
- }
-
- private static bool IsAttributeRoutedAction(ControllerActionDescriptor actionDescriptor)
- {
- return actionDescriptor.AttributeRouteInfo?.Template != null;
- }
-
- private static IList AddErrorNumbers(
- IEnumerable namedRoutedErrors)
- {
- return namedRoutedErrors
- .Select((error, i) =>
- Resources.FormatAttributeRoute_AggregateErrorMessage_ErrorNumber(
- i + 1,
- Environment.NewLine,
- error))
- .ToList();
- }
-
- private static IList ValidateNamedAttributeRoutedActions(
- IDictionary> actionsGroupedByRouteName)
- {
- var namedRouteErrors = new List();
-
- foreach (var kvp in actionsGroupedByRouteName)
- {
- // 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 firstActionDescriptor = kvp.Value[0];
- var firstTemplate = firstActionDescriptor.AttributeRouteInfo.Template;
-
- for (var i = 1; i < kvp.Value.Count; i++)
- {
- var otherActionDescriptor = kvp.Value[i];
- var otherActionTemplate = otherActionDescriptor.AttributeRouteInfo.Template;
-
- if (!firstTemplate.Equals(otherActionTemplate, StringComparison.OrdinalIgnoreCase))
- {
- var descriptions = kvp.Value.Select(ad =>
- Resources.FormatAttributeRoute_DuplicateNames_Item(
- ad.DisplayName,
- ad.AttributeRouteInfo.Template));
-
- var errorDescription = string.Join(Environment.NewLine, descriptions);
- var message = Resources.FormatAttributeRoute_DuplicateNames(
- kvp.Key,
- Environment.NewLine,
- errorDescription);
-
- namedRouteErrors.Add(message);
- break;
- }
- }
- }
-
- return namedRouteErrors;
- }
-
- private static void ValidateActionGroupConfiguration(
- IDictionary>> methodMap,
- ControllerActionDescriptor actionDescriptor,
- IDictionary routingConfigurationErrors)
- {
- var hasAttributeRoutedActions = false;
- var hasConventionallyRoutedActions = false;
-
- var actionsForMethod = methodMap[actionDescriptor.MethodInfo];
- foreach (var reflectedAction in actionsForMethod)
- {
- foreach (var action in reflectedAction.Value)
- {
- if (IsAttributeRoutedAction(action))
- {
- hasAttributeRoutedActions = true;
- }
- else
- {
- hasConventionallyRoutedActions = 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.
- //
- // This for example:
- //
- // [HttpGet]
- // [HttpPost("Foo")]
- // public void Foo() { }
- if (hasAttributeRoutedActions && hasConventionallyRoutedActions)
- {
- var message = CreateMixedRoutedActionDescriptorsErrorMessage(
- actionDescriptor,
- actionsForMethod);
-
- routingConfigurationErrors.Add(actionDescriptor.MethodInfo, message);
- }
- }
-
- private static string CreateMixedRoutedActionDescriptorsErrorMessage(
- ControllerActionDescriptor actionDescriptor,
- IDictionary> actionsForMethod)
- {
- // Text to show as the attribute route template for conventionally routed actions.
- var nullTemplate = Resources.AttributeRoute_NullTemplateRepresentation;
-
- var actionDescriptions = new List();
- foreach (var action in actionsForMethod.SelectMany(kvp => kvp.Value))
- {
- var routeTemplate = action.AttributeRouteInfo?.Template ?? nullTemplate;
-
- var verbs = action.ActionConstraints?.OfType()
- .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.
- return
- Resources.FormatAttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod(
- actionDescriptor.DisplayName,
- Environment.NewLine,
- string.Join(Environment.NewLine, actionDescriptions));
- }
-
- private static string CreateAttributeRoutingAggregateErrorMessage(
- IEnumerable individualErrors)
- {
- var errorMessages = AddErrorNumbers(individualErrors);
-
- var message = Resources.FormatAttributeRoute_AggregateErrorMessage(
- Environment.NewLine,
- string.Join(Environment.NewLine + Environment.NewLine, errorMessages));
- return message;
- }
-
- // We need to build a map of methods to reflected actions and reflected actions to
- // action descriptors so that we can validate later that no method produced attribute
- // and non attributed actions at the same time, and that no method that produced attribute
- // routed actions has no attributes that implement IActionHttpMethodProvider and do not
- // implement IRouteTemplateProvider. For example:
- //
- // public class ProductsController
- // {
- // [HttpGet("Products")]
- // [HttpPost]
- // public ActionResult Items(){ ... }
- //
- // [HttpGet("Products")]
- // [CustomHttpMethods("POST, PUT")]
- // public ActionResult List(){ ... }
- // }
- private class MethodToActionMap :
- Dictionary>>
- {
- public void AddToMethodInfo(
- ActionModel action,
- IList actionDescriptors)
- {
- if (TryGetValue(action.ActionMethod, out var actionsForMethod))
- {
- actionsForMethod.Add(action, actionDescriptors);
- }
- else
- {
- var reflectedActionMap =
- new Dictionary>();
- reflectedActionMap.Add(action, actionDescriptors);
- Add(action.ActionMethod, reflectedActionMap);
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreDiagnosticSourceExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreDiagnosticSourceExtensions.cs
deleted file mode 100644
index d5bee24ba7..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreDiagnosticSourceExtensions.cs
+++ /dev/null
@@ -1,712 +0,0 @@
-// 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.Diagnostics;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Routing;
-
-namespace Microsoft.AspNetCore.Mvc.Internal
-{
- // We're doing a lot of asserts here because these methods are really tedious to test and
- // highly dependent on the details of the invoker's state machine. Basically if we wrote the
- // obvious unit tests that would generate a lot of boilerplate and wouldn't cover the hard parts.
- public static class MvcCoreDiagnosticSourceExtensions
- {
- public static void BeforeAction(
- this DiagnosticSource diagnosticSource,
- ActionDescriptor actionDescriptor,
- HttpContext httpContext,
- RouteData routeData)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionDescriptor != null);
- Debug.Assert(httpContext != null);
- Debug.Assert(routeData != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeAction"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeAction",
- new { actionDescriptor, httpContext = httpContext, routeData = routeData });
- }
- }
-
- public static void AfterAction(
- this DiagnosticSource diagnosticSource,
- ActionDescriptor actionDescriptor,
- HttpContext httpContext,
- RouteData routeData)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionDescriptor != null);
- Debug.Assert(httpContext != null);
- Debug.Assert(routeData != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterAction"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterAction",
- new { actionDescriptor, httpContext = httpContext, routeData = routeData });
- }
- }
-
- public static void BeforeOnAuthorizationAsync(
- this DiagnosticSource diagnosticSource,
- AuthorizationFilterContext authorizationContext,
- IAsyncAuthorizationFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(authorizationContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnAuthorization",
- new
- {
- actionDescriptor = authorizationContext.ActionDescriptor,
- authorizationContext = authorizationContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnAuthorizationAsync(
- this DiagnosticSource diagnosticSource,
- AuthorizationFilterContext authorizationContext,
- IAsyncAuthorizationFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(authorizationContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnAuthorization",
- new
- {
- actionDescriptor = authorizationContext.ActionDescriptor,
- authorizationContext = authorizationContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnAuthorization(
- this DiagnosticSource diagnosticSource,
- AuthorizationFilterContext authorizationContext,
- IAuthorizationFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(authorizationContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnAuthorization",
- new
- {
- actionDescriptor = authorizationContext.ActionDescriptor,
- authorizationContext = authorizationContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnAuthorization(
- this DiagnosticSource diagnosticSource,
- AuthorizationFilterContext authorizationContext,
- IAuthorizationFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(authorizationContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnAuthorization",
- new
- {
- actionDescriptor = authorizationContext.ActionDescriptor,
- authorizationContext = authorizationContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnResourceExecution(
- this DiagnosticSource diagnosticSource,
- ResourceExecutingContext resourceExecutingContext,
- IAsyncResourceFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resourceExecutingContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution",
- new
- {
- actionDescriptor = resourceExecutingContext.ActionDescriptor,
- resourceExecutingContext = resourceExecutingContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnResourceExecution(
- this DiagnosticSource diagnosticSource,
- ResourceExecutedContext resourceExecutedContext,
- IAsyncResourceFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resourceExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecution"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResourceExecution",
- new
- {
- actionDescriptor = resourceExecutedContext.ActionDescriptor,
- resourceExecutedContext = resourceExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnResourceExecuting(
- this DiagnosticSource diagnosticSource,
- ResourceExecutingContext resourceExecutingContext,
- IResourceFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resourceExecutingContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting",
- new
- {
- actionDescriptor = resourceExecutingContext.ActionDescriptor,
- resourceExecutingContext = resourceExecutingContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnResourceExecuting(
- this DiagnosticSource diagnosticSource,
- ResourceExecutingContext resourceExecutingContext,
- IResourceFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resourceExecutingContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting",
- new
- {
- actionDescriptor = resourceExecutingContext.ActionDescriptor,
- resourceExecutingContext = resourceExecutingContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnResourceExecuted(
- this DiagnosticSource diagnosticSource,
- ResourceExecutedContext resourceExecutedContext,
- IResourceFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resourceExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted",
- new
- {
- actionDescriptor = resourceExecutedContext.ActionDescriptor,
- resourceExecutedContext = resourceExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnResourceExecuted(
- this DiagnosticSource diagnosticSource,
- ResourceExecutedContext resourceExecutedContext,
- IResourceFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resourceExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted",
- new
- {
- actionDescriptor = resourceExecutedContext.ActionDescriptor,
- resourceExecutedContext = resourceExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnExceptionAsync(
- this DiagnosticSource diagnosticSource,
- ExceptionContext exceptionContext,
- IAsyncExceptionFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(exceptionContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnException",
- new
- {
- actionDescriptor = exceptionContext.ActionDescriptor,
- exceptionContext = exceptionContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnExceptionAsync(
- this DiagnosticSource diagnosticSource,
- ExceptionContext exceptionContext,
- IAsyncExceptionFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(exceptionContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnException",
- new
- {
- actionDescriptor = exceptionContext.ActionDescriptor,
- exceptionContext = exceptionContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnException(
- this DiagnosticSource diagnosticSource,
- ExceptionContext exceptionContext,
- IExceptionFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(exceptionContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnException",
- new
- {
- actionDescriptor = exceptionContext.ActionDescriptor,
- exceptionContext = exceptionContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnException(
- this DiagnosticSource diagnosticSource,
- ExceptionContext exceptionContext,
- IExceptionFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(exceptionContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnException",
- new
- {
- actionDescriptor = exceptionContext.ActionDescriptor,
- exceptionContext = exceptionContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnActionExecution(
- this DiagnosticSource diagnosticSource,
- ActionExecutingContext actionExecutingContext,
- IAsyncActionFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionExecutingContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecution"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnActionExecution",
- new
- {
- actionDescriptor = actionExecutingContext.ActionDescriptor,
- actionExecutingContext = actionExecutingContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnActionExecution(
- this DiagnosticSource diagnosticSource,
- ActionExecutedContext actionExecutedContext,
- IAsyncActionFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecution"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnActionExecution",
- new
- {
- actionDescriptor = actionExecutedContext.ActionDescriptor,
- actionExecutedContext = actionExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnActionExecuting(
- this DiagnosticSource diagnosticSource,
- ActionExecutingContext actionExecutingContext,
- IActionFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionExecutingContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting",
- new
- {
- actionDescriptor = actionExecutingContext.ActionDescriptor,
- actionExecutingContext = actionExecutingContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnActionExecuting(
- this DiagnosticSource diagnosticSource,
- ActionExecutingContext actionExecutingContext,
- IActionFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionExecutingContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuting"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnActionExecuting",
- new
- {
- actionDescriptor = actionExecutingContext.ActionDescriptor,
- actionExecutingContext = actionExecutingContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnActionExecuted(
- this DiagnosticSource diagnosticSource,
- ActionExecutedContext actionExecutedContext,
- IActionFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted",
- new
- {
- actionDescriptor = actionExecutedContext.ActionDescriptor,
- actionExecutedContext = actionExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnActionExecuted(
- this DiagnosticSource diagnosticSource,
- ActionExecutedContext actionExecutedContext,
- IActionFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuted"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnActionExecuted",
- new
- {
- actionDescriptor = actionExecutedContext.ActionDescriptor,
- actionExecutedContext = actionExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeActionMethod(
- this DiagnosticSource diagnosticSource,
- ActionContext actionContext,
- IDictionary actionArguments,
- object controller)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(actionArguments != null);
- Debug.Assert(controller != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionMethod"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeActionMethod",
- new
- {
- actionContext = actionContext,
- arguments = actionArguments,
- controller = controller
- });
- }
- }
-
- public static void AfterActionMethod(
- this DiagnosticSource diagnosticSource,
- ActionContext actionContext,
- IDictionary actionArguments,
- object controller,
- IActionResult result)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(actionArguments != null);
- Debug.Assert(controller != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionMethod"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterActionMethod",
- new
- {
- actionContext = actionContext,
- arguments = actionArguments,
- controller = controller,
- result = result
- });
- }
- }
-
- public static void BeforeOnResultExecution(
- this DiagnosticSource diagnosticSource,
- ResultExecutingContext resultExecutingContext,
- IAsyncResultFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resultExecutingContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecution"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResultExecution",
- new
- {
- actionDescriptor = resultExecutingContext.ActionDescriptor,
- resultExecutingContext = resultExecutingContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnResultExecution(
- this DiagnosticSource diagnosticSource,
- ResultExecutedContext resultExecutedContext,
- IAsyncResultFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resultExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecution"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResultExecution",
- new
- {
- actionDescriptor = resultExecutedContext.ActionDescriptor,
- resultExecutedContext = resultExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnResultExecuting(
- this DiagnosticSource diagnosticSource,
- ResultExecutingContext resultExecutingContext,
- IResultFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resultExecutingContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting",
- new
- {
- actionDescriptor = resultExecutingContext.ActionDescriptor,
- resultExecutingContext = resultExecutingContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnResultExecuting(
- this DiagnosticSource diagnosticSource,
- ResultExecutingContext resultExecutingContext,
- IResultFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resultExecutingContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuting"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResultExecuting",
- new
- {
- actionDescriptor = resultExecutingContext.ActionDescriptor,
- resultExecutingContext = resultExecutingContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnResultExecuted(
- this DiagnosticSource diagnosticSource,
- ResultExecutedContext resultExecutedContext,
- IResultFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resultExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted",
- new
- {
- actionDescriptor = resultExecutedContext.ActionDescriptor,
- resultExecutedContext = resultExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnResultExecuted(
- this DiagnosticSource diagnosticSource,
- ResultExecutedContext resultExecutedContext,
- IResultFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(resultExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuted"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResultExecuted",
- new
- {
- actionDescriptor = resultExecutedContext.ActionDescriptor,
- resultExecutedContext = resultExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeActionResult(
- this DiagnosticSource diagnosticSource,
- ActionContext actionContext,
- IActionResult result)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(result != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionResult"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeActionResult",
- new { actionContext = actionContext, result = result });
- }
- }
-
- public static void AfterActionResult(
- this DiagnosticSource diagnosticSource,
- ActionContext actionContext,
- IActionResult result)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(result != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionResult"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterActionResult",
- new { actionContext = actionContext, result = result });
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/LocalRedirectResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/LocalRedirectResult.cs
index ca20eb5020..a600c39079 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/LocalRedirectResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/LocalRedirectResult.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Microsoft.AspNetCore.Mvc.Core.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Microsoft.AspNetCore.Mvc.Core.csproj
index 7a21b34e45..d1e9953b50 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Microsoft.AspNetCore.Mvc.Core.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Microsoft.AspNetCore.Mvc.Core.csproj
@@ -10,7 +10,7 @@ Microsoft.AspNetCore.Mvc.FromBodyAttribute
Microsoft.AspNetCore.Mvc.FromFormAttribute
Microsoft.AspNetCore.Mvc.RequireHttpsAttribute
Microsoft.AspNetCore.Mvc.RouteAttribute
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinder.cs
index 8e0744cfda..dd4051973c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinder.cs
@@ -9,7 +9,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ByteArrayModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ByteArrayModelBinder.cs
index 99461f9ec9..c3772d8383 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ByteArrayModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ByteArrayModelBinder.cs
@@ -3,7 +3,6 @@
using System;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/CollectionModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/CollectionModelBinder.cs
index 372a7da770..881eb12992 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/CollectionModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/CollectionModelBinder.cs
@@ -9,8 +9,6 @@ using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ComplexTypeModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ComplexTypeModelBinder.cs
index 5c1e82a80c..2da15ed858 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ComplexTypeModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ComplexTypeModelBinder.cs
@@ -7,7 +7,6 @@ using System.Linq.Expressions;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DecimalModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DecimalModelBinder.cs
index 7692baa009..3670185732 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DecimalModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DecimalModelBinder.cs
@@ -5,7 +5,6 @@ using System;
using System.Globalization;
using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DictionaryModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DictionaryModelBinder.cs
index 0954f87e6c..d060a065f8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DictionaryModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DictionaryModelBinder.cs
@@ -6,8 +6,6 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DoubleModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DoubleModelBinder.cs
index 77d32d5a0d..3a62b2fa39 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DoubleModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DoubleModelBinder.cs
@@ -5,7 +5,6 @@ using System;
using System.Globalization;
using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FloatModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FloatModelBinder.cs
index 515266d2df..c34a8be777 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FloatModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FloatModelBinder.cs
@@ -5,7 +5,6 @@ using System;
using System.Globalization;
using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FormCollectionModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FormCollectionModelBinder.cs
index 41d96ed272..3c26cafb2d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FormCollectionModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FormCollectionModelBinder.cs
@@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Primitives;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FormFileModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FormFileModelBinder.cs
index 76b4bf54ca..526225343e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FormFileModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FormFileModelBinder.cs
@@ -8,8 +8,6 @@ using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/HeaderModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/HeaderModelBinder.cs
index e9de376246..54ce71f896 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/HeaderModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/HeaderModelBinder.cs
@@ -6,8 +6,6 @@ using System.Diagnostics;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/HeaderModelBinderProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/HeaderModelBinderProvider.cs
index c0f46ff93c..2b885e3617 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/HeaderModelBinderProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/HeaderModelBinderProvider.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/KeyValuePairModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/KeyValuePairModelBinder.cs
index ee90c3f01e..45aab720ba 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/KeyValuePairModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/KeyValuePairModelBinder.cs
@@ -4,8 +4,6 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/SimpleTypeModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/SimpleTypeModelBinder.cs
index 017049e769..de1f1da636 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/SimpleTypeModelBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/SimpleTypeModelBinder.cs
@@ -5,7 +5,6 @@ using System;
using System.ComponentModel;
using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultModelBindingContext.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/DefaultModelBindingContext.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultModelBindingContext.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/DefaultModelBindingContext.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/DefaultPropertyFilterProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/DefaultPropertyFilterProvider.cs
index 3d1bc81a71..6105b3adf0 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/DefaultPropertyFilterProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/DefaultPropertyFilterProvider.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ElementalValueProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ElementalValueProvider.cs
similarity index 87%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ElementalValueProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ElementalValueProvider.cs
index 83bfeed66a..7fefe4c9f8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ElementalValueProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ElementalValueProvider.cs
@@ -3,11 +3,10 @@
using System;
using System.Globalization;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
- public class ElementalValueProvider : IValueProvider
+ internal class ElementalValueProvider : IValueProvider
{
public ElementalValueProvider(string key, string value, CultureInfo culture)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/EmptyModelMetadataProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/EmptyModelMetadataProvider.cs
index 122d760af8..22df255b21 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/EmptyModelMetadataProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/EmptyModelMetadataProvider.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/FormValueProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/FormValueProvider.cs
index da13af979e..278407db2d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/FormValueProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/FormValueProvider.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
@@ -14,7 +13,6 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
///
public class FormValueProvider : BindingSourceValueProvider, IEnumerableValueProvider
{
- private readonly CultureInfo _culture;
private readonly IFormCollection _values;
private PrefixContainer _prefixContainer;
@@ -41,14 +39,12 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
}
_values = values;
- _culture = culture;
+ Culture = culture;
}
- public CultureInfo Culture => _culture;
+ public CultureInfo Culture { get; }
-#pragma warning disable PUB0001 // Pubternal type in public API
protected PrefixContainer PrefixContainer
-#pragma warning restore PUB0001
{
get
{
@@ -86,6 +82,15 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
throw new ArgumentNullException(nameof(key));
}
+ if (key.Length == 0)
+ {
+ // Top level parameters will fall back to an empty prefix when the parameter name does not
+ // appear in any value provider. This would result in the parameter binding to a form parameter
+ // with a empty key (e.g. Request body looks like "=test") which isn't a scenario we want to support.
+ // Return a "None" result in this event.
+ return ValueProviderResult.None;
+ }
+
var values = _values[key];
if (values.Count == 0)
{
@@ -93,7 +98,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
}
else
{
- return new ValueProviderResult(values, _culture);
+ return new ValueProviderResult(values, Culture);
}
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/JQueryValueProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/JQueryValueProvider.cs
index 6ae1c84377..581b18112c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/JQueryValueProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/JQueryValueProvider.cs
@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
@@ -52,9 +51,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
public CultureInfo Culture { get; }
///
-#pragma warning disable PUB0001 // Pubternal type in public API
protected PrefixContainer PrefixContainer
-#pragma warning restore PUB0001
{
get
{
@@ -82,8 +79,12 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
///
public override ValueProviderResult GetValue(string key)
{
- StringValues values;
- if (_values.TryGetValue(key, out values) && values.Count > 0)
+ if (key == null)
+ {
+ throw new ArgumentNullException(nameof(key));
+ }
+
+ if (_values.TryGetValue(key, out var values) && values.Count > 0)
{
return new ValueProviderResult(values, Culture);
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultBindingMetadataProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/DefaultBindingMetadataProvider.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultBindingMetadataProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/DefaultBindingMetadataProvider.cs
index 8e0546b992..5cc570394b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultBindingMetadataProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/DefaultBindingMetadataProvider.cs
@@ -5,15 +5,13 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
{
///
/// A default implementation of .
///
- public class DefaultBindingMetadataProvider : IBindingMetadataProvider
+ internal class DefaultBindingMetadataProvider : IBindingMetadataProvider
{
public void CreateBindingMetadata(BindingMetadataProviderContext context)
{
@@ -128,4 +126,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultCompositeMetadataDetailsProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/DefaultCompositeMetadataDetailsProvider.cs
similarity index 80%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultCompositeMetadataDetailsProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/DefaultCompositeMetadataDetailsProvider.cs
index 37dfed3868..18792c320e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultCompositeMetadataDetailsProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/DefaultCompositeMetadataDetailsProvider.cs
@@ -4,14 +4,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
{
///
/// A default implementation of .
///
- public class DefaultCompositeMetadataDetailsProvider : ICompositeMetadataDetailsProvider
+ internal class DefaultCompositeMetadataDetailsProvider : ICompositeMetadataDetailsProvider
{
private readonly IEnumerable _providers;
@@ -25,7 +24,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
///
- public virtual void CreateBindingMetadata(BindingMetadataProviderContext context)
+ public void CreateBindingMetadata(BindingMetadataProviderContext context)
{
if (context == null)
{
@@ -39,7 +38,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
///
- public virtual void CreateDisplayMetadata(DisplayMetadataProviderContext context)
+ public void CreateDisplayMetadata(DisplayMetadataProviderContext context)
{
if (context == null)
{
@@ -53,7 +52,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
///
- public virtual void CreateValidationMetadata(ValidationMetadataProviderContext context)
+ public void CreateValidationMetadata(ValidationMetadataProviderContext context)
{
if (context == null)
{
@@ -66,4 +65,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultValidationMetadataProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/DefaultValidationMetadataProvider.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultValidationMetadataProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/DefaultValidationMetadataProvider.cs
index 03faa4be62..c8df349ccd 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultValidationMetadataProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/DefaultValidationMetadataProvider.cs
@@ -4,15 +4,14 @@
using System;
using System.Linq;
using System.Reflection;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
{
///
/// A default implementation of .
///
- public class DefaultValidationMetadataProvider : IValidationMetadataProvider
+ internal class DefaultValidationMetadataProvider : IValidationMetadataProvider
{
///
public void CreateValidationMetadata(ValidationMetadataProviderContext context)
@@ -56,4 +55,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBinderFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBinderFactory.cs
index 4b7a53b498..c9d973db2b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBinderFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBinderFactory.cs
@@ -8,7 +8,6 @@ using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Internal;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Internal/ModelBindingHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBindingHelper.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Internal/ModelBindingHelper.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBindingHelper.cs
index 90d8dd79f1..bc2f84b235 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Internal/ModelBindingHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBindingHelper.cs
@@ -14,9 +14,9 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.ModelBinding.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
- public static class ModelBindingHelper
+ internal static class ModelBindingHelper
{
///
/// Updates the specified instance using the specified
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NoOpBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/NoOpBinder.cs
similarity index 76%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NoOpBinder.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/NoOpBinder.cs
index 0fd7146fc3..7f591d6a8b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NoOpBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/NoOpBinder.cs
@@ -2,11 +2,10 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
- public class NoOpBinder : IModelBinder
+ internal class NoOpBinder : IModelBinder
{
public static readonly IModelBinder Instance = new NoOpBinder();
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ObjectModelValidator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ObjectModelValidator.cs
index 6c34f35c2f..43785d55cd 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ObjectModelValidator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ObjectModelValidator.cs
@@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
@@ -101,9 +100,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
public abstract ValidationVisitor GetValidationVisitor(
ActionContext actionContext,
IModelValidatorProvider validatorProvider,
-#pragma warning disable PUB0001 // Pubternal type in public API
ValidatorCache validatorCache,
-#pragma warning restore PUB0001
IModelMetadataProvider metadataProvider,
ValidationStateDictionary validationState);
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ParameterBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ParameterBinder.cs
index 0cf3693eb1..f0129749d9 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ParameterBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ParameterBinder.cs
@@ -5,7 +5,6 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/PlaceholderBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/PlaceholderBinder.cs
similarity index 84%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/PlaceholderBinder.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/PlaceholderBinder.cs
index 0e6bdc07a1..dc3d79618f 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/PlaceholderBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/PlaceholderBinder.cs
@@ -2,15 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
// Used as a placeholder to break cycles while building a tree of model binders in ModelBinderFactory.
//
// When a cycle is detected by a call to Create(...), we create an instance of this class and return it
// to break the cycle. Later when the 'real' binder is created we set Inner to point to that.
- public class PlaceholderBinder : IModelBinder
+ internal class PlaceholderBinder : IModelBinder
{
public IModelBinder Inner { get; set; }
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/PrefixContainer.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/PrefixContainer.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/PrefixContainer.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/PrefixContainer.cs
index ade8cc8102..aa4b0a6f6b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/PrefixContainer.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/PrefixContainer.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
///
/// This is a container for prefix values. It normalizes all the values into dotted-form and then stores
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/PropertyValueSetter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/PropertyValueSetter.cs
similarity index 89%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/PropertyValueSetter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/PropertyValueSetter.cs
index a6983106da..353a39a724 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/PropertyValueSetter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/PropertyValueSetter.cs
@@ -3,11 +3,10 @@
using System.Collections.Generic;
using System.Reflection;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
- public static class PropertyValueSetter
+ internal static class PropertyValueSetter
{
private static readonly MethodInfo CallPropertyAddRangeOpenGenericMethod =
typeof(PropertyValueSetter).GetMethod(nameof(CallPropertyAddRange), BindingFlags.NonPublic | BindingFlags.Static);
@@ -58,8 +57,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
private static void CallPropertyAddRange(object target, object source)
{
var targetCollection = (ICollection)target;
- var sourceCollection = source as IEnumerable;
- if (sourceCollection != null && !targetCollection.IsReadOnly)
+ if (source is IEnumerable sourceCollection && !targetCollection.IsReadOnly)
{
targetCollection.Clear();
foreach (var item in sourceCollection)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/QueryStringValueProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/QueryStringValueProvider.cs
index e7d62e3852..9094a62dda 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/QueryStringValueProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/QueryStringValueProvider.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
@@ -14,7 +13,6 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
///
public class QueryStringValueProvider : BindingSourceValueProvider, IEnumerableValueProvider
{
- private readonly CultureInfo _culture;
private readonly IQueryCollection _values;
private PrefixContainer _prefixContainer;
@@ -41,14 +39,12 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
}
_values = values;
- _culture = culture;
+ Culture = culture;
}
- public CultureInfo Culture => _culture;
+ public CultureInfo Culture { get; }
-#pragma warning disable PUB0001 // Pubternal type in public API
protected PrefixContainer PrefixContainer
-#pragma warning restore PUB0001
{
get
{
@@ -86,6 +82,15 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
throw new ArgumentNullException(nameof(key));
}
+ if (key.Length == 0)
+ {
+ // Top level parameters will fall back to an empty prefix when the parameter name does not
+ // appear in any value provider. This would result in the parameter binding to a query string
+ // parameter with a empty key (e.g. /User?=test) which isn't a scenario we want to support.
+ // Return a "None" result in this event.
+ return ValueProviderResult.None;
+ }
+
var values = _values[key];
if (values.Count == 0)
{
@@ -93,7 +98,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
}
else
{
- return new ValueProviderResult(values, _culture);
+ return new ValueProviderResult(values, Culture);
}
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ReferenceEqualityComparer.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ReferenceEqualityComparer.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ReferenceEqualityComparer.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ReferenceEqualityComparer.cs
index e2288a01c8..ec41a7f810 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ReferenceEqualityComparer.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ReferenceEqualityComparer.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
internal class ReferenceEqualityComparer : IEqualityComparer
{
@@ -31,4 +31,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
return RuntimeHelpers.GetHashCode(obj);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/RouteValueProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/RouteValueProvider.cs
index 615b4bd437..66e1ea1c2e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/RouteValueProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/RouteValueProvider.cs
@@ -3,7 +3,6 @@
using System;
using System.Globalization;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
@@ -57,9 +56,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
Culture = culture;
}
-#pragma warning disable PUB0001 // Pubternal type in public API
protected PrefixContainer PrefixContainer
-#pragma warning restore PUB0001
{
get
{
@@ -88,6 +85,15 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
throw new ArgumentNullException(nameof(key));
}
+ if (key.Length == 0)
+ {
+ // Top level parameters will fall back to an empty prefix when the parameter name does not
+ // appear in any value provider. This would result in the parameter binding to a route value
+ // an empty key which isn't a scenario we want to support.
+ // Return a "None" result in this event.
+ return ValueProviderResult.None;
+ }
+
if (_values.TryGetValue(key, out var value))
{
var stringValue = value as string ?? Convert.ToString(value, Culture) ?? string.Empty;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ClientValidatorCache.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ClientValidatorCache.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ClientValidatorCache.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ClientValidatorCache.cs
index 0bcc97f67b..2697daec71 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ClientValidatorCache.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ClientValidatorCache.cs
@@ -5,10 +5,8 @@ using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
public class ClientValidatorCache
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultCollectionValidationStrategy.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultCollectionValidationStrategy.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultCollectionValidationStrategy.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultCollectionValidationStrategy.cs
index 322f55d55b..95dc8db0e8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultCollectionValidationStrategy.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultCollectionValidationStrategy.cs
@@ -5,12 +5,10 @@ using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
-using System.Reflection;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.Linq.Expressions;
+using System.Reflection;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
///
/// The default implementation of for a collection.
@@ -18,28 +16,28 @@ namespace Microsoft.AspNetCore.Mvc.Internal
///
/// This implementation handles cases like:
///
- /// Model: IList<Student>
+ /// Model: IList<Student>
/// Query String: ?students[0].Age=8&students[1].Age=9
- ///
+ ///
/// In this case the elements of the collection are identified in the input data set by an incrementing
/// integer index.
///
- ///
+ ///
/// or:
- ///
+ ///
///
- /// Model: IDictionary<string, int>
+ /// Model: IDictionary<string, int>
/// Query String: ?students[0].Key=Joey&students[0].Value=8
- ///
+ ///
/// In this case the dictionary is treated as a collection of key-value pairs, and the elements of the
/// collection are identified in the input data set by an incrementing integer index.
///
- ///
+ ///
/// Using this key format, the enumerator enumerates model objects of type matching
/// . The indices of the elements in the collection are used to
/// compute the model prefix keys.
///
- public class DefaultCollectionValidationStrategy : IValidationStrategy
+ internal class DefaultCollectionValidationStrategy : IValidationStrategy
{
private static readonly MethodInfo _getEnumerator = typeof(DefaultCollectionValidationStrategy)
.GetMethod(nameof(GetEnumerator), BindingFlags.Static | BindingFlags.NonPublic);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultComplexObjectValidationStrategy.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultComplexObjectValidationStrategy.cs
similarity index 94%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultComplexObjectValidationStrategy.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultComplexObjectValidationStrategy.cs
index a2a1e0323a..f82ec567f1 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/DefaultComplexObjectValidationStrategy.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultComplexObjectValidationStrategy.cs
@@ -5,15 +5,13 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
///
/// The default implementation of for a complex object.
///
- public class DefaultComplexObjectValidationStrategy : IValidationStrategy
+ internal class DefaultComplexObjectValidationStrategy : IValidationStrategy
{
private static readonly bool IsMono = Type.GetType("Mono.Runtime") != null;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultModelValidatorProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultModelValidatorProvider.cs
index 2174be1417..4abcdc4d44 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultModelValidatorProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultModelValidatorProvider.cs
@@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
/// The provides validators from
/// instances in .
///
- internal sealed class DefaultModelValidatorProvider : IMetadataBasedModelValidatorProvider
+ internal class DefaultModelValidatorProvider : IMetadataBasedModelValidatorProvider
{
///
public void CreateValidators(ModelValidatorProviderContext context)
@@ -50,4 +50,4 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
return false;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DefaultObjectValidator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultObjectValidator.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DefaultObjectValidator.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultObjectValidator.cs
index ff175dc5cf..102634f3f4 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/DefaultObjectValidator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/DefaultObjectValidator.cs
@@ -2,11 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
///
/// The default implementation of .
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ExplicitIndexCollectionValidationStrategy.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ExplicitIndexCollectionValidationStrategy.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ExplicitIndexCollectionValidationStrategy.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ExplicitIndexCollectionValidationStrategy.cs
index eb955d6964..4c63b2cbaa 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ExplicitIndexCollectionValidationStrategy.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ExplicitIndexCollectionValidationStrategy.cs
@@ -4,10 +4,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
///
/// An implementation of for a collection bound using 'explicit indexing'
@@ -16,20 +14,20 @@ namespace Microsoft.AspNetCore.Mvc.Internal
///
/// This implementation handles cases like:
///
- /// Model: IList<Student>
+ /// Model: IList<Student>
/// Query String: ?students.index=Joey,Katherine&students[Joey].Age=8&students[Katherine].Age=9
- ///
+ ///
/// In this case, 'Joey' and 'Katherine' need to be used in the model prefix keys, but cannot be inferred
- /// form inspecting the collection. These prefixes are captured during model binding, and mapped to
+ /// form inspecting the collection. These prefixes are captured during model binding, and mapped to
/// the corresponding ordinal index of a model object in the collection. The enumerator returned from this
/// class will yield two 'Student' objects with corresponding keys 'students[Joey]' and 'students[Katherine]'.
///
- ///
+ ///
/// Using this key format, the enumerator enumerates model objects of type matching
/// . The keys captured during model binding are mapped to the elements
/// in the collection to compute the model prefix keys.
///
- public class ExplicitIndexCollectionValidationStrategy : IValidationStrategy
+ internal class ExplicitIndexCollectionValidationStrategy : IValidationStrategy
{
///
/// Creates a new .
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ShortFormDictionaryValidationStrategy.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ShortFormDictionaryValidationStrategy.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ShortFormDictionaryValidationStrategy.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ShortFormDictionaryValidationStrategy.cs
index 31d1db97bf..5f79aae6f4 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ShortFormDictionaryValidationStrategy.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ShortFormDictionaryValidationStrategy.cs
@@ -7,7 +7,7 @@ using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
///
/// An implementation of for a dictionary bound with 'short form' style keys.
@@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// Using this key format, the enumerator enumerates model objects of type . The
/// keys of the dictionary are not validated as they must be simple types.
///
- public class ShortFormDictionaryValidationStrategy : IValidationStrategy
+ internal class ShortFormDictionaryValidationStrategy : IValidationStrategy
{
private readonly ModelMetadata _valueMetadata;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Internal/ValidationStack.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ValidationStack.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Internal/ValidationStack.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ValidationStack.cs
index ba24828544..de067ac450 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Internal/ValidationStack.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ValidationStack.cs
@@ -3,11 +3,10 @@
using System.Collections.Generic;
using System.Diagnostics;
-using Microsoft.AspNetCore.Mvc.Internal;
-namespace Microsoft.AspNetCore.Mvc.ModelBinding.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
- public class ValidationStack
+ internal class ValidationStack
{
public int Count => HashSet?.Count ?? List.Count;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ValidationVisitor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ValidationVisitor.cs
index 0b277c68c6..681bdc4548 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ValidationVisitor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ValidationVisitor.cs
@@ -5,8 +5,6 @@ using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
@@ -17,6 +15,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
///
public class ValidationVisitor
{
+ private readonly ValidationStack _currentPath;
private int? _maxValidationDepth;
///
@@ -30,9 +29,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
public ValidationVisitor(
ActionContext actionContext,
IModelValidatorProvider validatorProvider,
-#pragma warning disable PUB0001 // Pubternal type in public API
ValidatorCache validatorCache,
-#pragma warning restore PUB0001
IModelMetadataProvider metadataProvider,
ValidationStateDictionary validationState)
{
@@ -59,20 +56,16 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
ValidationState = validationState;
ModelState = actionContext.ModelState;
- CurrentPath = new ValidationStack();
+ _currentPath = new ValidationStack();
}
protected IModelValidatorProvider ValidatorProvider { get; }
protected IModelMetadataProvider MetadataProvider { get; }
-#pragma warning disable PUB0001 // Pubternal type in public API
+
protected ValidatorCache Cache { get; }
-#pragma warning restore PUB0001
protected ActionContext Context { get; }
protected ModelStateDictionary ModelState { get; }
protected ValidationStateDictionary ValidationState { get; }
-#pragma warning disable PUB0001 // Pubternal type in public API
- protected ValidationStack CurrentPath { get; }
-#pragma warning restore PUB0001
protected object Container { get; set; }
protected string Key { get; set; }
@@ -221,18 +214,18 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
RuntimeHelpers.EnsureSufficientExecutionStack();
- if (model != null && !CurrentPath.Push(model))
+ if (model != null && !_currentPath.Push(model))
{
// This is a cycle, bail.
return true;
}
- if (MaxValidationDepth != null && CurrentPath.Count > MaxValidationDepth)
+ if (MaxValidationDepth != null && _currentPath.Count > MaxValidationDepth)
{
// Non cyclic but too deep an object graph.
// Pop the current model to make ValidationStack.Dispose happy
- CurrentPath.Pop(model);
+ _currentPath.Pop(model);
string message;
switch (metadata.MetadataKind)
@@ -268,7 +261,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
// Use the key on the entry, because we might not have entries in model state.
SuppressValidation(entry.Key);
- CurrentPath.Pop(model);
+ _currentPath.Pop(model);
return true;
}
// If the metadata indicates that no validators exist AND the aggregate state for the key says that the model graph
@@ -288,7 +281,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
}
}
- CurrentPath.Pop(model);
+ _currentPath.Pop(model);
return true;
}
@@ -448,7 +441,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
_visitor.Model = _model;
_visitor.Strategy = _strategy;
- _visitor.CurrentPath.Pop(_newModel);
+ _visitor._currentPath.Pop(_newModel);
}
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ValidatorCache.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ValidatorCache.cs
similarity index 94%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ValidatorCache.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ValidatorCache.cs
index 61e8303d40..5fadd38e29 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ValidatorCache.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ValidatorCache.cs
@@ -5,10 +5,8 @@ using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
public class ValidatorCache
{
@@ -16,8 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
public IReadOnlyList GetValidators(ModelMetadata metadata, IModelValidatorProvider validatorProvider)
{
- CacheEntry entry;
- if (_cacheEntries.TryGetValue(metadata, out entry))
+ if (_cacheEntries.TryGetValue(metadata, out var entry))
{
return GetValidatorsFromEntry(entry, metadata, validatorProvider);
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreDiagnosticSourceExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreDiagnosticSourceExtensions.cs
new file mode 100644
index 0000000000..32085e7da8
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreDiagnosticSourceExtensions.cs
@@ -0,0 +1,1000 @@
+// 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.Diagnostics;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc.Abstractions;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.AspNetCore.Routing;
+
+namespace Microsoft.AspNetCore.Mvc
+{
+ // We're doing a lot of asserts here because these methods are really tedious to test and
+ // highly dependent on the details of the invoker's state machine. Basically if we wrote the
+ // obvious unit tests that would generate a lot of boilerplate and wouldn't cover the hard parts.
+ internal static class MvcCoreDiagnosticSourceExtensions
+ {
+ public static void BeforeAction(
+ this DiagnosticListener diagnosticListener,
+ ActionDescriptor actionDescriptor,
+ HttpContext httpContext,
+ RouteData routeData)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionDescriptor != null);
+ Debug.Assert(httpContext != null);
+ Debug.Assert(routeData != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeActionImpl(diagnosticListener, actionDescriptor, httpContext, routeData);
+ }
+ }
+
+ private static void BeforeActionImpl(DiagnosticListener diagnosticListener, ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeAction"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeAction",
+ new { actionDescriptor, httpContext = httpContext, routeData = routeData });
+ }
+ }
+
+ public static void AfterAction(
+ this DiagnosticListener diagnosticListener,
+ ActionDescriptor actionDescriptor,
+ HttpContext httpContext,
+ RouteData routeData)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionDescriptor != null);
+ Debug.Assert(httpContext != null);
+ Debug.Assert(routeData != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterActionImpl(diagnosticListener, actionDescriptor, httpContext, routeData);
+ }
+ }
+
+ private static void AfterActionImpl(DiagnosticListener diagnosticListener, ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterAction"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterAction",
+ new { actionDescriptor, httpContext = httpContext, routeData = routeData });
+ }
+ }
+
+ public static void BeforeOnAuthorizationAsync(
+ this DiagnosticListener diagnosticListener,
+ AuthorizationFilterContext authorizationContext,
+ IAsyncAuthorizationFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(authorizationContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnAuthorizationAsyncImpl(diagnosticListener, authorizationContext, filter);
+ }
+ }
+
+ private static void BeforeOnAuthorizationAsyncImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAsyncAuthorizationFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnAuthorization",
+ new
+ {
+ actionDescriptor = authorizationContext.ActionDescriptor,
+ authorizationContext = authorizationContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnAuthorizationAsync(
+ this DiagnosticListener diagnosticListener,
+ AuthorizationFilterContext authorizationContext,
+ IAsyncAuthorizationFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(authorizationContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnAuthorizationAsyncImpl(diagnosticListener, authorizationContext, filter);
+ }
+ }
+
+ private static void AfterOnAuthorizationAsyncImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAsyncAuthorizationFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnAuthorization",
+ new
+ {
+ actionDescriptor = authorizationContext.ActionDescriptor,
+ authorizationContext = authorizationContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnAuthorization(
+ this DiagnosticListener diagnosticListener,
+ AuthorizationFilterContext authorizationContext,
+ IAuthorizationFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(authorizationContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnAuthorizationImpl(diagnosticListener, authorizationContext, filter);
+ }
+ }
+
+ private static void BeforeOnAuthorizationImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAuthorizationFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnAuthorization",
+ new
+ {
+ actionDescriptor = authorizationContext.ActionDescriptor,
+ authorizationContext = authorizationContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnAuthorization(
+ this DiagnosticListener diagnosticListener,
+ AuthorizationFilterContext authorizationContext,
+ IAuthorizationFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(authorizationContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnAuthorizationImpl(diagnosticListener, authorizationContext, filter);
+ }
+ }
+
+ private static void AfterOnAuthorizationImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAuthorizationFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnAuthorization",
+ new
+ {
+ actionDescriptor = authorizationContext.ActionDescriptor,
+ authorizationContext = authorizationContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnResourceExecution(
+ this DiagnosticListener diagnosticListener,
+ ResourceExecutingContext resourceExecutingContext,
+ IAsyncResourceFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resourceExecutingContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnResourceExecutionImpl(diagnosticListener, resourceExecutingContext, filter);
+ }
+ }
+
+ private static void BeforeOnResourceExecutionImpl(DiagnosticListener diagnosticListener, ResourceExecutingContext resourceExecutingContext, IAsyncResourceFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution",
+ new
+ {
+ actionDescriptor = resourceExecutingContext.ActionDescriptor,
+ resourceExecutingContext = resourceExecutingContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnResourceExecution(
+ this DiagnosticListener diagnosticListener,
+ ResourceExecutedContext resourceExecutedContext,
+ IAsyncResourceFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resourceExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnResourceExecutionImpl(diagnosticListener, resourceExecutedContext, filter);
+ }
+ }
+
+ private static void AfterOnResourceExecutionImpl(DiagnosticListener diagnosticListener, ResourceExecutedContext resourceExecutedContext, IAsyncResourceFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecution"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnResourceExecution",
+ new
+ {
+ actionDescriptor = resourceExecutedContext.ActionDescriptor,
+ resourceExecutedContext = resourceExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnResourceExecuting(
+ this DiagnosticListener diagnosticListener,
+ ResourceExecutingContext resourceExecutingContext,
+ IResourceFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resourceExecutingContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnResourceExecutingImpl(diagnosticListener, resourceExecutingContext, filter);
+ }
+ }
+
+ private static void BeforeOnResourceExecutingImpl(DiagnosticListener diagnosticListener, ResourceExecutingContext resourceExecutingContext, IResourceFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting",
+ new
+ {
+ actionDescriptor = resourceExecutingContext.ActionDescriptor,
+ resourceExecutingContext = resourceExecutingContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnResourceExecuting(
+ this DiagnosticListener diagnosticListener,
+ ResourceExecutingContext resourceExecutingContext,
+ IResourceFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resourceExecutingContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnResourceExecutingImpl(diagnosticListener, resourceExecutingContext, filter);
+ }
+ }
+
+ private static void AfterOnResourceExecutingImpl(DiagnosticListener diagnosticListener, ResourceExecutingContext resourceExecutingContext, IResourceFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting",
+ new
+ {
+ actionDescriptor = resourceExecutingContext.ActionDescriptor,
+ resourceExecutingContext = resourceExecutingContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnResourceExecuted(
+ this DiagnosticListener diagnosticListener,
+ ResourceExecutedContext resourceExecutedContext,
+ IResourceFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resourceExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnResourceExecutedImpl(diagnosticListener, resourceExecutedContext, filter);
+ }
+ }
+
+ private static void BeforeOnResourceExecutedImpl(DiagnosticListener diagnosticListener, ResourceExecutedContext resourceExecutedContext, IResourceFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted",
+ new
+ {
+ actionDescriptor = resourceExecutedContext.ActionDescriptor,
+ resourceExecutedContext = resourceExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnResourceExecuted(
+ this DiagnosticListener diagnosticListener,
+ ResourceExecutedContext resourceExecutedContext,
+ IResourceFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resourceExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnResourceExecutedImpl(diagnosticListener, resourceExecutedContext, filter);
+ }
+ }
+
+ private static void AfterOnResourceExecutedImpl(DiagnosticListener diagnosticListener, ResourceExecutedContext resourceExecutedContext, IResourceFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted",
+ new
+ {
+ actionDescriptor = resourceExecutedContext.ActionDescriptor,
+ resourceExecutedContext = resourceExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnExceptionAsync(
+ this DiagnosticListener diagnosticListener,
+ ExceptionContext exceptionContext,
+ IAsyncExceptionFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(exceptionContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnExceptionAsyncImpl(diagnosticListener, exceptionContext, filter);
+ }
+ }
+
+ private static void BeforeOnExceptionAsyncImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IAsyncExceptionFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnException",
+ new
+ {
+ actionDescriptor = exceptionContext.ActionDescriptor,
+ exceptionContext = exceptionContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnExceptionAsync(
+ this DiagnosticListener diagnosticListener,
+ ExceptionContext exceptionContext,
+ IAsyncExceptionFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(exceptionContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnExceptionAsyncImpl(diagnosticListener, exceptionContext, filter);
+ }
+ }
+
+ private static void AfterOnExceptionAsyncImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IAsyncExceptionFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnException",
+ new
+ {
+ actionDescriptor = exceptionContext.ActionDescriptor,
+ exceptionContext = exceptionContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnException(
+ this DiagnosticListener diagnosticListener,
+ ExceptionContext exceptionContext,
+ IExceptionFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(exceptionContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnExceptionImpl(diagnosticListener, exceptionContext, filter);
+ }
+ }
+
+ private static void BeforeOnExceptionImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IExceptionFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnException",
+ new
+ {
+ actionDescriptor = exceptionContext.ActionDescriptor,
+ exceptionContext = exceptionContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnException(
+ this DiagnosticListener diagnosticListener,
+ ExceptionContext exceptionContext,
+ IExceptionFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(exceptionContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnExceptionImpl(diagnosticListener, exceptionContext, filter);
+ }
+ }
+
+ private static void AfterOnExceptionImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IExceptionFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnException",
+ new
+ {
+ actionDescriptor = exceptionContext.ActionDescriptor,
+ exceptionContext = exceptionContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnActionExecution(
+ this DiagnosticListener diagnosticListener,
+ ActionExecutingContext actionExecutingContext,
+ IAsyncActionFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionExecutingContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnActionExecutionImpl(diagnosticListener, actionExecutingContext, filter);
+ }
+ }
+
+ private static void BeforeOnActionExecutionImpl(DiagnosticListener diagnosticListener, ActionExecutingContext actionExecutingContext, IAsyncActionFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecution"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnActionExecution",
+ new
+ {
+ actionDescriptor = actionExecutingContext.ActionDescriptor,
+ actionExecutingContext = actionExecutingContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnActionExecution(
+ this DiagnosticListener diagnosticListener,
+ ActionExecutedContext actionExecutedContext,
+ IAsyncActionFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnActionExecutionImpl(diagnosticListener, actionExecutedContext, filter);
+ }
+ }
+
+ private static void AfterOnActionExecutionImpl(DiagnosticListener diagnosticListener, ActionExecutedContext actionExecutedContext, IAsyncActionFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecution"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnActionExecution",
+ new
+ {
+ actionDescriptor = actionExecutedContext.ActionDescriptor,
+ actionExecutedContext = actionExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnActionExecuting(
+ this DiagnosticListener diagnosticListener,
+ ActionExecutingContext actionExecutingContext,
+ IActionFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionExecutingContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnActionExecutingImpl(diagnosticListener, actionExecutingContext, filter);
+ }
+ }
+
+ private static void BeforeOnActionExecutingImpl(DiagnosticListener diagnosticListener, ActionExecutingContext actionExecutingContext, IActionFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting",
+ new
+ {
+ actionDescriptor = actionExecutingContext.ActionDescriptor,
+ actionExecutingContext = actionExecutingContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnActionExecuting(
+ this DiagnosticListener diagnosticListener,
+ ActionExecutingContext actionExecutingContext,
+ IActionFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionExecutingContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnActionExecutingImpl(diagnosticListener, actionExecutingContext, filter);
+ }
+ }
+
+ private static void AfterOnActionExecutingImpl(DiagnosticListener diagnosticListener, ActionExecutingContext actionExecutingContext, IActionFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuting"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnActionExecuting",
+ new
+ {
+ actionDescriptor = actionExecutingContext.ActionDescriptor,
+ actionExecutingContext = actionExecutingContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnActionExecuted(
+ this DiagnosticListener diagnosticListener,
+ ActionExecutedContext actionExecutedContext,
+ IActionFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnActionExecutedImpl(diagnosticListener, actionExecutedContext, filter);
+ }
+ }
+
+ private static void BeforeOnActionExecutedImpl(DiagnosticListener diagnosticListener, ActionExecutedContext actionExecutedContext, IActionFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted",
+ new
+ {
+ actionDescriptor = actionExecutedContext.ActionDescriptor,
+ actionExecutedContext = actionExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnActionExecuted(
+ this DiagnosticListener diagnosticListener,
+ ActionExecutedContext actionExecutedContext,
+ IActionFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnActionExecutedImpl(diagnosticListener, actionExecutedContext, filter);
+ }
+ }
+
+ private static void AfterOnActionExecutedImpl(DiagnosticListener diagnosticListener, ActionExecutedContext actionExecutedContext, IActionFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuted"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnActionExecuted",
+ new
+ {
+ actionDescriptor = actionExecutedContext.ActionDescriptor,
+ actionExecutedContext = actionExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeActionMethod(
+ this DiagnosticListener diagnosticListener,
+ ActionContext actionContext,
+ IDictionary actionArguments,
+ object controller)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionContext != null);
+ Debug.Assert(actionArguments != null);
+ Debug.Assert(controller != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeActionMethodImpl(diagnosticListener, actionContext, actionArguments, controller);
+ }
+ }
+
+ private static void BeforeActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IDictionary actionArguments, object controller)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionMethod"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeActionMethod",
+ new
+ {
+ actionContext = actionContext,
+ arguments = actionArguments,
+ controller = controller
+ });
+ }
+ }
+
+ public static void AfterActionMethod(
+ this DiagnosticListener diagnosticListener,
+ ActionContext actionContext,
+ IDictionary actionArguments,
+ object controller,
+ IActionResult result)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionContext != null);
+ Debug.Assert(actionArguments != null);
+ Debug.Assert(controller != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterActionMethodImpl(diagnosticListener, actionContext, actionArguments, controller, result);
+ }
+ }
+
+ private static void AfterActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IDictionary actionArguments, object controller, IActionResult result)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionMethod"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterActionMethod",
+ new
+ {
+ actionContext = actionContext,
+ arguments = actionArguments,
+ controller = controller,
+ result = result
+ });
+ }
+ }
+
+ public static void BeforeOnResultExecution(
+ this DiagnosticListener diagnosticListener,
+ ResultExecutingContext resultExecutingContext,
+ IAsyncResultFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resultExecutingContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnResultExecutionImpl(diagnosticListener, resultExecutingContext, filter);
+ }
+ }
+
+ private static void BeforeOnResultExecutionImpl(DiagnosticListener diagnosticListener, ResultExecutingContext resultExecutingContext, IAsyncResultFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecution"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnResultExecution",
+ new
+ {
+ actionDescriptor = resultExecutingContext.ActionDescriptor,
+ resultExecutingContext = resultExecutingContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnResultExecution(
+ this DiagnosticListener diagnosticListener,
+ ResultExecutedContext resultExecutedContext,
+ IAsyncResultFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resultExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnResultExecutionImpl(diagnosticListener, resultExecutedContext, filter);
+ }
+ }
+
+ private static void AfterOnResultExecutionImpl(DiagnosticListener diagnosticListener, ResultExecutedContext resultExecutedContext, IAsyncResultFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecution"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnResultExecution",
+ new
+ {
+ actionDescriptor = resultExecutedContext.ActionDescriptor,
+ resultExecutedContext = resultExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnResultExecuting(
+ this DiagnosticListener diagnosticListener,
+ ResultExecutingContext resultExecutingContext,
+ IResultFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resultExecutingContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnResultExecutingImpl(diagnosticListener, resultExecutingContext, filter);
+ }
+ }
+
+ private static void BeforeOnResultExecutingImpl(DiagnosticListener diagnosticListener, ResultExecutingContext resultExecutingContext, IResultFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting",
+ new
+ {
+ actionDescriptor = resultExecutingContext.ActionDescriptor,
+ resultExecutingContext = resultExecutingContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnResultExecuting(
+ this DiagnosticListener diagnosticListener,
+ ResultExecutingContext resultExecutingContext,
+ IResultFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resultExecutingContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnResultExecutingImpl(diagnosticListener, resultExecutingContext, filter);
+ }
+ }
+
+ private static void AfterOnResultExecutingImpl(DiagnosticListener diagnosticListener, ResultExecutingContext resultExecutingContext, IResultFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuting"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnResultExecuting",
+ new
+ {
+ actionDescriptor = resultExecutingContext.ActionDescriptor,
+ resultExecutingContext = resultExecutingContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnResultExecuted(
+ this DiagnosticListener diagnosticListener,
+ ResultExecutedContext resultExecutedContext,
+ IResultFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resultExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnResultExecutedImpl(diagnosticListener, resultExecutedContext, filter);
+ }
+ }
+
+ private static void BeforeOnResultExecutedImpl(DiagnosticListener diagnosticListener, ResultExecutedContext resultExecutedContext, IResultFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted",
+ new
+ {
+ actionDescriptor = resultExecutedContext.ActionDescriptor,
+ resultExecutedContext = resultExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnResultExecuted(
+ this DiagnosticListener diagnosticListener,
+ ResultExecutedContext resultExecutedContext,
+ IResultFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(resultExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnResultExecutedImpl(diagnosticListener, resultExecutedContext, filter);
+ }
+ }
+
+ private static void AfterOnResultExecutedImpl(DiagnosticListener diagnosticListener, ResultExecutedContext resultExecutedContext, IResultFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuted"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnResultExecuted",
+ new
+ {
+ actionDescriptor = resultExecutedContext.ActionDescriptor,
+ resultExecutedContext = resultExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeActionResult(
+ this DiagnosticListener diagnosticListener,
+ ActionContext actionContext,
+ IActionResult result)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionContext != null);
+ Debug.Assert(result != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeActionResultImpl(diagnosticListener, actionContext, result);
+ }
+ }
+
+ private static void BeforeActionResultImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IActionResult result)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionResult"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeActionResult",
+ new { actionContext = actionContext, result = result });
+ }
+ }
+
+ public static void AfterActionResult(
+ this DiagnosticListener diagnosticListener,
+ ActionContext actionContext,
+ IActionResult result)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionContext != null);
+ Debug.Assert(result != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterActionResultImpl(diagnosticListener, actionContext, result);
+ }
+ }
+
+ private static void AfterActionResultImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IActionResult result)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionResult"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterActionResult",
+ new { actionContext = actionContext, result = result });
+ }
+ }
+ }
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreLoggerExtensions.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreLoggerExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreLoggerExtensions.cs
index b4a223b8b2..e731b3be50 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreLoggerExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreLoggerExtensions.cs
@@ -15,14 +15,13 @@ using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Formatters;
-using Microsoft.AspNetCore.Mvc.Formatters.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc
{
internal static class MvcCoreLoggerExtensions
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/PhysicalFileResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/PhysicalFileResult.cs
index c83dc1442a..27a02b4d94 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/PhysicalFileResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/PhysicalFileResult.cs
@@ -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;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ProducesAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ProducesAttribute.cs
index e9346f7330..41d1815bd9 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ProducesAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ProducesAttribute.cs
@@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Formatters;
-using Microsoft.AspNetCore.Mvc.Formatters.Internal;
using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Mvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectResult.cs
index 6aae329d12..4fcd46a1d1 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectResult.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.Extensions.DependencyInjection;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToActionResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToActionResult.cs
index 7e48ac38c3..06de942c13 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToActionResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToActionResult.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Routing;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToPageResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToPageResult.cs
index 4728a4a08c..5f82cd50df 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToPageResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToPageResult.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Routing;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToRouteResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToRouteResult.cs
index 500d8f3d2f..8966eab50e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToRouteResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RedirectToRouteResult.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Routing;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RequestFormLimitsAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RequestFormLimitsAttribute.cs
index d1f1c73578..0681091231 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RequestFormLimitsAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RequestFormLimitsAttribute.cs
@@ -6,7 +6,6 @@ using System.IO;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RequestSizeLimitAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RequestSizeLimitAttribute.cs
index 95063ff857..a9a6098f65 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RequestSizeLimitAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/RequestSizeLimitAttribute.cs
@@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ResponseCacheAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ResponseCacheAttribute.cs
index a3e2d6aaf4..a647be106f 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ResponseCacheAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ResponseCacheAttribute.cs
@@ -4,7 +4,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/ActionConstraintMatcherPolicy.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/ActionConstraintMatcherPolicy.cs
index d31e06daf4..f71c3294e3 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/ActionConstraintMatcherPolicy.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/ActionConstraintMatcherPolicy.cs
@@ -8,7 +8,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Matching;
@@ -68,7 +67,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
{
// This one is OK, we implement this in endpoint routing.
}
- else if (actionConstraint.GetType().FullName == "Microsoft.AspNetCore.Mvc.Cors.Internal.CorsHttpMethodActionConstraint")
+ else if (actionConstraint.GetType().FullName == "Microsoft.AspNetCore.Mvc.Cors.CorsHttpMethodActionConstraint")
{
// This one is OK, we implement this in endpoint routing.
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AttributeRoute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/AttributeRoute.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AttributeRoute.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/AttributeRoute.cs
index 9d307e7e23..da0fc4594e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AttributeRoute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/AttributeRoute.cs
@@ -14,9 +14,9 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Internal;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
- public class AttributeRoute : IRouter
+ internal class AttributeRoute : IRouter
{
private readonly IActionDescriptorCollectionProvider _actionDescriptorCollectionProvider;
private readonly IServiceProvider _services;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AttributeRouting.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/AttributeRouting.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AttributeRouting.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/AttributeRouting.cs
index e5bf2d5ec4..66804ba63a 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/AttributeRouting.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/AttributeRouting.cs
@@ -6,9 +6,9 @@ using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
- public static class AttributeRouting
+ internal static class AttributeRouting
{
///
/// Creates an attribute route using the provided services and provided target router.
@@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
return new AttributeRoute(
services.GetRequiredService(),
services,
- actions =>
+ actions =>
{
var handler = services.GetRequiredService();
handler.Actions = actions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcAttributeRouteHandler.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcAttributeRouteHandler.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcAttributeRouteHandler.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcAttributeRouteHandler.cs
index c40318e2d9..f32032f760 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcAttributeRouteHandler.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcAttributeRouteHandler.cs
@@ -10,29 +10,29 @@ using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Logging;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
- public class MvcAttributeRouteHandler : IRouter
+ internal class MvcAttributeRouteHandler : IRouter
{
private readonly IActionContextAccessor _actionContextAccessor;
private readonly IActionInvokerFactory _actionInvokerFactory;
private readonly IActionSelector _actionSelector;
private readonly ILogger _logger;
- private DiagnosticSource _diagnosticSource;
+ private DiagnosticListener _diagnosticListener;
public MvcAttributeRouteHandler(
IActionInvokerFactory actionInvokerFactory,
IActionSelector actionSelector,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
ILoggerFactory loggerFactory)
- : this(actionInvokerFactory, actionSelector, diagnosticSource, loggerFactory, actionContextAccessor: null)
+ : this(actionInvokerFactory, actionSelector, diagnosticListener, loggerFactory, actionContextAccessor: null)
{
}
public MvcAttributeRouteHandler(
IActionInvokerFactory actionInvokerFactory,
IActionSelector actionSelector,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
ILoggerFactory loggerFactory,
IActionContextAccessor actionContextAccessor)
{
@@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
_actionInvokerFactory = actionInvokerFactory;
_actionSelector = actionSelector;
- _diagnosticSource = diagnosticSource;
+ _diagnosticListener = diagnosticListener;
_logger = loggerFactory.CreateLogger();
}
@@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
if (Actions == null)
{
var message = Resources.FormatPropertyOfTypeCannotBeNull(
- nameof(Actions),
+ nameof(Actions),
nameof(MvcAttributeRouteHandler));
throw new InvalidOperationException(message);
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcEndpointDataSource.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcEndpointDataSource.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcEndpointDataSource.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcEndpointDataSource.cs
index df110bee25..53e37a4595 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcEndpointDataSource.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcEndpointDataSource.cs
@@ -10,13 +10,15 @@ using System.Threading;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
+using Microsoft.AspNetCore.Mvc.ActionConstraints;
+using Microsoft.AspNetCore.Mvc.Controllers;
+using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.Extensions.Primitives;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
internal class MvcEndpointDataSource : EndpointDataSource
{
@@ -57,6 +59,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
_parameterPolicyFactory = parameterPolicyFactory;
ConventionalEndpointInfos = new List();
+ AttributeRoutingConventionResolvers = new List>();
// IMPORTANT: this needs to be the last thing we do in the constructor. Change notifications can happen immediately!
//
@@ -72,6 +75,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
public List ConventionalEndpointInfos { get; }
+ public List> AttributeRoutingConventionResolvers { get; }
+
public override IReadOnlyList Endpoints
{
get
@@ -164,11 +169,20 @@ namespace Microsoft.AspNetCore.Mvc.Internal
endpointInfo.DataTokens,
endpointInfo.ParameterPolicies,
suppressLinkGeneration: false,
- suppressPathMatching: false);
+ suppressPathMatching: false,
+ endpointInfo.Conventions);
}
}
else
{
+ var conventionBuilder = ResolveActionConventionBuilder(action);
+ if (conventionBuilder == null)
+ {
+ // No convention builder for this action
+ // Do not create an endpoint for it
+ continue;
+ }
+
var attributeRoutePattern = RoutePatternFactory.Parse(action.AttributeRouteInfo.Template);
CreateEndpoints(
@@ -183,7 +197,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
dataTokens: null,
allParameterPolicies: null,
action.AttributeRouteInfo.SuppressLinkGeneration,
- action.AttributeRouteInfo.SuppressPathMatching);
+ action.AttributeRouteInfo.SuppressPathMatching,
+ conventionBuilder.Conventions);
}
}
@@ -205,6 +220,20 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
+ private DefaultEndpointConventionBuilder ResolveActionConventionBuilder(ActionDescriptor action)
+ {
+ foreach (var filter in AttributeRoutingConventionResolvers)
+ {
+ var conventionBuilder = filter(action);
+ if (conventionBuilder != null)
+ {
+ return conventionBuilder;
+ }
+ }
+
+ return null;
+ }
+
// CreateEndpoints processes the route pattern, replacing area/controller/action parameters with endpoint values
// Because of default values it is possible for a route pattern to resolve to multiple endpoints
private int CreateEndpoints(
@@ -219,7 +248,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
RouteValueDictionary dataTokens,
IDictionary> allParameterPolicies,
bool suppressLinkGeneration,
- bool suppressPathMatching)
+ bool suppressPathMatching,
+ List> conventions)
{
var newPathSegments = routePattern.PathSegments.ToList();
var hasLinkGenerationEndpoint = false;
@@ -264,7 +294,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
routeOrder++,
dataTokens,
suppressLinkGeneration,
- true);
+ true,
+ conventions);
endpoints.Add(ep);
hasLinkGenerationEndpoint = true;
@@ -282,7 +313,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
routeOrder++,
dataTokens,
suppressLinkGeneration,
- suppressPathMatching);
+ suppressPathMatching,
+ conventions);
endpoints.Add(subEndpoint);
}
@@ -299,7 +331,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
routeOrder++,
dataTokens,
suppressLinkGeneration,
- suppressPathMatching);
+ suppressPathMatching,
+ conventions);
endpoints.Add(finalEndpoint);
return routeOrder;
@@ -406,6 +439,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
{
newPathSegments[i] = RoutePatternFactory.Segment(segmentParts);
}
+
}
private bool UseDefaultValuePlusRemainingSegmentsOptional(
@@ -536,7 +570,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
int order,
RouteValueDictionary dataTokens,
bool suppressLinkGeneration,
- bool suppressPathMatching)
+ bool suppressPathMatching,
+ List> conventions)
{
RequestDelegate requestDelegate = (context) =>
{
@@ -551,7 +586,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var defaults = new RouteValueDictionary(nonInlineDefaults);
EnsureRequiredValuesInDefaults(actionRouteValues, defaults, segments);
- var metadataCollection = BuildEndpointMetadata(
+ var model = new RouteEndpointModel(requestDelegate, RoutePatternFactory.Pattern(patternRawText, defaults, parameterPolicies: null, segments), order);
+
+ AddEndpointMetadata(
+ model.Metadata,
action,
routeName,
new RouteValueDictionary(actionRouteValues),
@@ -559,17 +597,23 @@ namespace Microsoft.AspNetCore.Mvc.Internal
suppressLinkGeneration,
suppressPathMatching);
- var endpoint = new RouteEndpoint(
- requestDelegate,
- RoutePatternFactory.Pattern(patternRawText, defaults, parameterPolicies: null, segments),
- order,
- metadataCollection,
- action.DisplayName);
+ model.DisplayName = action.DisplayName;
- return endpoint;
+ // REVIEW: When should conventions be run
+ // Metadata should have lower precedence that data source metadata
+ if (conventions != null)
+ {
+ foreach (var convention in conventions)
+ {
+ convention(model);
+ }
+ }
+
+ return (RouteEndpoint)model.Build();
}
- private static EndpointMetadataCollection BuildEndpointMetadata(
+ private static void AddEndpointMetadata(
+ IList metadata,
ActionDescriptor action,
string routeName,
RouteValueDictionary requiredValues,
@@ -577,12 +621,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
bool suppressLinkGeneration,
bool suppressPathMatching)
{
- var metadata = new List();
-
// Add action metadata first so it has a low precedence
if (action.EndpointMetadata != null)
{
- metadata.AddRange(action.EndpointMetadata);
+ foreach (var d in action.EndpointMetadata)
+ {
+ metadata.Add(d);
+ }
}
metadata.Add(action);
@@ -597,8 +642,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
// Add filter descriptors to endpoint metadata
if (action.FilterDescriptors != null && action.FilterDescriptors.Count > 0)
{
- metadata.AddRange(action.FilterDescriptors.OrderBy(f => f, FilterDescriptorOrderComparer.Comparer)
- .Select(f => f.Filter));
+ foreach (var filter in action.FilterDescriptors.OrderBy(f => f, FilterDescriptorOrderComparer.Comparer).Select(f => f.Filter))
+ {
+ metadata.Add(filter);
+ }
}
if (action.ActionConstraints != null && action.ActionConstraints.Count > 0)
@@ -637,9 +684,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
{
metadata.Add(new SuppressMatchingMetadata());
}
-
- var metadataCollection = new EndpointMetadataCollection(metadata);
- return metadataCollection;
}
// Ensure route values are a subset of defaults
@@ -670,4 +714,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcEndpointInvokerFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcEndpointInvokerFactory.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcEndpointInvokerFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcEndpointInvokerFactory.cs
index 3737a3b718..f0d608b168 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcEndpointInvokerFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcEndpointInvokerFactory.cs
@@ -4,7 +4,7 @@
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
internal sealed class MvcEndpointInvokerFactory : IActionInvokerFactory
{
@@ -38,4 +38,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
return _invokerFactory.CreateInvoker(actionContext);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcRouteHandler.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcRouteHandler.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcRouteHandler.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcRouteHandler.cs
index 21903703fa..3d7e1add1e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcRouteHandler.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcRouteHandler.cs
@@ -9,29 +9,29 @@ using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
- public class MvcRouteHandler : IRouter
+ internal class MvcRouteHandler : IRouter
{
private readonly IActionContextAccessor _actionContextAccessor;
private readonly IActionInvokerFactory _actionInvokerFactory;
private readonly IActionSelector _actionSelector;
private readonly ILogger _logger;
- private readonly DiagnosticSource _diagnosticSource;
+ private readonly DiagnosticListener _diagnosticListener;
public MvcRouteHandler(
IActionInvokerFactory actionInvokerFactory,
IActionSelector actionSelector,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
ILoggerFactory loggerFactory)
- : this(actionInvokerFactory, actionSelector, diagnosticSource, loggerFactory, actionContextAccessor: null)
+ : this(actionInvokerFactory, actionSelector, diagnosticListener, loggerFactory, actionContextAccessor: null)
{
}
public MvcRouteHandler(
IActionInvokerFactory actionInvokerFactory,
IActionSelector actionSelector,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
ILoggerFactory loggerFactory,
IActionContextAccessor actionContextAccessor)
{
@@ -41,7 +41,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
_actionInvokerFactory = actionInvokerFactory;
_actionSelector = actionSelector;
- _diagnosticSource = diagnosticSource;
+ _diagnosticListener = diagnosticListener;
_logger = loggerFactory.CreateLogger();
}
@@ -101,4 +101,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
return Task.CompletedTask;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NormalizedRouteValue.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/NormalizedRouteValue.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NormalizedRouteValue.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/NormalizedRouteValue.cs
index 3013ee3171..9258332d0b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NormalizedRouteValue.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/NormalizedRouteValue.cs
@@ -4,9 +4,9 @@
using System;
using System.Globalization;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
- public static class NormalizedRouteValue
+ internal static class NormalizedRouteValue
{
///
/// Gets the case-normalized route value for the specified route .
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NullRouter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/NullRouter.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NullRouter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/NullRouter.cs
index c1b800c5bd..f359bd1841 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/NullRouter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/NullRouter.cs
@@ -4,7 +4,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Routing;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
internal class NullRouter : IRouter
{
@@ -24,4 +24,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
return Task.CompletedTask;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/RoutePatternWriter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/RoutePatternWriter.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/RoutePatternWriter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/RoutePatternWriter.cs
index 3f0e0f6445..5f0e15b376 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/RoutePatternWriter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/RoutePatternWriter.cs
@@ -3,11 +3,10 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Routing.Patterns;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
internal static class RoutePatternWriter
{
@@ -76,4 +75,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/UrlHelperBase.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/UrlHelperBase.cs
index 8e84b081b3..2cea4a9fc7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/UrlHelperBase.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/UrlHelperBase.cs
@@ -8,7 +8,6 @@ using System.Globalization;
using System.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
namespace Microsoft.AspNetCore.Mvc.Routing
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ViewEnginePath.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/ViewEnginePath.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ViewEnginePath.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/ViewEnginePath.cs
index 29d4f85597..f24bdf7eca 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Internal/ViewEnginePath.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/Routing/ViewEnginePath.cs
@@ -7,9 +7,9 @@ using System.Diagnostics;
using System.Text;
using Microsoft.Extensions.Primitives;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
- public static class ViewEnginePath
+ internal static class ViewEnginePath
{
public static readonly char[] PathSeparators = new[] { '/', '\\' };
private const string CurrentDirectoryToken = ".";
@@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
string result;
-
+
// Get directory name (including final slash) but do not use Path.GetDirectoryName() to preserve path
// normalization.
var index = first.LastIndexOf('/');
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/SignInResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/SignInResult.cs
index 040bbe040d..d7bdfd3867 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/SignInResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/SignInResult.cs
@@ -6,7 +6,6 @@ using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/SignOutResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/SignOutResult.cs
index f972b9475c..0f69354784 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/SignOutResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/SignOutResult.cs
@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc.Core;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/StatusCodeResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/StatusCodeResult.cs
index 70de9cdafe..2f367817bd 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/StatusCodeResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/StatusCodeResult.cs
@@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/VirtualFileResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/VirtualFileResult.cs
index 2e37c94a89..b7743795a0 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/VirtualFileResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/VirtualFileResult.cs
@@ -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.Extensions.FileProviders;
using Microsoft.Net.Http.Headers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json
index 3fd0e6ddff..88e1b38758 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json
@@ -2,5 +2,75 @@
{
"TypeId": "public class Microsoft.AspNetCore.Mvc.ApiControllerAttribute : Microsoft.AspNetCore.Mvc.ControllerAttribute, Microsoft.AspNetCore.Mvc.Internal.IApiBehaviorMetadata",
"Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ConsumesAttribute : System.Attribute, Microsoft.AspNetCore.Mvc.Filters.IResourceFilter, Microsoft.AspNetCore.Mvc.Internal.IConsumesActionConstraint, Microsoft.AspNetCore.Mvc.ApiExplorer.IApiRequestMetadataProvider",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider : Microsoft.AspNetCore.Mvc.Controllers.IControllerFactoryProvider",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerActivator : Microsoft.AspNetCore.Mvc.Controllers.IControllerActivator",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerFactory : Microsoft.AspNetCore.Mvc.Controllers.IControllerFactory",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Formatters.FormatFilter : Microsoft.AspNetCore.Mvc.Formatters.Internal.IFormatFilter, Microsoft.AspNetCore.Mvc.Filters.IResourceFilter, Microsoft.AspNetCore.Mvc.Filters.IResultFilter",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.FormValueProvider : Microsoft.AspNetCore.Mvc.ModelBinding.BindingSourceValueProvider, Microsoft.AspNetCore.Mvc.ModelBinding.IEnumerableValueProvider",
+ "MemberId": "protected Microsoft.AspNetCore.Mvc.Internal.PrefixContainer get_PrefixContainer()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public abstract class Microsoft.AspNetCore.Mvc.ModelBinding.JQueryValueProvider : Microsoft.AspNetCore.Mvc.ModelBinding.BindingSourceValueProvider, Microsoft.AspNetCore.Mvc.ModelBinding.IEnumerableValueProvider, Microsoft.AspNetCore.Mvc.ModelBinding.IKeyRewriterValueProvider",
+ "MemberId": "protected Microsoft.AspNetCore.Mvc.Internal.PrefixContainer get_PrefixContainer()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.QueryStringValueProvider : Microsoft.AspNetCore.Mvc.ModelBinding.BindingSourceValueProvider, Microsoft.AspNetCore.Mvc.ModelBinding.IEnumerableValueProvider",
+ "MemberId": "protected Microsoft.AspNetCore.Mvc.Internal.PrefixContainer get_PrefixContainer()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.RouteValueProvider : Microsoft.AspNetCore.Mvc.ModelBinding.BindingSourceValueProvider",
+ "MemberId": "protected Microsoft.AspNetCore.Mvc.Internal.PrefixContainer get_PrefixContainer()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor",
+ "MemberId": "protected Microsoft.AspNetCore.Mvc.Internal.ValidatorCache get_Cache()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor",
+ "MemberId": "protected Microsoft.AspNetCore.Mvc.ModelBinding.Internal.ValidationStack get_CurrentPath()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor",
+ "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.ActionContext actionContext, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IModelValidatorProvider validatorProvider, Microsoft.AspNetCore.Mvc.Internal.ValidatorCache validatorCache, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary validationState)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public abstract class Microsoft.AspNetCore.Mvc.ModelBinding.ObjectModelValidator : Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IObjectModelValidator",
+ "MemberId": "public abstract Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor GetValidationVisitor(Microsoft.AspNetCore.Mvc.ActionContext actionContext, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IModelValidatorProvider validatorProvider, Microsoft.AspNetCore.Mvc.Internal.ValidatorCache validatorCache, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary validationState)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public struct Microsoft.AspNetCore.Mvc.Formatters.MediaType",
+ "MemberId": "public static Microsoft.AspNetCore.Mvc.Formatters.Internal.MediaTypeSegmentWithQuality CreateMediaTypeSegmentWithQuality(System.String mediaType, System.Int32 start)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public abstract class Microsoft.AspNetCore.Mvc.ModelBinding.ObjectModelValidator : Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IObjectModelValidator",
+ "MemberId": "public abstract Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor GetValidationVisitor(Microsoft.AspNetCore.Mvc.ActionContext actionContext, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IModelValidatorProvider validatorProvider, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidatorCache validatorCache, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary validationState)",
+ "Kind": "Addition"
}
]
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsApplicationModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsApplicationModelProvider.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsApplicationModelProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsApplicationModelProvider.cs
index 352a8b4ee6..5afd4e6385 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsApplicationModelProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsApplicationModelProvider.cs
@@ -4,13 +4,13 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Cors.Infrastructure;
+using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
-namespace Microsoft.AspNetCore.Mvc.Cors.Internal
+namespace Microsoft.AspNetCore.Mvc.Cors
{
- public class CorsApplicationModelProvider : IApplicationModelProvider
+ internal class CorsApplicationModelProvider : IApplicationModelProvider
{
public int Order => -1000 + 10;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsAuthorizationFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsAuthorizationFilter.cs
index 0d853eae9d..d4b374849d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsAuthorizationFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsAuthorizationFilter.cs
@@ -5,7 +5,6 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Cors.Infrastructure;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Cors.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Primitives;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsAuthorizationFilterFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsAuthorizationFilterFactory.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsAuthorizationFilterFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsAuthorizationFilterFactory.cs
index 9cb7146f5c..517a85aea1 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsAuthorizationFilterFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsAuthorizationFilterFactory.cs
@@ -5,12 +5,12 @@ using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
-namespace Microsoft.AspNetCore.Mvc.Cors.Internal
+namespace Microsoft.AspNetCore.Mvc.Cors
{
///
/// A filter factory which creates a new instance of .
///
- public class CorsAuthorizationFilterFactory : IFilterFactory, IOrderedFilter
+ internal class CorsAuthorizationFilterFactory : IFilterFactory, IOrderedFilter
{
private readonly string _policyName;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsHttpMethodActionConstraint.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsHttpMethodActionConstraint.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsHttpMethodActionConstraint.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsHttpMethodActionConstraint.cs
index de3ff06468..d909180ac2 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsHttpMethodActionConstraint.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsHttpMethodActionConstraint.cs
@@ -2,16 +2,14 @@
// 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.Collections.ObjectModel;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.Extensions.Primitives;
-using Microsoft.AspNetCore.Mvc.Internal;
-namespace Microsoft.AspNetCore.Mvc.Cors.Internal
+namespace Microsoft.AspNetCore.Mvc.Cors
{
// Don't casually change the name of this. We reference the full type name in ActionConstraintCache.
- public class CorsHttpMethodActionConstraint : HttpMethodActionConstraint
+ internal class CorsHttpMethodActionConstraint : HttpMethodActionConstraint
{
private readonly string OriginHeader = "Origin";
private readonly string AccessControlRequestMethod = "Access-Control-Request-Method";
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsLoggerExtensions.cs
similarity index 89%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsLoggerExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsLoggerExtensions.cs
index c3fab172b9..8bc4af91f4 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/CorsLoggerExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsLoggerExtensions.cs
@@ -4,9 +4,9 @@
using System;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.Cors.Internal
+namespace Microsoft.AspNetCore.Mvc.Cors
{
- public static class CorsLoggerExtensions
+ internal static class CorsLoggerExtensions
{
private static readonly Action _notMostEffectiveFilter;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/DependencyInjection/MvcCorsMvcCoreBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/DependencyInjection/MvcCorsMvcCoreBuilderExtensions.cs
index a4cf5c1800..460a0cb4f9 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/DependencyInjection/MvcCorsMvcCoreBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/DependencyInjection/MvcCorsMvcCoreBuilderExtensions.cs
@@ -5,7 +5,6 @@ using System;
using Microsoft.AspNetCore.Cors.Infrastructure;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Cors;
-using Microsoft.AspNetCore.Mvc.Cors.Internal;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Microsoft.Extensions.DependencyInjection
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/DisableCorsAuthorizationFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/DisableCorsAuthorizationFilter.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/DisableCorsAuthorizationFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/DisableCorsAuthorizationFilter.cs
index 8ecd6cbfb6..183add11a9 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/DisableCorsAuthorizationFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/DisableCorsAuthorizationFilter.cs
@@ -8,12 +8,12 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Primitives;
-namespace Microsoft.AspNetCore.Mvc.Cors.Internal
+namespace Microsoft.AspNetCore.Mvc.Cors
{
///
/// An which ensures that an action does not run for a pre-flight request.
///
- public class DisableCorsAuthorizationFilter : ICorsAuthorizationFilter
+ internal class DisableCorsAuthorizationFilter : ICorsAuthorizationFilter
{
///
// Since clients' preflight requests would not have data to authenticate requests, this
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/ICorsAuthorizationFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/ICorsAuthorizationFilter.cs
similarity index 71%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/ICorsAuthorizationFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/ICorsAuthorizationFilter.cs
index 6989ffd421..483a70980d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Internal/ICorsAuthorizationFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/ICorsAuthorizationFilter.cs
@@ -3,12 +3,12 @@
using Microsoft.AspNetCore.Mvc.Filters;
-namespace Microsoft.AspNetCore.Mvc.Cors.Internal
+namespace Microsoft.AspNetCore.Mvc.Cors
{
///
/// A filter that can be used to enable/disable CORS support for a resource.
///
- public interface ICorsAuthorizationFilter : IAsyncAuthorizationFilter, IOrderedFilter
+ internal interface ICorsAuthorizationFilter : IAsyncAuthorizationFilter, IOrderedFilter
{
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Microsoft.AspNetCore.Mvc.Cors.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Microsoft.AspNetCore.Mvc.Cors.csproj
index 379eca0738..59ab59c696 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Microsoft.AspNetCore.Mvc.Cors.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Microsoft.AspNetCore.Mvc.Cors.csproj
@@ -2,7 +2,7 @@
ASP.NET Core MVC cross-origin resource sharing (CORS) features.
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc;cors
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Properties/AssemblyInfo.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Properties/AssemblyInfo.cs
index 19603aa2df..5a3d62d5ad 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Properties/AssemblyInfo.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/Properties/AssemblyInfo.cs
@@ -3,4 +3,6 @@
using System.Runtime.CompilerServices;
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Core.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Cors.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/breakingchanges.netcore.json b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/breakingchanges.netcore.json
new file mode 100644
index 0000000000..6c3a2d285c
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/breakingchanges.netcore.json
@@ -0,0 +1,6 @@
+[
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Cors.CorsAuthorizationFilter : Microsoft.AspNetCore.Mvc.Cors.Internal.ICorsAuthorizationFilter",
+ "Kind": "Removal"
+ }
+]
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/CompareAttributeAdapter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/CompareAttributeAdapter.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/CompareAttributeAdapter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/CompareAttributeAdapter.cs
index f64272fa04..43e60f89e5 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/CompareAttributeAdapter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/CompareAttributeAdapter.cs
@@ -8,9 +8,9 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
- public class CompareAttributeAdapter : AttributeAdapterBase
+ internal class CompareAttributeAdapter : AttributeAdapterBase
{
private readonly string _otherProperty;
@@ -105,4 +105,4 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsClientModelValidatorProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsClientModelValidatorProvider.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsClientModelValidatorProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsClientModelValidatorProvider.cs
index 05d2aacac3..946db2b755 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsClientModelValidatorProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsClientModelValidatorProvider.cs
@@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
///
/// An implementation of which provides client validators
@@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
/// The logic to support
/// is implemented in .
///
- public class DataAnnotationsClientModelValidatorProvider : IClientModelValidatorProvider
+ internal class DataAnnotationsClientModelValidatorProvider : IClientModelValidatorProvider
{
private readonly IOptions _options;
private readonly IStringLocalizerFactory _stringLocalizerFactory;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsLocalizationServices.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsLocalizationServices.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsLocalizationServices.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsLocalizationServices.cs
index 3ef1fde707..75c6a013fc 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsLocalizationServices.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsLocalizationServices.cs
@@ -6,9 +6,9 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
- public static class DataAnnotationsLocalizationServices
+ internal static class DataAnnotationsLocalizationServices
{
public static void AddDataAnnotationsLocalizationServices(
IServiceCollection services,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsMetadataProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsMetadataProvider.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsMetadataProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsMetadataProvider.cs
index d0a2875c5a..e94ee78153 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsMetadataProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsMetadataProvider.cs
@@ -12,13 +12,13 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
///
/// An implementation of and for
/// the System.ComponentModel.DataAnnotations attribute classes.
///
- public class DataAnnotationsMetadataProvider :
+ internal class DataAnnotationsMetadataProvider :
IBindingMetadataProvider,
IDisplayMetadataProvider,
IValidationMetadataProvider
@@ -388,4 +388,4 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
return string.Empty;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsModelValidator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsModelValidator.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsModelValidator.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsModelValidator.cs
index 563fa078a7..b70a7c4825 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsModelValidator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsModelValidator.cs
@@ -8,12 +8,12 @@ using System.Linq;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
///
/// Validates based on the given .
///
- public class DataAnnotationsModelValidator : IModelValidator
+ internal class DataAnnotationsModelValidator : IModelValidator
{
private static readonly object _emptyValidationContextInstance = new object();
private readonly IStringLocalizer _stringLocalizer;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsModelValidatorProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsModelValidatorProvider.cs
index b6266958c3..a0cd1c4d68 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsModelValidatorProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataAnnotationsModelValidatorProvider.cs
@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataTypeAttributeAdapter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataTypeAttributeAdapter.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataTypeAttributeAdapter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataTypeAttributeAdapter.cs
index b9bfa16165..0c6bf4e115 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataTypeAttributeAdapter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DataTypeAttributeAdapter.cs
@@ -6,13 +6,13 @@ using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
///
/// A validation adapter that is used to map 's to a single client side validation
/// rule.
///
- public class DataTypeAttributeAdapter : AttributeAdapterBase
+ internal class DataTypeAttributeAdapter : AttributeAdapterBase
{
public DataTypeAttributeAdapter(DataTypeAttribute attribute, string ruleName, IStringLocalizer stringLocalizer)
: base(attribute, stringLocalizer)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DefaultClientModelValidatorProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DefaultClientModelValidatorProvider.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DefaultClientModelValidatorProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DefaultClientModelValidatorProvider.cs
index 2fb0fe4769..54a533a417 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DefaultClientModelValidatorProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DefaultClientModelValidatorProvider.cs
@@ -4,7 +4,7 @@
using System;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
///
/// A default implementation of .
@@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
/// The provides validators from
/// instances in .
///
- public class DefaultClientModelValidatorProvider : IClientModelValidatorProvider
+ internal class DefaultClientModelValidatorProvider : IClientModelValidatorProvider
{
///
public void CreateValidators(ClientValidatorProviderContext context)
@@ -42,4 +42,4 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/MvcDataAnnotationsLocalizationConfigureCompatibilityOptions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsLocalizationConfigureCompatibilityOptions.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/MvcDataAnnotationsLocalizationConfigureCompatibilityOptions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsLocalizationConfigureCompatibilityOptions.cs
index e3eab734b7..eb07025356 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/MvcDataAnnotationsLocalizationConfigureCompatibilityOptions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsLocalizationConfigureCompatibilityOptions.cs
@@ -2,11 +2,13 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.DataAnnotations;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations
+namespace Microsoft.Extensions.DependencyInjection
{
internal class MvcDataAnnotationsLocalizationConfigureCompatibilityOptions : ConfigureCompatibilityOptions
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MvcDataAnnotationsLocalizationOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsLocalizationOptionsSetup.cs
similarity index 77%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MvcDataAnnotationsLocalizationOptionsSetup.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsLocalizationOptionsSetup.cs
index e91f13b255..5410042c30 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MvcDataAnnotationsLocalizationOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsLocalizationOptionsSetup.cs
@@ -2,14 +2,15 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using Microsoft.AspNetCore.Mvc.DataAnnotations;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.Extensions.DependencyInjection
{
///
/// Sets up default options for .
///
- public class MvcDataAnnotationsLocalizationOptionsSetup : IConfigureOptions
+ internal class MvcDataAnnotationsLocalizationOptionsSetup : IConfigureOptions
{
///
public void Configure(MvcDataAnnotationsLocalizationOptions options)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsMvcBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsMvcBuilderExtensions.cs
index ddbd623b3e..8ed3212e8b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsMvcBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsMvcBuilderExtensions.cs
@@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
namespace Microsoft.Extensions.DependencyInjection
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsMvcCoreBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsMvcCoreBuilderExtensions.cs
index 160a73345e..76a9ae46bb 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsMvcCoreBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsMvcCoreBuilderExtensions.cs
@@ -4,7 +4,6 @@
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MvcDataAnnotationsMvcOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsMvcOptionsSetup.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MvcDataAnnotationsMvcOptionsSetup.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsMvcOptionsSetup.cs
index 1b94e5c157..f43d3cca66 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MvcDataAnnotationsMvcOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/DependencyInjection/MvcDataAnnotationsMvcOptionsSetup.cs
@@ -2,15 +2,17 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.DataAnnotations;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.Extensions.DependencyInjection
{
///
/// Sets up default options for .
///
- public class MvcDataAnnotationsMvcOptionsSetup : IConfigureOptions
+ internal class MvcDataAnnotationsMvcOptionsSetup : IConfigureOptions
{
private readonly IStringLocalizerFactory _stringLocalizerFactory;
private readonly IValidationAttributeAdapterProvider _validationAttributeAdapterProvider;
@@ -60,4 +62,4 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
_stringLocalizerFactory));
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/FileExtensionsAttributeAdapter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/FileExtensionsAttributeAdapter.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/FileExtensionsAttributeAdapter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/FileExtensionsAttributeAdapter.cs
index 827188f769..c7f62c67ad 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/FileExtensionsAttributeAdapter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/FileExtensionsAttributeAdapter.cs
@@ -7,9 +7,9 @@ using System.Linq;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
- public class FileExtensionsAttributeAdapter : AttributeAdapterBase
+ internal class FileExtensionsAttributeAdapter : AttributeAdapterBase
{
private readonly string _extensions;
private readonly string _formattedExtensions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MaxLengthAttributeAdapter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/MaxLengthAttributeAdapter.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MaxLengthAttributeAdapter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/MaxLengthAttributeAdapter.cs
index 3a1a2cf9e9..e07e1165af 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MaxLengthAttributeAdapter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/MaxLengthAttributeAdapter.cs
@@ -7,9 +7,9 @@ using System.Globalization;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
- public class MaxLengthAttributeAdapter : AttributeAdapterBase
+ internal class MaxLengthAttributeAdapter : AttributeAdapterBase
{
private readonly string _max;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Microsoft.AspNetCore.Mvc.DataAnnotations.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Microsoft.AspNetCore.Mvc.DataAnnotations.csproj
index 33df42b291..a1e363328f 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Microsoft.AspNetCore.Mvc.DataAnnotations.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Microsoft.AspNetCore.Mvc.DataAnnotations.csproj
@@ -2,7 +2,7 @@
ASP.NET Core MVC metadata and validation system using System.ComponentModel.DataAnnotations.
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MinLengthAttributeAdapter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/MinLengthAttributeAdapter.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MinLengthAttributeAdapter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/MinLengthAttributeAdapter.cs
index 8d713b823c..488e17d59b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/MinLengthAttributeAdapter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/MinLengthAttributeAdapter.cs
@@ -7,9 +7,9 @@ using System.Globalization;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
- public class MinLengthAttributeAdapter : AttributeAdapterBase
+ internal class MinLengthAttributeAdapter : AttributeAdapterBase
{
private readonly string _min;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/NumericClientModelValidator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/NumericClientModelValidator.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/NumericClientModelValidator.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/NumericClientModelValidator.cs
index edc0286909..f9fc45d470 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/NumericClientModelValidator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/NumericClientModelValidator.cs
@@ -6,13 +6,13 @@ using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
///
/// An implementation of that provides the rule for validating
/// numeric types.
///
- public class NumericClientModelValidator : IClientModelValidator
+ internal class NumericClientModelValidator : IClientModelValidator
{
///
public void AddValidation(ClientModelValidationContext context)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/NumericClientModelValidatorProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/NumericClientModelValidatorProvider.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/NumericClientModelValidatorProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/NumericClientModelValidatorProvider.cs
index a2e182d381..20c1cf086a 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/NumericClientModelValidatorProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/NumericClientModelValidatorProvider.cs
@@ -4,13 +4,13 @@
using System;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
///
/// An implementation of which provides client validators
/// for specific numeric types.
///
- public class NumericClientModelValidatorProvider : IClientModelValidatorProvider
+ internal class NumericClientModelValidatorProvider : IClientModelValidatorProvider
{
///
public void CreateValidators(ClientValidatorProviderContext context)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Properties/AssemblyInfo.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Properties/AssemblyInfo.cs
index a0584f4754..06956dcef0 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Properties/AssemblyInfo.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Properties/AssemblyInfo.cs
@@ -3,10 +3,13 @@
using System.Runtime.CompilerServices;
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.ViewFeatures, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.DataAnnotations.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Core.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Core.TestCommon, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.ViewFeatures.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Performance, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/RangeAttributeAdapter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/RangeAttributeAdapter.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/RangeAttributeAdapter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/RangeAttributeAdapter.cs
index 345e6cc3b9..692dc900d0 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/RangeAttributeAdapter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/RangeAttributeAdapter.cs
@@ -7,9 +7,9 @@ using System.Globalization;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
- public class RangeAttributeAdapter : AttributeAdapterBase
+ internal class RangeAttributeAdapter : AttributeAdapterBase
{
private readonly string _max;
private readonly string _min;
@@ -56,4 +56,4 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
Attribute.Maximum);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/RegularExpressionAttributeAdapter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/RegularExpressionAttributeAdapter.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/RegularExpressionAttributeAdapter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/RegularExpressionAttributeAdapter.cs
index 552c5dcad2..d0278580cc 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/RegularExpressionAttributeAdapter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/RegularExpressionAttributeAdapter.cs
@@ -6,9 +6,9 @@ using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
- public class RegularExpressionAttributeAdapter : AttributeAdapterBase
+ internal class RegularExpressionAttributeAdapter : AttributeAdapterBase
{
public RegularExpressionAttributeAdapter(RegularExpressionAttribute attribute, IStringLocalizer stringLocalizer)
: base(attribute, stringLocalizer)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/RequiredAttributeAdapter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/RequiredAttributeAdapter.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/RequiredAttributeAdapter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/RequiredAttributeAdapter.cs
index 90e33ab49e..e4f824ae30 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/RequiredAttributeAdapter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/RequiredAttributeAdapter.cs
@@ -6,9 +6,9 @@ using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
- public class RequiredAttributeAdapter : AttributeAdapterBase
+ internal class RequiredAttributeAdapter : AttributeAdapterBase
{
public RequiredAttributeAdapter(RequiredAttribute attribute, IStringLocalizer stringLocalizer)
: base(attribute, stringLocalizer)
@@ -37,4 +37,4 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
return GetErrorMessage(validationContext.ModelMetadata, validationContext.ModelMetadata.GetDisplayName());
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/StringLengthAttributeAdapter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/StringLengthAttributeAdapter.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/StringLengthAttributeAdapter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/StringLengthAttributeAdapter.cs
index f733d4470a..e1df7efab2 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/StringLengthAttributeAdapter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/StringLengthAttributeAdapter.cs
@@ -7,9 +7,9 @@ using System.Globalization;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
- public class StringLengthAttributeAdapter : AttributeAdapterBase
+ internal class StringLengthAttributeAdapter : AttributeAdapterBase
{
private readonly string _max;
private readonly string _min;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/ValidatableObjectAdapter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/ValidatableObjectAdapter.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/ValidatableObjectAdapter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/ValidatableObjectAdapter.cs
index 55a9ca23a1..022e637fb8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/ValidatableObjectAdapter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/ValidatableObjectAdapter.cs
@@ -7,9 +7,9 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
- public class ValidatableObjectAdapter : IModelValidator
+ internal class ValidatableObjectAdapter : IModelValidator
{
public IEnumerable Validate(ModelValidationContext context)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/ValidationAttributeAdapterProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/ValidationAttributeAdapterProvider.cs
index a16b405a5f..7ec543d39d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/ValidationAttributeAdapterProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/ValidationAttributeAdapterProvider.cs
@@ -3,7 +3,6 @@
using System;
using System.ComponentModel.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
using Microsoft.Extensions.Localization;
namespace Microsoft.AspNetCore.Mvc.DataAnnotations
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonMvcCoreBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonMvcCoreBuilderExtensions.cs
index accd9045eb..7314bb1df9 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonMvcCoreBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonMvcCoreBuilderExtensions.cs
@@ -4,8 +4,8 @@
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
+using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Formatters.Json;
-using Microsoft.AspNetCore.Mvc.Formatters.Json.Internal;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/MvcJsonMvcOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonMvcOptionsSetup.cs
similarity index 94%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/MvcJsonMvcOptionsSetup.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonMvcOptionsSetup.cs
index 33f2b51eac..bc2f044e92 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/MvcJsonMvcOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonMvcOptionsSetup.cs
@@ -4,19 +4,20 @@
using System;
using System.Buffers;
using Microsoft.AspNetCore.JsonPatch;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.ObjectPool;
using Microsoft.Extensions.Options;
-using Microsoft.Net.Http.Headers;
using Newtonsoft.Json.Linq;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
+namespace Microsoft.Extensions.DependencyInjection
{
///
/// Sets up JSON formatter options for .
///
- public class MvcJsonMvcOptionsSetup : IConfigureOptions
+ internal class MvcJsonMvcOptionsSetup : IConfigureOptions
{
private readonly ILoggerFactory _loggerFactory;
private readonly MvcJsonOptions _jsonOptions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonOptionsConfigureCompatibilityOptions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonOptionsConfigureCompatibilityOptions.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonOptionsConfigureCompatibilityOptions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonOptionsConfigureCompatibilityOptions.cs
index f33e6dc108..5fe4836b37 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonOptionsConfigureCompatibilityOptions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonOptionsConfigureCompatibilityOptions.cs
@@ -2,11 +2,12 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc
+namespace Microsoft.Extensions.DependencyInjection
{
internal class MvcJsonOptionsConfigureCompatibilityOptions : ConfigureCompatibilityOptions
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonOptionsExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonOptionsExtensions.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonOptionsExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonOptionsExtensions.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonArrayPool.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonArrayPool.cs
similarity index 88%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonArrayPool.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonArrayPool.cs
index 437f9bcf98..773dc82693 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonArrayPool.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonArrayPool.cs
@@ -5,9 +5,9 @@ using System;
using System.Buffers;
using Newtonsoft.Json;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
- public class JsonArrayPool : IArrayPool
+ internal class JsonArrayPool : IArrayPool
{
private readonly ArrayPool _inner;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonInputFormatter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonInputFormatter.cs
index cc21792d71..1d8cdaab45 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonInputFormatter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonInputFormatter.cs
@@ -10,7 +10,6 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Formatters.Json.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Logging;
@@ -262,32 +261,48 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
{
successful = false;
- // Handle path combinations such as "" + "Property", "Parent" + "Property", or "Parent" + "[12]".
- var key = eventArgs.ErrorContext.Path;
- if (!string.IsNullOrEmpty(context.ModelName))
+ // When ErrorContext.Path does not include ErrorContext.Member, add Member to form full path.
+ var path = eventArgs.ErrorContext.Path;
+ var member = eventArgs.ErrorContext.Member?.ToString();
+ var addMember = !string.IsNullOrEmpty(member);
+ if (addMember)
{
- if (string.IsNullOrEmpty(eventArgs.ErrorContext.Path))
+ // Path.Member case (path.Length < member.Length) needs no further checks.
+ if (path.Length == member.Length)
{
- key = context.ModelName;
+ // Add Member in Path.Memb case but not for Path.Path.
+ addMember = !string.Equals(path, member, StringComparison.Ordinal);
}
- else if (eventArgs.ErrorContext.Path[0] == '[')
+ else if (path.Length > member.Length)
{
- key = context.ModelName + eventArgs.ErrorContext.Path;
- }
- else
- {
- key = context.ModelName + "." + eventArgs.ErrorContext.Path;
+ // Finally, check whether Path already ends with Member.
+ if (member[0] == '[')
+ {
+ addMember = !path.EndsWith(member, StringComparison.Ordinal);
+ }
+ else
+ {
+ addMember = !path.EndsWith("." + member, StringComparison.Ordinal);
+ }
}
}
- var metadata = GetPathMetadata(context.Metadata, eventArgs.ErrorContext.Path);
- var modelStateException = WrapExceptionForModelState(eventArgs.ErrorContext.Error);
- context.ModelState.TryAddModelError(key, modelStateException, metadata);
+ if (addMember)
+ {
+ path = ModelNames.CreatePropertyModelName(path, member);
+ }
- _logger.JsonInputException(eventArgs.ErrorContext.Error);
+ // Handle path combinations such as ""+"Property", "Parent"+"Property", or "Parent"+"[12]".
+ var key = ModelNames.CreatePropertyModelName(context.ModelName, path);
exception = eventArgs.ErrorContext.Error;
+ var metadata = GetPathMetadata(context.Metadata, path);
+ var modelStateException = WrapExceptionForModelState(exception);
+ context.ModelState.TryAddModelError(key, modelStateException, metadata);
+
+ _logger.JsonInputException(exception);
+
// Error must always be marked as handled
// Failure to do so can cause the exception to be rethrown at every recursive level and
// overflow the stack for x64 CLR processes
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonOutputFormatter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonOutputFormatter.cs
index 744d558680..7dafe6fe94 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonOutputFormatter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonOutputFormatter.cs
@@ -7,7 +7,6 @@ using System.ComponentModel;
using System.IO;
using System.Text;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Formatters.Json.Internal;
using Newtonsoft.Json;
namespace Microsoft.AspNetCore.Mvc.Formatters
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonPatchInputFormatter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonPatchInputFormatter.cs
index 96549d44d5..9fd0a364b3 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonPatchInputFormatter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonPatchInputFormatter.cs
@@ -7,7 +7,6 @@ using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.JsonPatch;
-using Microsoft.AspNetCore.Mvc.Formatters.Json.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.ObjectPool;
using Newtonsoft.Json;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonResult.cs
index a4a576a83f..5abad92bff 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonResult.cs
@@ -3,7 +3,7 @@
using System;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Formatters.Json.Internal;
+using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonResultExecutor.cs
similarity index 80%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonResultExecutor.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonResultExecutor.cs
index 332d1bdc59..81f0f783d7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonResultExecutor.cs
@@ -6,24 +6,26 @@ using System.Buffers;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.Net.Http.Headers;
using Newtonsoft.Json;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
///
/// Executes a to write to the response.
///
- public class JsonResultExecutor
+ internal class JsonResultExecutor
{
private static readonly string DefaultContentType = new MediaTypeHeaderValue("application/json")
{
Encoding = Encoding.UTF8
}.ToString();
+ private readonly IHttpResponseStreamWriterFactory _writerFactory;
+ private readonly ILogger _logger;
+ private readonly MvcJsonOptions _options;
private readonly IArrayPool _charPool;
///
@@ -59,34 +61,19 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
throw new ArgumentNullException(nameof(charPool));
}
- WriterFactory = writerFactory;
- Logger = logger;
- Options = options.Value;
+ _writerFactory = writerFactory;
+ _logger = logger;
+ _options = options.Value;
_charPool = new JsonArrayPool(charPool);
}
- ///
- /// Gets the .
- ///
- protected ILogger Logger { get; }
-
- ///
- /// Gets the .
- ///
- protected MvcJsonOptions Options { get; }
-
- ///
- /// Gets the .
- ///
- protected IHttpResponseStreamWriterFactory WriterFactory { get; }
-
///
/// Executes the and writes the response.
///
/// The .
/// The .
/// A which will complete when writing has completed.
- public virtual async Task ExecuteAsync(ActionContext context, JsonResult result)
+ public async Task ExecuteAsync(ActionContext context, JsonResult result)
{
if (context == null)
{
@@ -114,10 +101,10 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
response.StatusCode = result.StatusCode.Value;
}
- var serializerSettings = result.SerializerSettings ?? Options.SerializerSettings;
+ var serializerSettings = result.SerializerSettings ?? _options.SerializerSettings;
- Logger.JsonResultExecuting(result.Value);
- using (var writer = WriterFactory.CreateWriter(response.Body, resolvedContentTypeEncoding))
+ _logger.JsonResultExecuting(result.Value);
+ using (var writer = _writerFactory.CreateWriter(response.Body, resolvedContentTypeEncoding))
{
using (var jsonWriter = new JsonTextWriter(writer))
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonSerializerObjectPolicy.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonSerializerObjectPolicy.cs
similarity index 88%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonSerializerObjectPolicy.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonSerializerObjectPolicy.cs
index 5cd0a0e3d6..4efc81abcc 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonSerializerObjectPolicy.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/JsonSerializerObjectPolicy.cs
@@ -4,12 +4,12 @@
using Microsoft.Extensions.ObjectPool;
using Newtonsoft.Json;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
///
/// for .
///
- public class JsonSerializerObjectPolicy : IPooledObjectPolicy
+ internal class JsonSerializerObjectPolicy : IPooledObjectPolicy
{
private readonly JsonSerializerSettings _serializerSettings;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/MediaTypeHeaderValues.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MediaTypeHeaderValues.cs
similarity index 89%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/MediaTypeHeaderValues.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MediaTypeHeaderValues.cs
index d9fb986507..ec791b15ef 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/MediaTypeHeaderValues.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MediaTypeHeaderValues.cs
@@ -3,9 +3,9 @@
using Microsoft.Net.Http.Headers;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
- internal class MediaTypeHeaderValues
+ internal static class MediaTypeHeaderValues
{
public static readonly MediaTypeHeaderValue ApplicationJson
= MediaTypeHeaderValue.Parse("application/json").CopyAsReadOnly();
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Microsoft.AspNetCore.Mvc.Formatters.Json.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Microsoft.AspNetCore.Mvc.Formatters.Json.csproj
index 45749b70ec..18fc52f7c7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Microsoft.AspNetCore.Mvc.Formatters.Json.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Microsoft.AspNetCore.Mvc.Formatters.Json.csproj
@@ -2,7 +2,7 @@
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc;json
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/MvcJsonLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonLoggerExtensions.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/MvcJsonLoggerExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonLoggerExtensions.cs
index c06d819865..c4f15f190a 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/MvcJsonLoggerExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonLoggerExtensions.cs
@@ -4,7 +4,7 @@
using System;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
internal static class MvcJsonLoggerExtensions
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Properties/AssemblyInfo.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Properties/AssemblyInfo.cs
index 7982959233..a6552b389c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Properties/AssemblyInfo.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Properties/AssemblyInfo.cs
@@ -3,4 +3,6 @@
using System.Runtime.CompilerServices;
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Formatters.Json.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/MvcXmlOptionsConfigureCompatibilityOptions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/DependencyInjection/MvcXmlOptionsConfigureCompatibilityOptions.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/MvcXmlOptionsConfigureCompatibilityOptions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/DependencyInjection/MvcXmlOptionsConfigureCompatibilityOptions.cs
index c5d1d3e340..d37e67d3e1 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/MvcXmlOptionsConfigureCompatibilityOptions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/DependencyInjection/MvcXmlOptionsConfigureCompatibilityOptions.cs
@@ -2,12 +2,13 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Formatters.Xml;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc
+namespace Microsoft.Extensions.DependencyInjection
{
internal sealed class MvcXmlOptionsConfigureCompatibilityOptions : ConfigureCompatibilityOptions
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerMvcOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/DependencyInjection/XmlDataContractSerializerMvcOptionsSetup.cs
similarity index 94%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerMvcOptionsSetup.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/DependencyInjection/XmlDataContractSerializerMvcOptionsSetup.cs
index eba6b9d5fd..83a8fd5b67 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerMvcOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/DependencyInjection/XmlDataContractSerializerMvcOptionsSetup.cs
@@ -2,15 +2,15 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using System.Xml;
-using System.Xml.Linq;
-using Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Formatters;
+using Microsoft.AspNetCore.Mvc.Formatters.Xml;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
+namespace Microsoft.Extensions.DependencyInjection
{
///
/// A implementation which will add the
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlSerializerMvcOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/DependencyInjection/XmlSerializerMvcOptionsSetup.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlSerializerMvcOptionsSetup.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/DependencyInjection/XmlSerializerMvcOptionsSetup.cs
index 1a57d167ce..3186fab390 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlSerializerMvcOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/DependencyInjection/XmlSerializerMvcOptionsSetup.cs
@@ -2,11 +2,13 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Formatters;
+using Microsoft.AspNetCore.Mvc.Formatters.Xml;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
+namespace Microsoft.Extensions.DependencyInjection
{
///
/// A implementation which will add the
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Internal/FormattingUtilities.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/FormattingUtilities.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Internal/FormattingUtilities.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/FormattingUtilities.cs
index 7b97d7ca79..70a9c94453 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Internal/FormattingUtilities.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/FormattingUtilities.cs
@@ -4,12 +4,12 @@
using System.Runtime.Serialization;
using System.Xml;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
///
/// Contains methods which are used by Xml input formatters.
///
- public static class FormattingUtilities
+ internal static class FormattingUtilities
{
public static readonly int DefaultMaxDepth = 32;
public static readonly XsdDataContractExporter XsdDataContractExporter = new XsdDataContractExporter();
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/LoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/LoggerExtensions.cs
index dfb00627d4..76496bea3a 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/LoggerExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/LoggerExtensions.cs
@@ -4,9 +4,9 @@
using System;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
- public static class LoggerExtensions
+ internal static class LoggerExtensions
{
private static readonly Action _failedToCreateXmlSerializer;
private static readonly Action _failedToCreateDataContractSerializer;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Internal/MediaTypeHeaderValues.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/MediaTypeHeaderValues.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Internal/MediaTypeHeaderValues.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/MediaTypeHeaderValues.cs
index 14f2a99ce4..24ddce0b3f 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Internal/MediaTypeHeaderValues.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/MediaTypeHeaderValues.cs
@@ -3,7 +3,7 @@
using Microsoft.Net.Http.Headers;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
internal static class MediaTypeHeaderValues
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Microsoft.AspNetCore.Mvc.Formatters.Xml.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Microsoft.AspNetCore.Mvc.Formatters.Xml.csproj
index 18dcb55e3a..62409ab4fb 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Microsoft.AspNetCore.Mvc.Formatters.Xml.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Microsoft.AspNetCore.Mvc.Formatters.Xml.csproj
@@ -2,7 +2,7 @@
ASP.NET Core MVC formatters for XML input and output using DataContractSerializer and XmlSerializer.
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc;xml
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerInputFormatter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerInputFormatter.cs
index f0954c36a4..ac1b2a085e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerInputFormatter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerInputFormatter.cs
@@ -13,8 +13,7 @@ using System.Threading.Tasks;
using System.Xml;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Formatters.Xml;
-using Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.WebUtilities;
namespace Microsoft.AspNetCore.Mvc.Formatters
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerOutputFormatter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerOutputFormatter.cs
index 9b89042636..c0a9cdab2d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerOutputFormatter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerOutputFormatter.cs
@@ -10,7 +10,6 @@ using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Microsoft.AspNetCore.Mvc.Formatters.Xml;
-using Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Formatters
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlSerializerInputFormatter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlSerializerInputFormatter.cs
index 4d530a015b..729d9e1117 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlSerializerInputFormatter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlSerializerInputFormatter.cs
@@ -13,8 +13,7 @@ using System.Xml;
using System.Xml.Serialization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Formatters.Xml;
-using Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.WebUtilities;
namespace Microsoft.AspNetCore.Mvc.Formatters
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlSerializerOutputFormatter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlSerializerOutputFormatter.cs
index c289972ea4..9960eedbd6 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlSerializerOutputFormatter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlSerializerOutputFormatter.cs
@@ -10,7 +10,6 @@ using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.AspNetCore.Mvc.Formatters.Xml;
-using Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Formatters
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Localization/Microsoft.AspNetCore.Mvc.Localization.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Localization/Microsoft.AspNetCore.Mvc.Localization.csproj
index a20bb199aa..f0a687e90c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Localization/Microsoft.AspNetCore.Mvc.Localization.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Localization/Microsoft.AspNetCore.Mvc.Localization.csproj
@@ -5,7 +5,7 @@
Commonly used types:
Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer<TResource>
Microsoft.AspNetCore.Mvc.Localization.IViewLocalizer
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc;localization
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompilationFailedException.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompilationFailedException.cs
deleted file mode 100644
index 5e3899c0bb..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompilationFailedException.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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 Microsoft.AspNetCore.Diagnostics;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
-{
- ///
- /// An thrown when accessing the result of a failed compilation.
- ///
- public class CompilationFailedException : Exception, ICompilationException
- {
- ///
- /// Instantiates a new instance of .
- ///
- /// s containing
- /// details of the compilation failure.
- public CompilationFailedException(
- IEnumerable compilationFailures)
- : base(FormatMessage(compilationFailures))
- {
- if (compilationFailures == null)
- {
- throw new ArgumentNullException(nameof(compilationFailures));
- }
-
- CompilationFailures = compilationFailures;
- }
-
- ///
- public IEnumerable CompilationFailures { get; }
-
- private static string FormatMessage(IEnumerable compilationFailures)
- {
- return Resources.CompilationFailed + Environment.NewLine +
- string.Join(
- Environment.NewLine,
- compilationFailures.SelectMany(f => f.Messages).Select(message => message.FormattedMessage));
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompiledViewDescriptor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompiledViewDescriptor.cs
index 4b4c1ec3e8..213218c5cd 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompiledViewDescriptor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompiledViewDescriptor.cs
@@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
-using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Razor.Hosting;
using Microsoft.Extensions.Primitives;
@@ -52,7 +51,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
// later.
ExpirationTokens = Array.Empty();
RelativePath = ViewPath.NormalizePath(item?.Identifier ?? attribute.Path);
- IsPrecompiled = true;
}
///
@@ -73,11 +71,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
///
public IList ExpirationTokens { get; set; }
- ///
- /// Gets a value that determines if the view is precompiled.
- ///
- public bool IsPrecompiled { get; set; }
-
///
/// Gets the descriptor for this view.
///
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorPageFactoryProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/DefaultRazorPageFactoryProvider.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorPageFactoryProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/DefaultRazorPageFactoryProvider.cs
index b5c7341830..fc0d03cf0d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorPageFactoryProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/DefaultRazorPageFactoryProvider.cs
@@ -4,15 +4,14 @@
using System;
using System.Linq.Expressions;
using System.Reflection;
-using Microsoft.AspNetCore.Mvc.Razor.Compilation;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
{
///
/// Represents a that creates instances
/// from razor files in the file system.
///
- public class DefaultRazorPageFactoryProvider : IRazorPageFactoryProvider
+ internal class DefaultRazorPageFactoryProvider : IRazorPageFactoryProvider
{
private readonly IViewCompilerProvider _viewCompilerProvider;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/IViewCompilationMemoryCacheProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/IViewCompilationMemoryCacheProvider.cs
deleted file mode 100644
index 5abbd550f3..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/IViewCompilationMemoryCacheProvider.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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.Caching.Memory;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
-{
- ///
- /// Provides an instance of that is used to store compiled Razor views.
- ///
- public interface IViewCompilationMemoryCacheProvider
- {
- IMemoryCache CompilationMemoryCache { get; }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeature.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeature.cs
deleted file mode 100644
index 478d21eed8..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeature.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.CodeAnalysis;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
-{
- ///
- /// Specifies the list of used in Razor compilation.
- ///
- [Obsolete("This type is obsolete and will be removed in a future version. See https://aka.ms/AA1x4gg for details.")]
- public class MetadataReferenceFeature
- {
- ///
- /// Gets the instances.
- ///
- public IList MetadataReferences { get; } = new List();
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeatureProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeatureProvider.cs
deleted file mode 100644
index 8050671a1f..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeatureProvider.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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.IO;
-using System.Linq;
-using System.Reflection.PortableExecutable;
-using Microsoft.AspNetCore.Mvc.ApplicationParts;
-using Microsoft.CodeAnalysis;
-using Microsoft.Extensions.DependencyModel;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
-{
- ///
- /// An for that
- /// uses for registered instances to create
- /// .
- ///
- [Obsolete("This type is obsolete and will be removed in a future version. See https://aka.ms/AA1x4gg for details.")]
- public class MetadataReferenceFeatureProvider : IApplicationFeatureProvider
- {
- ///
- public void PopulateFeature(IEnumerable parts, MetadataReferenceFeature feature)
- {
- if (parts == null)
- {
- throw new ArgumentNullException(nameof(parts));
- }
-
- if (feature == null)
- {
- throw new ArgumentNullException(nameof(feature));
- }
-
- var libraryPaths = new HashSet(StringComparer.OrdinalIgnoreCase);
- foreach (var providerPart in parts.OfType())
- {
- var referencePaths = providerPart.GetReferencePaths();
- foreach (var path in referencePaths)
- {
- if (libraryPaths.Add(path))
- {
- var metadataReference = CreateMetadataReference(path);
- feature.MetadataReferences.Add(metadataReference);
- }
- }
- }
- }
-
- private static MetadataReference CreateMetadataReference(string path)
- {
- using (var stream = File.OpenRead(path))
- {
- var moduleMetadata = ModuleMetadata.CreateFromStream(stream, PEStreamOptions.PrefetchMetadata);
- var assemblyMetadata = AssemblyMetadata.Create(moduleMetadata);
-
- return assemblyMetadata.GetReference(filePath: path);
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorReferenceManager.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorReferenceManager.cs
deleted file mode 100644
index df09623169..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorReferenceManager.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.CodeAnalysis;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
-{
- ///
- /// Manages compilation references for Razor compilation.
- ///
- [Obsolete("This type is obsolete and will be removed in a future version. See https://aka.ms/AA1x4gg for details.")]
- public abstract class RazorReferenceManager
- {
- ///
- /// Gets the set of compilation references to be used for Razor compilation.
- ///
- public abstract IReadOnlyList CompilationReferences { get; }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewCompilationMemoryCacheProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewCompilationMemoryCacheProvider.cs
deleted file mode 100644
index 9a11db0b3f..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewCompilationMemoryCacheProvider.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// 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.Caching.Memory;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
-{
- internal class RazorViewCompilationMemoryCacheProvider : IViewCompilationMemoryCacheProvider
- {
- IMemoryCache IViewCompilationMemoryCacheProvider.CompilationMemoryCache { get; } = new MemoryCache(new MemoryCacheOptions());
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewCompiler.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewCompiler.cs
new file mode 100644
index 0000000000..7afc53edab
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewCompiler.cs
@@ -0,0 +1,115 @@
+// 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.Concurrent;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Primitives;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
+{
+ ///
+ /// Caches the result of runtime compilation of Razor files for the duration of the application lifetime.
+ ///
+ internal class RazorViewCompiler : IViewCompiler
+ {
+ private readonly Dictionary> _compiledViews;
+ private readonly ConcurrentDictionary _normalizedPathCache;
+ private readonly ILogger _logger;
+
+ public RazorViewCompiler(
+ IList compiledViews,
+ ILogger logger)
+ {
+ if (compiledViews == null)
+ {
+ throw new ArgumentNullException(nameof(compiledViews));
+ }
+
+ if (logger == null)
+ {
+ throw new ArgumentNullException(nameof(logger));
+ }
+
+ _logger = logger;
+ _normalizedPathCache = new ConcurrentDictionary(StringComparer.Ordinal);
+
+ // We need to validate that the all of the precompiled views are unique by path (case-insensitive).
+ // We do this because there's no good way to canonicalize paths on windows, and it will create
+ // problems when deploying to linux. Rather than deal with these issues, we just don't support
+ // views that differ only by case.
+ _compiledViews = new Dictionary>(
+ compiledViews.Count,
+ StringComparer.OrdinalIgnoreCase);
+
+ foreach (var compiledView in compiledViews)
+ {
+ logger.ViewCompilerLocatedCompiledView(compiledView.RelativePath);
+
+ if (!_compiledViews.ContainsKey(compiledView.RelativePath))
+ {
+ // View ordering has precedence semantics, a view with a higher precedence was not
+ // already added to the list.
+ _compiledViews.Add(compiledView.RelativePath, Task.FromResult(compiledView));
+ }
+ }
+
+ if (_compiledViews.Count == 0)
+ {
+ logger.ViewCompilerNoCompiledViewsFound();
+ }
+ }
+
+ ///
+ public Task CompileAsync(string relativePath)
+ {
+ if (relativePath == null)
+ {
+ throw new ArgumentNullException(nameof(relativePath));
+ }
+
+ // Attempt to lookup the cache entry using the passed in path. This will succeed if the path is already
+ // normalized and a cache entry exists.
+ if (_compiledViews.TryGetValue(relativePath, out var cachedResult))
+ {
+ _logger.ViewCompilerLocatedCompiledViewForPath(relativePath);
+ return cachedResult;
+ }
+
+ var normalizedPath = GetNormalizedPath(relativePath);
+ if (_compiledViews.TryGetValue(normalizedPath, out cachedResult))
+ {
+ _logger.ViewCompilerLocatedCompiledViewForPath(normalizedPath);
+ return cachedResult;
+ }
+
+ // Entry does not exist. Attempt to create one.
+ _logger.ViewCompilerCouldNotFindFileAtPath(relativePath);
+ return Task.FromResult(new CompiledViewDescriptor
+ {
+ RelativePath = normalizedPath,
+ ExpirationTokens = Array.Empty(),
+ });
+ }
+
+ private string GetNormalizedPath(string relativePath)
+ {
+ Debug.Assert(relativePath != null);
+ if (relativePath.Length == 0)
+ {
+ return relativePath;
+ }
+
+ if (!_normalizedPathCache.TryGetValue(relativePath, out var normalizedPath))
+ {
+ normalizedPath = ViewPath.NormalizePath(relativePath);
+ _normalizedPathCache[relativePath] = normalizedPath;
+ }
+
+ return normalizedPath;
+ }
+ }
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewCompilerProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewCompilerProvider.cs
new file mode 100644
index 0000000000..64965e6f72
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewCompilerProvider.cs
@@ -0,0 +1,25 @@
+// 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.ApplicationParts;
+using Microsoft.Extensions.Logging;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
+{
+ internal class RazorViewCompilerProvider : IViewCompilerProvider
+ {
+ private readonly RazorViewCompiler _compiler;
+
+ public RazorViewCompilerProvider(
+ ApplicationPartManager applicationPartManager,
+ ILoggerFactory loggerFactory)
+ {
+ var feature = new ViewsFeature();
+ applicationPartManager.PopulateFeature(feature);
+
+ _compiler = new RazorViewCompiler(feature.ViewDescriptors, loggerFactory.CreateLogger());
+ }
+
+ public IViewCompiler GetCompiler() => _compiler;
+ }
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RoslynCompilationContext.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RoslynCompilationContext.cs
deleted file mode 100644
index 5536969721..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RoslynCompilationContext.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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 Microsoft.CodeAnalysis.CSharp;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
-{
- ///
- /// Context object used to pass information about the current Razor page compilation.
- ///
- public class RoslynCompilationContext
- {
- ///
- /// Constructs a new instance of the type.
- ///
- /// to be set to property.
- public RoslynCompilationContext(CSharpCompilation compilation)
- {
- if (compilation == null)
- {
- throw new ArgumentNullException(nameof(compilation));
- }
-
- Compilation = compilation;
- }
-
- ///
- /// Gets or sets the used for current source file compilation.
- ///
- public CSharpCompilation Compilation { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs
index e7e7143fbb..911b010261 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs
@@ -7,7 +7,6 @@ using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
-using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
@@ -51,7 +50,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
ExpirationTokens = Array.Empty(),
RelativePath = relativePath,
ViewAttribute = attribute,
- IsPrecompiled = true,
};
feature.ViewDescriptors.Add(viewDescriptor);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultTagHelperFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DefaultTagHelperFactory.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultTagHelperFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DefaultTagHelperFactory.cs
index 6dd51965c3..f394d34581 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultTagHelperFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DefaultTagHelperFactory.cs
@@ -11,12 +11,12 @@ using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.AspNetCore.Mvc.Razor
{
///
/// Default implementation for .
///
- public class DefaultTagHelperFactory : ITagHelperFactory
+ internal class DefaultTagHelperFactory : ITagHelperFactory
{
private readonly ITagHelperActivator _activator;
private readonly ConcurrentDictionary[]> _injectActions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcBuilderExtensions.cs
index 8b47c02345..7fa8e4b3ae 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcBuilderExtensions.cs
@@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Razor;
-using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Razor.TagHelpers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
index 131bc13391..46139a28a0 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
@@ -2,27 +2,19 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using System.Diagnostics;
using System.Linq;
-using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.Razor.Compilation;
-using Microsoft.AspNetCore.Mvc.Razor.Extensions;
using Microsoft.AspNetCore.Mvc.Razor.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Mvc.Razor.TagHelpers;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection.Extensions;
-using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-using CompilationTagHelperFeature = Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature;
-using DefaultTagHelperDescriptorProvider = Microsoft.CodeAnalysis.Razor.DefaultTagHelperDescriptorProvider;
namespace Microsoft.Extensions.DependencyInjection
{
@@ -67,13 +59,6 @@ namespace Microsoft.Extensions.DependencyInjection
private static void AddRazorViewEngineFeatureProviders(IMvcCoreBuilder builder)
{
-#pragma warning disable CS0618 // Type or member is obsolete
- if (!builder.PartManager.FeatureProviders.OfType().Any())
- {
- builder.PartManager.FeatureProviders.Add(new MetadataReferenceFeatureProvider());
- }
-#pragma warning restore CS0618 // Type or member is obsolete
-
if (!builder.PartManager.FeatureProviders.OfType().Any())
{
builder.PartManager.FeatureProviders.Add(new TagHelperFeatureProvider());
@@ -149,74 +134,19 @@ namespace Microsoft.Extensions.DependencyInjection
// Internal for testing.
internal static void AddRazorViewEngineServices(IServiceCollection services)
{
- services.TryAddSingleton();
-#pragma warning disable CS0618 // Type or member is obsolete
- services.TryAddSingleton();
-#pragma warning restore CS0618 // Type or member is obsolete
-
services.TryAddEnumerable(
ServiceDescriptor.Transient, MvcRazorMvcViewOptionsSetup>());
services.TryAddEnumerable(
ServiceDescriptor.Transient, RazorViewEngineOptionsSetup>());
- services.TryAddEnumerable(
- ServiceDescriptor.Transient, RazorViewEngineOptionsSetup>());
-
- services.TryAddSingleton<
- IRazorViewEngineFileProviderAccessor,
- DefaultRazorViewEngineFileProviderAccessor>();
-
- services.TryAddSingleton(s =>
- {
- var pageFactory = s.GetRequiredService();
- var pageActivator = s.GetRequiredService();
- var htmlEncoder = s.GetRequiredService();
- var optionsAccessor = s.GetRequiredService>();
- var razorFileSystem = s.GetRequiredService();
- var loggerFactory = s.GetRequiredService();
- var diagnosticSource = s.GetRequiredService();
-
- var viewEngine = new RazorViewEngine(pageFactory, pageActivator, htmlEncoder, optionsAccessor, razorFileSystem, loggerFactory, diagnosticSource);
- return viewEngine;
- });
+ services.TryAddSingleton();
services.TryAddSingleton();
- services.TryAddSingleton();
// In the default scenario the following services are singleton by virtue of being initialized as part of
// creating the singleton RazorViewEngine instance.
services.TryAddTransient();
- //
- // Razor compilation infrastructure
- //
- services.TryAddSingleton();
- services.TryAddSingleton();
- services.TryAddSingleton(s =>
- {
- var fileSystem = s.GetRequiredService();
- var projectEngine = RazorProjectEngine.Create(RazorConfiguration.Default, fileSystem, builder =>
- {
- RazorExtensions.Register(builder);
-
- // Roslyn + TagHelpers infrastructure
- var metadataReferenceFeature = s.GetRequiredService();
- builder.Features.Add(metadataReferenceFeature);
- builder.Features.Add(new CompilationTagHelperFeature());
-
- // TagHelperDescriptorProviders (actually do tag helper discovery)
- builder.Features.Add(new DefaultTagHelperDescriptorProvider());
- builder.Features.Add(new ViewComponentTagHelperDescriptorProvider());
- });
-
- return projectEngine;
- });
-
- // Legacy Razor compilation services
- services.TryAddSingleton(s => s.GetRequiredService().FileSystem);
- services.TryAddSingleton();
- services.TryAddSingleton(s => s.GetRequiredService().Engine);
-
// This caches Razor page activation details that are valid for the lifetime of the application.
services.TryAddSingleton();
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/MvcRazorMvcViewOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcViewOptionsSetup.cs
similarity index 87%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/MvcRazorMvcViewOptionsSetup.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcViewOptionsSetup.cs
index 8b35da8ddf..f932560411 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/MvcRazorMvcViewOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcViewOptionsSetup.cs
@@ -2,14 +2,16 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.Extensions.DependencyInjection
{
///
/// Configures to use .
///
- public class MvcRazorMvcViewOptionsSetup : IConfigureOptions
+ internal class MvcRazorMvcViewOptionsSetup : IConfigureOptions
{
private readonly IRazorViewEngine _razorViewEngine;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/TagHelpersAsServices.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/TagHelpersAsServices.cs
similarity index 88%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/TagHelpersAsServices.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/TagHelpersAsServices.cs
index a441c75de1..7ef080696b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/TagHelpersAsServices.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/TagHelpersAsServices.cs
@@ -4,13 +4,13 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
+using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.Razor.TagHelpers;
-using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.Extensions.DependencyInjection
{
- public static class TagHelpersAsServices
+ internal static class TagHelpersAsServices
{
public static void AddTagHelpersAsServices(ApplicationPartManager manager, IServiceCollection services)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultTagHelperActivator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Infrastructure/DefaultTagHelperActivator.cs
similarity index 89%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultTagHelperActivator.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Infrastructure/DefaultTagHelperActivator.cs
index c52a77a2eb..8146ca0758 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultTagHelperActivator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Infrastructure/DefaultTagHelperActivator.cs
@@ -2,16 +2,16 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Razor.TagHelpers;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.AspNetCore.Mvc.Razor.Infrastructure
{
///
/// Default implementation of .
///
- public class DefaultTagHelperActivator : ITagHelperActivator
+ internal class DefaultTagHelperActivator : ITagHelperActivator
{
private readonly ITypeActivatorCache _typeActivatorCache;
@@ -43,4 +43,4 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
typeof(TTagHelper));
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CSharpCompiler.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CSharpCompiler.cs
deleted file mode 100644
index 496d2f9ee7..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CSharpCompiler.cs
+++ /dev/null
@@ -1,235 +0,0 @@
-// 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.Hosting;
-using Microsoft.AspNetCore.Mvc.Razor.Compilation;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
-using Microsoft.CodeAnalysis.Emit;
-using Microsoft.CodeAnalysis.Text;
-using Microsoft.Extensions.DependencyModel;
-using DependencyContextCompilationOptions = Microsoft.Extensions.DependencyModel.CompilationOptions;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- public class CSharpCompiler
- {
-#pragma warning disable CS0618 // Type or member is obsolete
- private readonly RazorReferenceManager _referenceManager;
-#pragma warning restore CS0618 // Type or member is obsolete
- private readonly IHostingEnvironment _hostingEnvironment;
- private bool _optionsInitialized;
- private CSharpParseOptions _parseOptions;
- private CSharpCompilationOptions _compilationOptions;
- private EmitOptions _emitOptions;
- private bool _emitPdb;
-
-#pragma warning disable CS0618 // Type or member is obsolete
- public CSharpCompiler(RazorReferenceManager manager, IHostingEnvironment hostingEnvironment)
-#pragma warning restore CS0618 // Type or member is obsolete
- {
- _referenceManager = manager ?? throw new ArgumentNullException(nameof(manager));
- _hostingEnvironment = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment));
- }
-
- public virtual CSharpParseOptions ParseOptions
- {
- get
- {
- EnsureOptions();
- return _parseOptions;
- }
- }
-
- public virtual CSharpCompilationOptions CSharpCompilationOptions
- {
- get
- {
- EnsureOptions();
- return _compilationOptions;
- }
- }
-
- public virtual bool EmitPdb
- {
- get
- {
- EnsureOptions();
- return _emitPdb;
- }
- }
-
- public virtual EmitOptions EmitOptions
- {
- get
- {
- EnsureOptions();
- return _emitOptions;
- }
- }
-
- public SyntaxTree CreateSyntaxTree(SourceText sourceText)
- {
- return CSharpSyntaxTree.ParseText(
- sourceText,
- options: ParseOptions);
- }
-
- public CSharpCompilation CreateCompilation(string assemblyName)
- {
- return CSharpCompilation.Create(
- assemblyName,
- options: CSharpCompilationOptions,
- references: _referenceManager.CompilationReferences);
- }
-
- // Internal for unit testing.
- protected internal virtual DependencyContextCompilationOptions GetDependencyContextCompilationOptions()
- {
- if (!string.IsNullOrEmpty(_hostingEnvironment.ApplicationName))
- {
- var applicationAssembly = Assembly.Load(new AssemblyName(_hostingEnvironment.ApplicationName));
- var dependencyContext = DependencyContext.Load(applicationAssembly);
- if (dependencyContext?.CompilationOptions != null)
- {
- return dependencyContext.CompilationOptions;
- }
- }
-
- return DependencyContextCompilationOptions.Default;
- }
-
- private void EnsureOptions()
- {
- if (!_optionsInitialized)
- {
- var dependencyContextOptions = GetDependencyContextCompilationOptions();
- _parseOptions = GetParseOptions(_hostingEnvironment, dependencyContextOptions);
- _compilationOptions = GetCompilationOptions(_hostingEnvironment, dependencyContextOptions);
- _emitOptions = GetEmitOptions(dependencyContextOptions);
-
- _optionsInitialized = true;
- }
- }
-
- private EmitOptions GetEmitOptions(DependencyContextCompilationOptions dependencyContextOptions)
- {
- // Assume we're always producing pdbs unless DebugType = none
- _emitPdb = true;
- DebugInformationFormat debugInformationFormat;
- if (string.IsNullOrEmpty(dependencyContextOptions.DebugType))
- {
- debugInformationFormat = SymbolsUtility.SupportsFullPdbGeneration() ?
- DebugInformationFormat.Pdb :
- DebugInformationFormat.PortablePdb;
- }
- else
- {
- // Based on https://github.com/dotnet/roslyn/blob/1d28ff9ba248b332de3c84d23194a1d7bde07e4d/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs#L624-L640
- switch (dependencyContextOptions.DebugType.ToLower())
- {
- case "none":
- // There isn't a way to represent none in DebugInformationFormat.
- // We'll set EmitPdb to false and let callers handle it by setting a null pdb-stream.
- _emitPdb = false;
- return new EmitOptions();
- case "portable":
- debugInformationFormat = DebugInformationFormat.PortablePdb;
- break;
- case "embedded":
- // Roslyn does not expose enough public APIs to produce a binary with embedded pdbs.
- // We'll produce PortablePdb instead to continue providing a reasonable user experience.
- debugInformationFormat = DebugInformationFormat.PortablePdb;
- break;
- case "full":
- case "pdbonly":
- debugInformationFormat = SymbolsUtility.SupportsFullPdbGeneration() ?
- DebugInformationFormat.Pdb :
- DebugInformationFormat.PortablePdb;
- break;
- default:
- throw new InvalidOperationException(Resources.FormatUnsupportedDebugInformationFormat(dependencyContextOptions.DebugType));
- }
- }
-
- var emitOptions = new EmitOptions(debugInformationFormat: debugInformationFormat);
- return emitOptions;
- }
-
- private static CSharpCompilationOptions GetCompilationOptions(
- IHostingEnvironment hostingEnvironment,
- DependencyContextCompilationOptions dependencyContextOptions)
- {
- var csharpCompilationOptions = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary);
-
- // Disable 1702 until roslyn turns this off by default
- csharpCompilationOptions = csharpCompilationOptions.WithSpecificDiagnosticOptions(
- new Dictionary
- {
- {"CS1701", ReportDiagnostic.Suppress}, // Binding redirects
- {"CS1702", ReportDiagnostic.Suppress},
- {"CS1705", ReportDiagnostic.Suppress}
- });
-
- if (dependencyContextOptions.AllowUnsafe.HasValue)
- {
- csharpCompilationOptions = csharpCompilationOptions.WithAllowUnsafe(
- dependencyContextOptions.AllowUnsafe.Value);
- }
-
- OptimizationLevel optimizationLevel;
- if (dependencyContextOptions.Optimize.HasValue)
- {
- optimizationLevel = dependencyContextOptions.Optimize.Value ?
- OptimizationLevel.Release :
- OptimizationLevel.Debug;
- }
- else
- {
- optimizationLevel = hostingEnvironment.IsDevelopment() ?
- OptimizationLevel.Debug :
- OptimizationLevel.Release;
- }
- csharpCompilationOptions = csharpCompilationOptions.WithOptimizationLevel(optimizationLevel);
-
- if (dependencyContextOptions.WarningsAsErrors.HasValue)
- {
- var reportDiagnostic = dependencyContextOptions.WarningsAsErrors.Value ?
- ReportDiagnostic.Error :
- ReportDiagnostic.Default;
- csharpCompilationOptions = csharpCompilationOptions.WithGeneralDiagnosticOption(reportDiagnostic);
- }
-
- return csharpCompilationOptions;
- }
-
- private static CSharpParseOptions GetParseOptions(
- IHostingEnvironment hostingEnvironment,
- DependencyContextCompilationOptions dependencyContextOptions)
- {
- var configurationSymbol = hostingEnvironment.IsDevelopment() ? "DEBUG" : "RELEASE";
- var defines = dependencyContextOptions.Defines.Concat(new[] { configurationSymbol });
-
- var parseOptions = new CSharpParseOptions(preprocessorSymbols: defines);
-
- if (!string.IsNullOrEmpty(dependencyContextOptions.LanguageVersion))
- {
- if (LanguageVersionFacts.TryParse(dependencyContextOptions.LanguageVersion, out var languageVersion))
- {
- parseOptions = parseOptions.WithLanguageVersion(languageVersion);
- }
- else
- {
- Debug.Fail($"LanguageVersion {languageVersion} specified in the deps file could not be parsed.");
- }
- }
-
- return parseOptions;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ChecksumValidator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ChecksumValidator.cs
deleted file mode 100644
index fea6a7ba2d..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ChecksumValidator.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-// 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.Razor.Hosting;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- public static class ChecksumValidator
- {
- public static bool IsRecompilationSupported(RazorCompiledItem item)
- {
- if (item == null)
- {
- throw new ArgumentNullException(nameof(item));
- }
-
- // A Razor item only supports recompilation if its primary source file has a checksum.
- //
- // Other files (view imports) may or may not have existed at the time of compilation,
- // so we may not have checksums for them.
- var checksums = item.GetChecksumMetadata();
- return checksums.Any(c => string.Equals(item.Identifier, c.Identifier, StringComparison.OrdinalIgnoreCase));
- }
-
- // Validates that we can use an existing precompiled view by comparing checksums with files on
- // disk.
- public static bool IsItemValid(RazorProjectFileSystem fileSystem, RazorCompiledItem item)
- {
- if (fileSystem == null)
- {
- throw new ArgumentNullException(nameof(fileSystem));
- }
-
- if (item == null)
- {
- throw new ArgumentNullException(nameof(item));
- }
-
- var checksums = item.GetChecksumMetadata();
-
- // The checksum that matches 'Item.Identity' in this list is significant. That represents the main file.
- //
- // We don't really care about the validation unless the main file exists. This is because we expect
- // most sites to have some _ViewImports in common location. That means that in the case you're
- // using views from a 3rd party library, you'll always have **some** conflicts.
- //
- // The presence of the main file with the same content is a very strong signal that you're in a
- // development scenario.
- var primaryChecksum = checksums
- .FirstOrDefault(c => string.Equals(item.Identifier, c.Identifier, StringComparison.OrdinalIgnoreCase));
- if (primaryChecksum == null)
- {
- // No primary checksum, assume valid.
- return true;
- }
-
- var projectItem = fileSystem.GetItem(primaryChecksum.Identifier);
- if (!projectItem.Exists)
- {
- // Main file doesn't exist - assume valid.
- return true;
- }
-
- var sourceDocument = RazorSourceDocument.ReadFrom(projectItem);
- if (!string.Equals(sourceDocument.GetChecksumAlgorithm(), primaryChecksum.ChecksumAlgorithm) ||
- !ChecksumsEqual(primaryChecksum.Checksum, sourceDocument.GetChecksum()))
- {
- // Main file exists, but checksums not equal.
- return false;
- }
-
- for (var i = 0; i < checksums.Count; i++)
- {
- var checksum = checksums[i];
- if (string.Equals(item.Identifier, checksum.Identifier, StringComparison.OrdinalIgnoreCase))
- {
- // Ignore primary checksum on this pass.
- continue;
- }
-
- var importItem = fileSystem.GetItem(checksum.Identifier);
- if (!importItem.Exists)
- {
- // Import file doesn't exist - assume invalid.
- return false;
- }
-
- sourceDocument = RazorSourceDocument.ReadFrom(importItem);
- if (!string.Equals(sourceDocument.GetChecksumAlgorithm(), checksum.ChecksumAlgorithm) ||
- !ChecksumsEqual(checksum.Checksum, sourceDocument.GetChecksum()))
- {
- // Import file exists, but checksums not equal.
- return false;
- }
- }
-
- return true;
- }
-
- private static bool ChecksumsEqual(string checksum, byte[] bytes)
- {
- if (bytes.Length * 2 != checksum.Length)
- {
- return false;
- }
-
- for (var i = 0; i < bytes.Length; i++)
- {
- var text = bytes[i].ToString("x2");
- if (checksum[i * 2] != text[0] || checksum[i * 2 + 1] != text[1])
- {
- return false;
- }
- }
-
- return true;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CompilationFailedExceptionFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CompilationFailedExceptionFactory.cs
deleted file mode 100644
index 02b096ec75..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CompilationFailedExceptionFactory.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-// 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 Microsoft.AspNetCore.Diagnostics;
-using Microsoft.AspNetCore.Mvc.Razor.Compilation;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- internal static class CompilationFailedExceptionFactory
- {
- // error CS0234: The type or namespace name 'C' does not exist in the namespace 'N' (are you missing
- // an assembly reference?)
- private const string CS0234 = nameof(CS0234);
- // error CS0246: The type or namespace name 'T' could not be found (are you missing a using directive
- // or an assembly reference?)
- private const string CS0246 = nameof(CS0246);
-
- public static CompilationFailedException Create(
- RazorCodeDocument codeDocument,
- IEnumerable diagnostics)
- {
- // If a SourceLocation does not specify a file path, assume it is produced from parsing the current file.
- var messageGroups = diagnostics.GroupBy(
- razorError => razorError.Span.FilePath ?? codeDocument.Source.FilePath,
- StringComparer.Ordinal);
-
- var failures = new List();
- foreach (var group in messageGroups)
- {
- var filePath = group.Key;
- var fileContent = ReadContent(codeDocument, filePath);
- var compilationFailure = new CompilationFailure(
- filePath,
- fileContent,
- compiledContent: string.Empty,
- messages: group.Select(parserError => CreateDiagnosticMessage(parserError, filePath)));
- failures.Add(compilationFailure);
- }
-
- return new CompilationFailedException(failures);
- }
-
- public static CompilationFailedException Create(
- RazorCodeDocument codeDocument,
- string compilationContent,
- string assemblyName,
- IEnumerable diagnostics)
- {
- var diagnosticGroups = diagnostics
- .Where(diagnostic => diagnostic.IsWarningAsError || diagnostic.Severity == DiagnosticSeverity.Error)
- .GroupBy(diagnostic => GetFilePath(codeDocument, diagnostic), StringComparer.Ordinal);
-
- var failures = new List();
- foreach (var group in diagnosticGroups)
- {
- var sourceFilePath = group.Key;
- string sourceFileContent;
- if (string.Equals(assemblyName, sourceFilePath, StringComparison.Ordinal))
- {
- // The error is in the generated code and does not have a mapping line pragma
- sourceFileContent = compilationContent;
- sourceFilePath = Resources.GeneratedCodeFileName;
- }
- else
- {
- sourceFileContent = ReadContent(codeDocument, sourceFilePath);
- }
-
- string additionalMessage = null;
- if (group.Any(g =>
- string.Equals(CS0234, g.Id, StringComparison.OrdinalIgnoreCase) ||
- string.Equals(CS0246, g.Id, StringComparison.OrdinalIgnoreCase)))
- {
- additionalMessage = Resources.FormatCompilation_MissingReferences(
- "CopyRefAssembliesToPublishDirectory");
- }
-
- var compilationFailure = new CompilationFailure(
- sourceFilePath,
- sourceFileContent,
- compilationContent,
- group.Select(GetDiagnosticMessage),
- additionalMessage);
-
- failures.Add(compilationFailure);
- }
-
- return new CompilationFailedException(failures);
- }
-
- private static string ReadContent(RazorCodeDocument codeDocument, string filePath)
- {
- RazorSourceDocument sourceDocument;
- if (string.IsNullOrEmpty(filePath) || string.Equals(codeDocument.Source.FilePath, filePath, StringComparison.Ordinal))
- {
- sourceDocument = codeDocument.Source;
- }
- else
- {
- sourceDocument = codeDocument.Imports.FirstOrDefault(f => string.Equals(f.FilePath, filePath, StringComparison.Ordinal));
- }
-
- if (sourceDocument != null)
- {
- var contentChars = new char[sourceDocument.Length];
- sourceDocument.CopyTo(0, contentChars, 0, sourceDocument.Length);
- return new string(contentChars);
- }
-
- return string.Empty;
- }
-
- private static DiagnosticMessage GetDiagnosticMessage(Diagnostic diagnostic)
- {
- var mappedLineSpan = diagnostic.Location.GetMappedLineSpan();
- return new DiagnosticMessage(
- diagnostic.GetMessage(),
- CSharpDiagnosticFormatter.Instance.Format(diagnostic),
- mappedLineSpan.Path,
- mappedLineSpan.StartLinePosition.Line + 1,
- mappedLineSpan.StartLinePosition.Character + 1,
- mappedLineSpan.EndLinePosition.Line + 1,
- mappedLineSpan.EndLinePosition.Character + 1);
- }
-
- private static DiagnosticMessage CreateDiagnosticMessage(
- RazorDiagnostic razorDiagnostic,
- string filePath)
- {
- var sourceSpan = razorDiagnostic.Span;
- var message = razorDiagnostic.GetMessage();
- return new DiagnosticMessage(
- message: message,
- formattedMessage: razorDiagnostic.ToString(),
- filePath: filePath,
- startLine: sourceSpan.LineIndex + 1,
- startColumn: sourceSpan.CharacterIndex,
- endLine: sourceSpan.LineIndex + 1,
- endColumn: sourceSpan.CharacterIndex + sourceSpan.Length);
- }
-
- private static string GetFilePath(RazorCodeDocument codeDocument, Diagnostic diagnostic)
- {
- if (diagnostic.Location == Location.None)
- {
- return codeDocument.Source.FilePath;
- }
-
- return diagnostic.Location.GetMappedLineSpan().Path;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorReferenceManager.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorReferenceManager.cs
deleted file mode 100644
index 04965e52a4..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorReferenceManager.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-// 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 System.Threading;
-using Microsoft.AspNetCore.Mvc.ApplicationParts;
-using Microsoft.AspNetCore.Mvc.Razor.Compilation;
-using Microsoft.CodeAnalysis;
-using Microsoft.Extensions.Options;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
-#pragma warning disable CS0618 // Type or member is obsolete
- public class DefaultRazorReferenceManager : RazorReferenceManager
-#pragma warning restore CS0618 // Type or member is obsolete
- {
- private readonly ApplicationPartManager _partManager;
- private readonly IList _additionalMetadataReferences;
- private object _compilationReferencesLock = new object();
- private bool _compilationReferencesInitialized;
- private IReadOnlyList _compilationReferences;
-
- public DefaultRazorReferenceManager(
- ApplicationPartManager partManager,
- IOptions optionsAccessor)
- {
- _partManager = partManager;
-#pragma warning disable CS0618 // Type or member is obsolete
- _additionalMetadataReferences = optionsAccessor.Value.AdditionalCompilationReferences;
-#pragma warning restore CS0618 // Type or member is obsolete
- }
-
- public override IReadOnlyList CompilationReferences
- {
- get
- {
- return LazyInitializer.EnsureInitialized(
- ref _compilationReferences,
- ref _compilationReferencesInitialized,
- ref _compilationReferencesLock,
- GetCompilationReferences);
- }
- }
-
- private IReadOnlyList GetCompilationReferences()
- {
-#pragma warning disable CS0618 // Type or member is obsolete
- var feature = new MetadataReferenceFeature();
-#pragma warning restore CS0618 // Type or member is obsolete
- _partManager.PopulateFeature(feature);
- var applicationReferences = feature.MetadataReferences;
-
- if (_additionalMetadataReferences.Count == 0)
- {
- return applicationReferences.ToArray();
- }
-
- var compilationReferences = new List(applicationReferences.Count + _additionalMetadataReferences.Count);
- compilationReferences.AddRange(applicationReferences);
- compilationReferences.AddRange(_additionalMetadataReferences);
-
- return compilationReferences;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorViewEngineFileProviderAccessor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorViewEngineFileProviderAccessor.cs
deleted file mode 100644
index 5823a4b39c..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorViewEngineFileProviderAccessor.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.FileProviders;
-using Microsoft.Extensions.Options;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- ///
- /// Default implementation of .
- ///
- public class DefaultRazorViewEngineFileProviderAccessor : IRazorViewEngineFileProviderAccessor
- {
- ///
- /// Initializes a new instance of .
- ///
- /// Accessor to .
- public DefaultRazorViewEngineFileProviderAccessor(IOptions optionsAccessor)
- {
- var fileProviders = optionsAccessor.Value.FileProviders;
- if (fileProviders.Count == 0)
- {
- FileProvider = new NullFileProvider();
- }
- else if (fileProviders.Count == 1)
- {
- FileProvider = fileProviders[0];
- }
- else
- {
- FileProvider = new CompositeFileProvider(fileProviders);
- }
- }
-
- ///
- /// Gets the used to look up Razor files.
- ///
- public IFileProvider FileProvider { get; }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ExpressionRewriter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ExpressionRewriter.cs
deleted file mode 100644
index 6d3d9cc757..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ExpressionRewriter.cs
+++ /dev/null
@@ -1,215 +0,0 @@
-// 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.Diagnostics;
-using System.Linq.Expressions;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
-using Microsoft.CodeAnalysis.CSharp.Syntax;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- ///
- /// An expression rewriter which can hoist a simple expression lambda into a private field.
- ///
- public class ExpressionRewriter : CSharpSyntaxRewriter
- {
- private static readonly string FieldNameTemplate = "__h{0}";
-
- public ExpressionRewriter(SemanticModel semanticModel)
- {
- SemanticModel = semanticModel;
-
- Expressions = new List>();
- }
-
- // We only want to rewrite expressions for the top-level class definition.
- private bool IsInsideClass { get; set; }
-
- private SemanticModel SemanticModel { get; }
-
- private List> Expressions { get; }
-
- public static CSharpCompilation Rewrite(CSharpCompilation compilation)
- {
- var rewrittenTrees = new List();
- foreach (var tree in compilation.SyntaxTrees)
- {
- var semanticModel = compilation.GetSemanticModel(tree, ignoreAccessibility: true);
- var rewriter = new ExpressionRewriter(semanticModel);
-
- var rewrittenTree = tree.WithRootAndOptions(rewriter.Visit(tree.GetRoot()), tree.Options);
- rewrittenTrees.Add(rewrittenTree);
- }
-
- return compilation.RemoveAllSyntaxTrees().AddSyntaxTrees(rewrittenTrees);
- }
-
- public override SyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node)
- {
- if (IsInsideClass)
- {
- // Avoid recursing into nested classes.
- return node;
- }
-
- Expressions.Clear();
-
- IsInsideClass = true;
-
- // Call base first to visit all the children and populate Expressions.
- var classDeclaration = (ClassDeclarationSyntax)base.VisitClassDeclaration(node);
-
- IsInsideClass = false;
-
- var memberDeclarations = new List();
- foreach (var kvp in Expressions)
- {
- var expression = kvp.Key;
- var memberName = kvp.Value.GetFirstToken();
-
- var expressionType = SemanticModel.GetTypeInfo(expression).ConvertedType;
- var declaration = SyntaxFactory.FieldDeclaration(
- SyntaxFactory.List(),
- SyntaxFactory.TokenList(
- SyntaxFactory.Token(SyntaxKind.PrivateKeyword),
- SyntaxFactory.Token(SyntaxKind.StaticKeyword),
- SyntaxFactory.Token(SyntaxKind.ReadOnlyKeyword)),
- SyntaxFactory.VariableDeclaration(
- SyntaxFactory.ParseTypeName(expressionType.ToDisplayString(
- SymbolDisplayFormat.FullyQualifiedFormat)),
- SyntaxFactory.SingletonSeparatedList(
- SyntaxFactory.VariableDeclarator(
- memberName,
- SyntaxFactory.BracketedArgumentList(),
- SyntaxFactory.EqualsValueClause(expression)))))
- .WithTriviaFrom(expression);
- memberDeclarations.Add(declaration);
- }
-
- return classDeclaration.AddMembers(memberDeclarations.ToArray());
- }
-
- public override SyntaxNode VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node)
- {
- Debug.Assert(IsInsideClass);
-
- // If this lambda is an Expression and is suitable for hoisting, we rewrite this into a field access.
- //
- // Before:
- // public Task ExecuteAsync(...)
- // {
- // ...
- // Html.EditorFor(m => m.Price);
- // ...
- // }
- //
- //
- // After:
- // private static readonly Expression> __h0 = m => m.Price;
- // public Task ExecuteAsync(...)
- // {
- // ...
- // Html.EditorFor(__h0);
- // ...
- // }
- //
- var type = SemanticModel.GetTypeInfo(node);
-
- // Due to an anomaly where Roslyn (depending on code sample) may finish compilation without diagnostic
- // errors (this code path does not execute when diagnostic errors are present) we need to validate that
- // the ConvertedType was determined/is not null.
- if (type.ConvertedType == null ||
- type.ConvertedType.Name != typeof(Expression).Name &&
- type.ConvertedType.ContainingNamespace.Name != typeof(Expression).Namespace)
- {
- return node;
- }
-
- if (!node.Parent.IsKind(SyntaxKind.Argument))
- {
- return node;
- }
-
- var parameter = node.Parameter;
- if (IsValidForHoisting(parameter, node.Body))
- {
- // Replace with a MemberAccess
- var memberName = string.Format(FieldNameTemplate, Expressions.Count);
- var memberAccess = PadMemberAccess(node, SyntaxFactory.IdentifierName(memberName));
- Expressions.Add(new KeyValuePair(node, memberAccess));
- return memberAccess;
- }
-
- return node;
- }
-
- private static IdentifierNameSyntax PadMemberAccess(
- SimpleLambdaExpressionSyntax node,
- IdentifierNameSyntax memberAccess)
- {
- var charactersToExclude = memberAccess.Identifier.Text.Length;
- var triviaList = new SyntaxTriviaList();
-
- // Go through each token and
- // 1. Append leading trivia
- // 2. Append the same number of whitespace as the length of the token text
- // 3. Append trailing trivia
- foreach (var token in node.DescendantTokens())
- {
- if (token.HasLeadingTrivia)
- {
- triviaList = triviaList.AddRange(token.LeadingTrivia);
- }
-
- // Need to exclude the length of the member name from the padding.
- var padding = token.Text.Length;
- if (padding > charactersToExclude)
- {
- padding -= charactersToExclude;
- charactersToExclude = 0;
- }
- else
- {
- charactersToExclude -= padding;
- padding = 0;
- }
-
- if (padding > 0)
- {
- triviaList = triviaList.Add(SyntaxFactory.Whitespace(new string(' ', padding)));
- }
-
- if (token.HasTrailingTrivia)
- {
- triviaList = triviaList.AddRange(token.TrailingTrivia);
- }
- }
-
- return memberAccess
- .WithLeadingTrivia(node.GetLeadingTrivia())
- .WithTrailingTrivia(triviaList);
- }
-
- private static bool IsValidForHoisting(ParameterSyntax parameter, CSharpSyntaxNode node)
- {
- if (node.IsKind(SyntaxKind.IdentifierName))
- {
- var identifier = (IdentifierNameSyntax)node;
- if (identifier.Identifier.Text == parameter.Identifier.Text)
- {
- return true;
- }
- }
- else if (node.IsKind(SyntaxKind.SimpleMemberAccessExpression))
- {
- var memberAccess = (MemberAccessExpressionSyntax)node;
- var lhs = memberAccess.Expression;
- return IsValidForHoisting(parameter, lhs);
- }
-
- return false;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/FileProviderRazorProject.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/FileProviderRazorProject.cs
deleted file mode 100644
index 9e5718fa2f..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/FileProviderRazorProject.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-// 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.IO;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.Extensions.FileProviders;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- public class FileProviderRazorProjectFileSystem : RazorProjectFileSystem
- {
- private const string RazorFileExtension = ".cshtml";
- private readonly IFileProvider _provider;
- private readonly IHostingEnvironment _hostingEnvironment;
-
- public FileProviderRazorProjectFileSystem(IRazorViewEngineFileProviderAccessor accessor, IHostingEnvironment hostingEnvironment)
- {
- if (accessor == null)
- {
- throw new ArgumentNullException(nameof(accessor));
- }
-
- if (hostingEnvironment == null)
- {
- throw new ArgumentNullException(nameof(hostingEnvironment));
- }
-
- _provider = accessor.FileProvider;
- _hostingEnvironment = hostingEnvironment;
- }
-
- public override RazorProjectItem GetItem(string path)
- {
- path = NormalizeAndEnsureValidPath(path);
- var fileInfo = _provider.GetFileInfo(path);
-
- return new FileProviderRazorProjectItem(fileInfo, basePath: string.Empty, filePath: path, root: _hostingEnvironment.ContentRootPath);
- }
-
- public override IEnumerable EnumerateItems(string path)
- {
- path = NormalizeAndEnsureValidPath(path);
- return EnumerateFiles(_provider.GetDirectoryContents(path), path, prefix: string.Empty);
- }
-
- private IEnumerable EnumerateFiles(IDirectoryContents directory, string basePath, string prefix)
- {
- if (directory.Exists)
- {
- foreach (var fileInfo in directory)
- {
- if (fileInfo.IsDirectory)
- {
- var relativePath = prefix + "/" + fileInfo.Name;
- var subDirectory = _provider.GetDirectoryContents(JoinPath(basePath, relativePath));
- var children = EnumerateFiles(subDirectory, basePath, relativePath);
- foreach (var child in children)
- {
- yield return child;
- }
- }
- else if (string.Equals(RazorFileExtension, Path.GetExtension(fileInfo.Name), StringComparison.OrdinalIgnoreCase))
- {
- var filePath = prefix + "/" + fileInfo.Name;
-
- yield return new FileProviderRazorProjectItem(fileInfo, basePath, filePath: filePath, root: _hostingEnvironment.ContentRootPath);
- }
- }
- }
- }
-
- private static string JoinPath(string path1, string path2)
- {
- var hasTrailingSlash = path1.EndsWith("/", StringComparison.Ordinal);
- var hasLeadingSlash = path2.StartsWith("/", StringComparison.Ordinal);
- if (hasLeadingSlash && hasTrailingSlash)
- {
- return path1 + path2.Substring(1);
- }
- else if (hasLeadingSlash || hasTrailingSlash)
- {
- return path1 + path2;
- }
-
- return path1 + "/" + path2;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/FileProviderRazorProjectItem.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/FileProviderRazorProjectItem.cs
deleted file mode 100644
index 6108d6875b..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/FileProviderRazorProjectItem.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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 Microsoft.AspNetCore.Razor.Language;
-using Microsoft.Extensions.FileProviders;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- public class FileProviderRazorProjectItem : RazorProjectItem
- {
- private string _root;
- private string _relativePhysicalPath;
- private bool _isRelativePhysicalPathSet;
-
- public FileProviderRazorProjectItem(IFileInfo fileInfo, string basePath, string filePath, string root)
- {
- FileInfo = fileInfo;
- BasePath = basePath;
- FilePath = filePath;
- _root = root;
- }
-
- public IFileInfo FileInfo { get; }
-
- public override string BasePath { get; }
-
- public override string FilePath { get; }
-
- public override bool Exists => FileInfo.Exists;
-
- public override string PhysicalPath => FileInfo.PhysicalPath;
-
- public override string RelativePhysicalPath
- {
- get
- {
- if (!_isRelativePhysicalPathSet)
- {
- _isRelativePhysicalPathSet = true;
-
- if (Exists)
- {
- if (_root != null &&
- !string.IsNullOrEmpty(PhysicalPath) &&
- PhysicalPath.StartsWith(_root, StringComparison.OrdinalIgnoreCase) &&
- PhysicalPath.Length > _root.Length &&
- (PhysicalPath[_root.Length] == Path.DirectorySeparatorChar || PhysicalPath[_root.Length] == Path.AltDirectorySeparatorChar))
- {
- _relativePhysicalPath = PhysicalPath.Substring(_root.Length + 1); // Include leading separator
- }
- }
- }
-
- return _relativePhysicalPath;
- }
- }
-
- public override Stream Read()
- {
- return FileInfo.CreateReadStream();
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/IRazorViewEngineFileProviderAccessor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/IRazorViewEngineFileProviderAccessor.cs
deleted file mode 100644
index 670b7c3db3..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/IRazorViewEngineFileProviderAccessor.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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.FileProviders;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- ///
- /// Accessor to the used by .
- ///
- public interface IRazorViewEngineFileProviderAccessor
- {
- ///
- /// Gets the used to look up Razor files.
- ///
- IFileProvider FileProvider { get; }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/LazyMetadataReferenceFeature.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/LazyMetadataReferenceFeature.cs
deleted file mode 100644
index 5479991463..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/LazyMetadataReferenceFeature.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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 Microsoft.AspNetCore.Razor.Language;
-using Microsoft.AspNetCore.Mvc.Razor.Compilation;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Razor;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- public class LazyMetadataReferenceFeature : IMetadataReferenceFeature
- {
-#pragma warning disable CS0618 // Type or member is obsolete
- private readonly RazorReferenceManager _referenceManager;
-#pragma warning restore CS0618 // Type or member is obsolete
-
-#pragma warning disable CS0618 // Type or member is obsolete
- public LazyMetadataReferenceFeature(RazorReferenceManager referenceManager)
-#pragma warning restore CS0618 // Type or member is obsolete
- {
- _referenceManager = referenceManager;
- }
-
- ///
- /// Invoking ensures that compilation
- /// references are lazily evaluated.
- ///
- public IReadOnlyList References => _referenceManager.CompilationReferences;
-
- public RazorEngine Engine { get; set; }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/MvcRazorDiagnosticSourceExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/MvcRazorDiagnosticSourceExtensions.cs
deleted file mode 100644
index a60f5fb587..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/MvcRazorDiagnosticSourceExtensions.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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.Diagnostics;
-using Microsoft.AspNetCore.Mvc.Rendering;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- public static class MvcRazorDiagnosticSourceExtensions
- {
- public static void BeforeViewPage(
- this DiagnosticSource diagnosticSource,
- IRazorPage page,
- ViewContext viewContext)
- {
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.Razor.BeforeViewPage"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.Razor.BeforeViewPage",
- new
- {
- page = page,
- viewContext = viewContext,
- actionDescriptor = viewContext.ActionDescriptor,
- httpContext = viewContext.HttpContext,
- });
- }
- }
-
- public static void AfterViewPage(
- this DiagnosticSource diagnosticSource,
- IRazorPage page,
- ViewContext viewContext)
- {
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.Razor.AfterViewPage"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.Razor.AfterViewPage",
- new
- {
- page = page,
- viewContext = viewContext,
- actionDescriptor = viewContext.ActionDescriptor,
- httpContext = viewContext.HttpContext,
- });
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorViewCompiler.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorViewCompiler.cs
deleted file mode 100644
index 0f43c19f44..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorViewCompiler.cs
+++ /dev/null
@@ -1,475 +0,0 @@
-// 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.Concurrent;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Razor.Compilation;
-using Microsoft.AspNetCore.Razor.Hosting;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.CSharp;
-using Microsoft.CodeAnalysis.Emit;
-using Microsoft.CodeAnalysis.Text;
-using Microsoft.Extensions.Caching.Memory;
-using Microsoft.Extensions.FileProviders;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Primitives;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- ///
- /// Caches the result of runtime compilation of Razor files for the duration of the application lifetime.
- ///
- public class RazorViewCompiler : IViewCompiler
- {
- private readonly object _cacheLock = new object();
- private readonly Dictionary _precompiledViews;
- private readonly ConcurrentDictionary _normalizedPathCache;
- private readonly IFileProvider _fileProvider;
- private readonly RazorProjectEngine _projectEngine;
- private readonly Action _compilationCallback;
- private readonly IMemoryCache _cache;
- private readonly ILogger _logger;
- private readonly CSharpCompiler _csharpCompiler;
-
- public RazorViewCompiler(
- IFileProvider fileProvider,
- RazorProjectEngine projectEngine,
- CSharpCompiler csharpCompiler,
- Action compilationCallback,
- IList precompiledViews,
- IMemoryCache cache,
- ILogger logger)
- {
- if (fileProvider == null)
- {
- throw new ArgumentNullException(nameof(fileProvider));
- }
-
- if (projectEngine == null)
- {
- throw new ArgumentNullException(nameof(projectEngine));
- }
-
- if (csharpCompiler == null)
- {
- throw new ArgumentNullException(nameof(csharpCompiler));
- }
-
- if (compilationCallback == null)
- {
- throw new ArgumentNullException(nameof(compilationCallback));
- }
-
- if (precompiledViews == null)
- {
- throw new ArgumentNullException(nameof(precompiledViews));
- }
-
- if (logger == null)
- {
- throw new ArgumentNullException(nameof(logger));
- }
-
- _fileProvider = fileProvider;
- _projectEngine = projectEngine;
- _csharpCompiler = csharpCompiler;
- _compilationCallback = compilationCallback;
- _logger = logger;
-
-
- _normalizedPathCache = new ConcurrentDictionary(StringComparer.Ordinal);
-
- // This is our L0 cache, and is a durable store. Views migrate into the cache as they are requested
- // from either the set of known precompiled views, or by being compiled.
- _cache = cache;
-
- // We need to validate that the all of the precompiled views are unique by path (case-insensitive).
- // We do this because there's no good way to canonicalize paths on windows, and it will create
- // problems when deploying to linux. Rather than deal with these issues, we just don't support
- // views that differ only by case.
- _precompiledViews = new Dictionary(
- precompiledViews.Count,
- StringComparer.OrdinalIgnoreCase);
-
- foreach (var precompiledView in precompiledViews)
- {
- logger.ViewCompilerLocatedCompiledView(precompiledView.RelativePath);
-
- if (!_precompiledViews.ContainsKey(precompiledView.RelativePath))
- {
- // View ordering has precedence semantics, a view with a higher precedence was
- // already added to the list.
- _precompiledViews.Add(precompiledView.RelativePath, precompiledView);
- }
- }
-
- if (_precompiledViews.Count == 0)
- {
- logger.ViewCompilerNoCompiledViewsFound();
- }
- }
-
- public bool AllowRecompilingViewsOnFileChange { get; set; }
-
- ///
- public Task CompileAsync(string relativePath)
- {
- if (relativePath == null)
- {
- throw new ArgumentNullException(nameof(relativePath));
- }
-
- // Attempt to lookup the cache entry using the passed in path. This will succeed if the path is already
- // normalized and a cache entry exists.
- if (_cache.TryGetValue(relativePath, out Task cachedResult))
- {
- return cachedResult;
- }
-
- var normalizedPath = GetNormalizedPath(relativePath);
- if (_cache.TryGetValue(normalizedPath, out cachedResult))
- {
- return cachedResult;
- }
-
- // Entry does not exist. Attempt to create one.
- cachedResult = OnCacheMiss(normalizedPath);
- return cachedResult;
- }
-
- private Task OnCacheMiss(string normalizedPath)
- {
- ViewCompilerWorkItem item;
- TaskCompletionSource taskSource;
- MemoryCacheEntryOptions cacheEntryOptions;
-
- // Safe races cannot be allowed when compiling Razor pages. To ensure only one compilation request succeeds
- // per file, we'll lock the creation of a cache entry. Creating the cache entry should be very quick. The
- // actual work for compiling files happens outside the critical section.
- lock (_cacheLock)
- {
- // Double-checked locking to handle a possible race.
- if (_cache.TryGetValue(normalizedPath, out Task result))
- {
- return result;
- }
-
- if (_precompiledViews.TryGetValue(normalizedPath, out var precompiledView))
- {
- _logger.ViewCompilerLocatedCompiledViewForPath(normalizedPath);
- item = CreatePrecompiledWorkItem(normalizedPath, precompiledView);
- }
- else
- {
- item = CreateRuntimeCompilationWorkItem(normalizedPath);
- }
-
- // At this point, we've decided what to do - but we should create the cache entry and
- // release the lock first.
- cacheEntryOptions = new MemoryCacheEntryOptions();
-
- Debug.Assert(item.ExpirationTokens != null);
- for (var i = 0; i < item.ExpirationTokens.Count; i++)
- {
- cacheEntryOptions.ExpirationTokens.Add(item.ExpirationTokens[i]);
- }
-
- taskSource = new TaskCompletionSource(creationOptions: TaskCreationOptions.RunContinuationsAsynchronously);
- if (item.SupportsCompilation)
- {
- // We'll compile in just a sec, be patient.
- }
- else
- {
- // If we can't compile, we should have already created the descriptor
- Debug.Assert(item.Descriptor != null);
- taskSource.SetResult(item.Descriptor);
- }
-
- _cache.Set(normalizedPath, taskSource.Task, cacheEntryOptions);
- }
-
- // Now the lock has been released so we can do more expensive processing.
- if (item.SupportsCompilation)
- {
- Debug.Assert(taskSource != null);
-
- if (item.Descriptor?.Item != null &&
- ChecksumValidator.IsItemValid(_projectEngine.FileSystem, item.Descriptor.Item))
- {
- // If the item has checksums to validate, we should also have a precompiled view.
- Debug.Assert(item.Descriptor != null);
-
- taskSource.SetResult(item.Descriptor);
- return taskSource.Task;
- }
-
- _logger.ViewCompilerInvalidingCompiledFile(item.NormalizedPath);
- try
- {
- var descriptor = CompileAndEmit(normalizedPath);
- descriptor.ExpirationTokens = cacheEntryOptions.ExpirationTokens;
- taskSource.SetResult(descriptor);
- }
- catch (Exception ex)
- {
- taskSource.SetException(ex);
- }
- }
-
- return taskSource.Task;
- }
-
- private ViewCompilerWorkItem CreatePrecompiledWorkItem(string normalizedPath, CompiledViewDescriptor precompiledView)
- {
- // We have a precompiled view - but we're not sure that we can use it yet.
- //
- // We need to determine first if we have enough information to 'recompile' this view. If that's the case
- // we'll create change tokens for all of the files.
- //
- // Then we'll attempt to validate if any of those files have different content than the original sources
- // based on checksums.
- if (precompiledView.Item == null || !ChecksumValidator.IsRecompilationSupported(precompiledView.Item))
- {
- return new ViewCompilerWorkItem()
- {
- // If we don't have a checksum for the primary source file we can't recompile.
- SupportsCompilation = false,
-
- ExpirationTokens = Array.Empty(), // Never expire because we can't recompile.
- Descriptor = precompiledView, // This will be used as-is.
- };
- }
-
- var item = new ViewCompilerWorkItem()
- {
- SupportsCompilation = true,
-
- Descriptor = precompiledView, // This might be used, if the checksums match.
-
- // Used to validate and recompile
- NormalizedPath = normalizedPath,
-
- ExpirationTokens = GetExpirationTokens(precompiledView),
- };
-
- // We also need to create a new descriptor, because the original one doesn't have expiration tokens on
- // it. These will be used by the view location cache, which is like an L1 cache for views (this class is
- // the L2 cache).
- item.Descriptor = new CompiledViewDescriptor()
- {
- ExpirationTokens = item.ExpirationTokens,
- IsPrecompiled = true,
- Item = precompiledView.Item,
- RelativePath = precompiledView.RelativePath,
- ViewAttribute = precompiledView.ViewAttribute,
- };
-
- return item;
- }
-
- private ViewCompilerWorkItem CreateRuntimeCompilationWorkItem(string normalizedPath)
- {
- IList expirationTokens = Array.Empty();
-
- if (AllowRecompilingViewsOnFileChange)
- {
- var changeToken = _fileProvider.Watch(normalizedPath);
- expirationTokens = new List { changeToken };
- }
-
- var projectItem = _projectEngine.FileSystem.GetItem(normalizedPath);
- if (!projectItem.Exists)
- {
- _logger.ViewCompilerCouldNotFindFileAtPath(normalizedPath);
-
- // If the file doesn't exist, we can't do compilation right now - we still want to cache
- // the fact that we tried. This will allow us to re-trigger compilation if the view file
- // is added.
- return new ViewCompilerWorkItem()
- {
- // We don't have enough information to compile
- SupportsCompilation = false,
-
- Descriptor = new CompiledViewDescriptor()
- {
- RelativePath = normalizedPath,
- ExpirationTokens = expirationTokens,
- },
-
- // We can try again if the file gets created.
- ExpirationTokens = expirationTokens,
- };
- }
-
- _logger.ViewCompilerFoundFileToCompile(normalizedPath);
-
- GetChangeTokensFromImports(expirationTokens, projectItem);
-
- return new ViewCompilerWorkItem()
- {
- SupportsCompilation = true,
-
- NormalizedPath = normalizedPath,
- ExpirationTokens = expirationTokens,
- };
- }
-
- private IList GetExpirationTokens(CompiledViewDescriptor precompiledView)
- {
- if (!AllowRecompilingViewsOnFileChange)
- {
- return Array.Empty();
- }
-
- var checksums = precompiledView.Item.GetChecksumMetadata();
- var expirationTokens = new List(checksums.Count);
-
- for (var i = 0; i < checksums.Count; i++)
- {
- // We rely on Razor to provide the right set of checksums. Trust the compiler, it has to do a good job,
- // so it probably will.
- expirationTokens.Add(_fileProvider.Watch(checksums[i].Identifier));
- }
-
- return expirationTokens;
- }
-
- private void GetChangeTokensFromImports(IList expirationTokens, RazorProjectItem projectItem)
- {
- if (!AllowRecompilingViewsOnFileChange)
- {
- return;
- }
-
- // OK this means we can do compilation. For now let's just identify the other files we need to watch
- // so we can create the cache entry. Compilation will happen after we release the lock.
- var importFeature = _projectEngine.ProjectFeatures.OfType().FirstOrDefault();
-
- // There should always be an import feature unless someone has misconfigured their RazorProjectEngine.
- // In that case once we attempt to parse the Razor file we'll explode and give the a user a decent
- // error message; for now, lets just be extra protective and assume 0 imports to not give a bad error.
- var imports = importFeature?.GetImports(projectItem) ?? Enumerable.Empty();
- var physicalImports = imports.Where(import => import.FilePath != null);
-
- // Now that we have non-dynamic imports we need to get their RazorProjectItem equivalents so we have their
- // physical file paths (according to the FileSystem).
- foreach (var physicalImport in physicalImports)
- {
- expirationTokens.Add(_fileProvider.Watch(physicalImport.FilePath));
- }
- }
-
- protected virtual CompiledViewDescriptor CompileAndEmit(string relativePath)
- {
- var projectItem = _projectEngine.FileSystem.GetItem(relativePath);
- var codeDocument = _projectEngine.Process(projectItem);
- var cSharpDocument = codeDocument.GetCSharpDocument();
-
- if (cSharpDocument.Diagnostics.Count > 0)
- {
- throw CompilationFailedExceptionFactory.Create(
- codeDocument,
- cSharpDocument.Diagnostics);
- }
-
- var assembly = CompileAndEmit(codeDocument, cSharpDocument.GeneratedCode);
-
- // Anything we compile from source will use Razor 2.1 and so should have the new metadata.
- var loader = new RazorCompiledItemLoader();
- var item = loader.LoadItems(assembly).SingleOrDefault();
- var attribute = assembly.GetCustomAttribute();
-
- return new CompiledViewDescriptor(item, attribute);
- }
-
- internal Assembly CompileAndEmit(RazorCodeDocument codeDocument, string generatedCode)
- {
- _logger.GeneratedCodeToAssemblyCompilationStart(codeDocument.Source.FilePath);
-
- var startTimestamp = _logger.IsEnabled(LogLevel.Debug) ? Stopwatch.GetTimestamp() : 0;
-
- var assemblyName = Path.GetRandomFileName();
- var compilation = CreateCompilation(generatedCode, assemblyName);
-
- var emitOptions = _csharpCompiler.EmitOptions;
- var emitPdbFile = _csharpCompiler.EmitPdb && emitOptions.DebugInformationFormat != DebugInformationFormat.Embedded;
-
- using (var assemblyStream = new MemoryStream())
- using (var pdbStream = emitPdbFile ? new MemoryStream() : null)
- {
- var result = compilation.Emit(
- assemblyStream,
- pdbStream,
- options: emitOptions);
-
- if (!result.Success)
- {
- throw CompilationFailedExceptionFactory.Create(
- codeDocument,
- generatedCode,
- assemblyName,
- result.Diagnostics);
- }
-
- assemblyStream.Seek(0, SeekOrigin.Begin);
- pdbStream?.Seek(0, SeekOrigin.Begin);
-
- var assembly = Assembly.Load(assemblyStream.ToArray(), pdbStream?.ToArray());
- _logger.GeneratedCodeToAssemblyCompilationEnd(codeDocument.Source.FilePath, startTimestamp);
-
- return assembly;
- }
- }
-
- private CSharpCompilation CreateCompilation(string compilationContent, string assemblyName)
- {
- var sourceText = SourceText.From(compilationContent, Encoding.UTF8);
- var syntaxTree = _csharpCompiler.CreateSyntaxTree(sourceText).WithFilePath(assemblyName);
- var compilation = _csharpCompiler
- .CreateCompilation(assemblyName)
- .AddSyntaxTrees(syntaxTree);
- compilation = ExpressionRewriter.Rewrite(compilation);
-
- var compilationContext = new RoslynCompilationContext(compilation);
- _compilationCallback(compilationContext);
- compilation = compilationContext.Compilation;
- return compilation;
- }
-
- private string GetNormalizedPath(string relativePath)
- {
- Debug.Assert(relativePath != null);
- if (relativePath.Length == 0)
- {
- return relativePath;
- }
-
- if (!_normalizedPathCache.TryGetValue(relativePath, out var normalizedPath))
- {
- normalizedPath = ViewPath.NormalizePath(relativePath);
- _normalizedPathCache[relativePath] = normalizedPath;
- }
-
- return normalizedPath;
- }
-
- private class ViewCompilerWorkItem
- {
- public bool SupportsCompilation { get; set; }
-
- public string NormalizedPath { get; set; }
-
- public IList ExpirationTokens { get; set; }
-
- public CompiledViewDescriptor Descriptor { get; set; }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorViewCompilerProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorViewCompilerProvider.cs
deleted file mode 100644
index 3776bc845f..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorViewCompilerProvider.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-// 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.Threading;
-using Microsoft.AspNetCore.Mvc.ApplicationParts;
-using Microsoft.AspNetCore.Mvc.Razor.Compilation;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.Extensions.FileProviders;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- public class RazorViewCompilerProvider : IViewCompilerProvider
- {
- private readonly RazorProjectEngine _razorProjectEngine;
- private readonly ApplicationPartManager _applicationPartManager;
- private readonly IRazorViewEngineFileProviderAccessor _fileProviderAccessor;
- private readonly CSharpCompiler _csharpCompiler;
- private readonly IViewCompilationMemoryCacheProvider _compilationMemoryCacheProvider;
- private readonly RazorViewEngineOptions _viewEngineOptions;
- private readonly ILogger _logger;
- private readonly Func _createCompiler;
-
- private object _initializeLock = new object();
- private bool _initialized;
- private IViewCompiler _compiler;
-
- public RazorViewCompilerProvider(
- ApplicationPartManager applicationPartManager,
- RazorProjectEngine razorProjectEngine,
- IRazorViewEngineFileProviderAccessor fileProviderAccessor,
- CSharpCompiler csharpCompiler,
- IOptions viewEngineOptionsAccessor,
- IViewCompilationMemoryCacheProvider compilationMemoryCacheProvider,
- ILoggerFactory loggerFactory)
- {
- _applicationPartManager = applicationPartManager;
- _razorProjectEngine = razorProjectEngine;
- _fileProviderAccessor = fileProviderAccessor;
- _csharpCompiler = csharpCompiler;
- _compilationMemoryCacheProvider = compilationMemoryCacheProvider;
- _viewEngineOptions = viewEngineOptionsAccessor.Value;
-
- _logger = loggerFactory.CreateLogger();
- _createCompiler = CreateCompiler;
- }
-
- public IViewCompiler GetCompiler()
- {
- var fileProvider = _fileProviderAccessor.FileProvider;
- if (fileProvider is NullFileProvider)
- {
- var message = Resources.FormatFileProvidersAreRequired(
- typeof(RazorViewEngineOptions).FullName,
- nameof(RazorViewEngineOptions.FileProviders),
- typeof(IFileProvider).FullName);
- throw new InvalidOperationException(message);
- }
-
- return LazyInitializer.EnsureInitialized(
- ref _compiler,
- ref _initialized,
- ref _initializeLock,
- _createCompiler);
- }
-
- private IViewCompiler CreateCompiler()
- {
- var feature = new ViewsFeature();
- _applicationPartManager.PopulateFeature(feature);
-
- return new RazorViewCompiler(
- _fileProviderAccessor.FileProvider,
- _razorProjectEngine,
- _csharpCompiler,
-#pragma warning disable CS0618 // Type or member is obsolete
- _viewEngineOptions.CompilationCallback,
-#pragma warning restore CS0618 // Type or member is obsolete
- feature.ViewDescriptors,
- _compilationMemoryCacheProvider.CompilationMemoryCache,
- _logger)
- {
- AllowRecompilingViewsOnFileChange = _viewEngineOptions.AllowRecompilingViewsOnFileChange,
- };
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/SymbolsUtility.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/SymbolsUtility.cs
deleted file mode 100644
index 280fe8c84a..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/SymbolsUtility.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// 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.Runtime.InteropServices;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
-{
- ///
- /// Utility type for determining if a platform supports full pdb file generation.
- ///
- internal static class SymbolsUtility
- {
- // Native pdb writer's CLSID
- private const string SymWriterGuid = "0AE2DEB0-F901-478b-BB9F-881EE8066788";
-
- ///
- /// Determines if the current platform supports full pdb generation.
- ///
- /// true if full pdb generation is supported; false otherwise.
- public static bool SupportsFullPdbGeneration()
- {
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- // Cross-plat always produce portable pdbs.
- return false;
- }
-
- if (Type.GetType("Mono.Runtime") != null)
- {
- return false;
- }
-
- try
- {
- // Check for the pdb writer component that roslyn uses to generate pdbs
- var type = Marshal.GetTypeFromCLSID(new Guid(SymWriterGuid));
- if (type != null)
- {
- // This line will throw if pdb generation is not supported.
- Activator.CreateInstance(type);
- return true;
- }
- }
- catch
- {
- }
-
- return false;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/LanguageViewLocationExpander.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/LanguageViewLocationExpander.cs
index 1ed92110bc..94338ef371 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/LanguageViewLocationExpander.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/LanguageViewLocationExpander.cs
@@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
}
///
- /// Instantiates a new instance.
+ /// Instantiates a new instance.
///
/// The .
public LanguageViewLocationExpander(LanguageViewLocationExpanderFormat format)
@@ -112,4 +112,4 @@ namespace Microsoft.AspNetCore.Mvc.Razor
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.csproj
index 4bef4f811f..6936a83ba6 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.csproj
@@ -2,59 +2,18 @@
ASP.NET Core MVC Razor view engine for CSHTML files.
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc;cshtml;razor
- $(MSBuildProjectName).nuspec
- true
-
-
-
-
-
-
-
-
-
-
-
- true
-
- id=$(MSBuildProjectName);
- version=$(PackageVersion);
- authors=$(Authors);
- licenseUrl=$(PackageLicenseUrl);
- projectUrl=$(PackageProjectUrl);
- iconUrl=$(PackageIconUrl);
- copyright=$(Copyright);
- description=$(Description);
- tags=$([MSBuild]::Escape($(PackageTags)));
- serviceable=$(Serviceable);
- repositoryUrl=$(RepositoryUrl);
- repositoryCommit=$(RepositoryCommit);
- targetframework=$(TargetFramework);
- MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion=$(MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion);
- MicrosoftAspNetCoreRazorRuntimePackageVersion=$(MicrosoftAspNetCoreRazorRuntimePackageVersion);
- MicrosoftCodeAnalysisRazorPackageVersion=$(MicrosoftCodeAnalysisRazorPackageVersion);
- MicrosoftCodeAnalysisCSharpPackageVersion=$(MicrosoftCodeAnalysisCSharpPackageVersion);
- MicrosoftExtensionsCachingMemoryPackageVersion=$(MicrosoftExtensionsCachingMemoryPackageVersion);
- MicrosoftExtensionsFileProvidersCompositePackageVersion=$(MicrosoftExtensionsFileProvidersCompositePackageVersion);
- MicrosoftDiaSymReaderNativePackageVersion=$(MicrosoftDiaSymReaderNativePackageVersion);
- OutputBinary=@(BuiltProjectOutputGroupOutput);
- OutputDocumentation=@(DocumentationProjectOutputGroupOutput);
- OutputSymbol=@(DebugSymbolsProjectOutputGroupOutput);
-
-
-
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.nuspec b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.nuspec
deleted file mode 100644
index 9ff2439b96..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.nuspec
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
- $id$
- $version$
- $authors$
- true
- $licenseUrl$
- $projectUrl$
- $iconUrl$
- $description$
- $copyright$
- $tags$
- $serviceable$
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorDiagnosticSourceExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorDiagnosticSourceExtensions.cs
new file mode 100644
index 0000000000..f0479ef143
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorDiagnosticSourceExtensions.cs
@@ -0,0 +1,73 @@
+// 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.Diagnostics;
+using Microsoft.AspNetCore.Mvc.Rendering;
+
+namespace Microsoft.AspNetCore.Mvc.Razor
+{
+ internal static class MvcRazorDiagnosticSourceExtensions
+ {
+ public static void BeforeViewPage(
+ this DiagnosticListener diagnosticListener,
+ IRazorPage page,
+ ViewContext viewContext)
+ {
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeViewPageImpl(diagnosticListener, page, viewContext);
+ }
+ }
+
+ private static void BeforeViewPageImpl(
+ this DiagnosticListener diagnosticListener,
+ IRazorPage page,
+ ViewContext viewContext)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.Razor.BeforeViewPage"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.Razor.BeforeViewPage",
+ new
+ {
+ page = page,
+ viewContext = viewContext,
+ actionDescriptor = viewContext.ActionDescriptor,
+ httpContext = viewContext.HttpContext,
+ });
+ }
+ }
+
+ public static void AfterViewPage(
+ this DiagnosticListener diagnosticListener,
+ IRazorPage page,
+ ViewContext viewContext)
+ {
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterViewPageImpl(diagnosticListener, page, viewContext);
+ }
+ }
+
+ private static void AfterViewPageImpl(
+ this DiagnosticListener diagnosticListener,
+ IRazorPage page,
+ ViewContext viewContext)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.Razor.AfterViewPage"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.Razor.AfterViewPage",
+ new
+ {
+ page = page,
+ viewContext = viewContext,
+ actionDescriptor = viewContext.ActionDescriptor,
+ httpContext = viewContext.HttpContext,
+ });
+ }
+ }
+ }
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/MvcRazorLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorLoggerExtensions.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/MvcRazorLoggerExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorLoggerExtensions.cs
index 21d7496abd..58a1123cc7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/MvcRazorLoggerExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorLoggerExtensions.cs
@@ -2,14 +2,12 @@
// 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.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.AspNetCore.Mvc.Razor
{
- public static class MvcRazorLoggerExtensions
+ internal static class MvcRazorLoggerExtensions
{
private static readonly double TimestampToTicks = TimeSpan.TicksPerSecond / (double)Stopwatch.Frequency;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Properties/AssemblyInfo.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Properties/AssemblyInfo.cs
index 0e1a8e8695..5bd88d4693 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Properties/AssemblyInfo.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Properties/AssemblyInfo.cs
@@ -10,3 +10,5 @@ using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.RazorPages.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.TagHelpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+
+[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorFileHierarchy.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorFileHierarchy.cs
new file mode 100644
index 0000000000..89f7b43dd2
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorFileHierarchy.cs
@@ -0,0 +1,44 @@
+// 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.Text;
+
+namespace Microsoft.AspNetCore.Mvc.Razor
+{
+ internal static class RazorFileHierarchy
+ {
+ private const string ViewStartFileName = "_ViewStart.cshtml";
+
+ public static IEnumerable GetViewStartPaths(string path)
+ {
+ if (string.IsNullOrEmpty(path))
+ {
+ throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(path));
+ }
+
+ if (path[0] != '/')
+ {
+ throw new ArgumentException(Resources.RazorProject_PathMustStartWithForwardSlash, nameof(path));
+ }
+
+ if (path.Length == 1)
+ {
+ yield break;
+ }
+
+ var builder = new StringBuilder(path);
+ var maxIterations = 255;
+ var index = path.Length;
+ while (maxIterations-- > 0 && index > 1 && (index = path.LastIndexOf('/', index - 1)) != -1)
+ {
+ builder.Length = index + 1;
+ builder.Append(ViewStartFileName);
+
+ var itemPath = builder.ToString();
+ yield return itemPath;
+ }
+ }
+ }
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorPageActivator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorPageActivator.cs
index cc9a20c8cb..9acc858e5a 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorPageActivator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorPageActivator.cs
@@ -7,7 +7,6 @@ using System.Diagnostics;
using System.Reflection;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorPageBase.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorPageBase.cs
index 016076520f..8f2a98defa 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorPageBase.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorPageBase.cs
@@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.DependencyInjection;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorPagePropertyActivator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorPagePropertyActivator.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorPagePropertyActivator.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorPagePropertyActivator.cs
index b163088361..5bcba01b62 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorPagePropertyActivator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorPagePropertyActivator.cs
@@ -6,15 +6,15 @@ using System.Diagnostics;
using System.Reflection;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Mvc.ModelBinding;
+using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.AspNetCore.Mvc.Razor
{
- public class RazorPagePropertyActivator
+ internal class RazorPagePropertyActivator
{
private readonly IModelMetadataProvider _metadataProvider;
private readonly Func _rootFactory;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorView.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorView.cs
index 10ef8139da..8b5b3ebe90 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorView.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorView.cs
@@ -9,8 +9,7 @@ using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
-using Microsoft.AspNetCore.Mvc.Razor.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Razor
@@ -24,7 +23,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
private readonly IRazorViewEngine _viewEngine;
private readonly IRazorPageActivator _pageActivator;
private readonly HtmlEncoder _htmlEncoder;
- private readonly DiagnosticSource _diagnosticSource;
+ private readonly DiagnosticListener _diagnosticListener;
private IViewBufferScope _bufferScope;
///
@@ -36,14 +35,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor
///
/// The instance to execute.
/// The HTML encoder.
- /// The .
+ /// The .
public RazorView(
IRazorViewEngine viewEngine,
IRazorPageActivator pageActivator,
IReadOnlyList viewStartPages,
IRazorPage razorPage,
HtmlEncoder htmlEncoder,
- DiagnosticSource diagnosticSource)
+ DiagnosticListener diagnosticListener)
{
if (viewEngine == null)
{
@@ -70,9 +69,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor
throw new ArgumentNullException(nameof(htmlEncoder));
}
- if (diagnosticSource == null)
+ if (diagnosticListener == null)
{
- throw new ArgumentNullException(nameof(diagnosticSource));
+ throw new ArgumentNullException(nameof(diagnosticListener));
}
_viewEngine = viewEngine;
@@ -80,7 +79,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
ViewStartPages = viewStartPages;
RazorPage = razorPage;
_htmlEncoder = htmlEncoder;
- _diagnosticSource = diagnosticSource;
+ _diagnosticListener = diagnosticListener;
}
///
@@ -171,7 +170,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
OnAfterPageActivated?.Invoke(page, context);
- _diagnosticSource.BeforeViewPage(page, context);
+ _diagnosticListener.BeforeViewPage(page, context);
try
{
@@ -179,7 +178,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
}
finally
{
- _diagnosticSource.AfterViewPage(page, context);
+ _diagnosticListener.AfterViewPage(page, context);
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs
index 8d929fb883..ad87fbb64b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs
@@ -7,10 +7,8 @@ using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text.Encodings.Web;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.Razor.Internal;
+using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewEngines;
-using Microsoft.AspNetCore.Razor.Language;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
@@ -30,7 +28,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor
public class RazorViewEngine : IRazorViewEngine
{
public static readonly string ViewExtension = ".cshtml";
- private const string ViewStartFileName = "_ViewStart.cshtml";
private const string AreaKey = "area";
private const string ControllerKey = "controller";
@@ -43,21 +40,18 @@ namespace Microsoft.AspNetCore.Mvc.Razor
private readonly HtmlEncoder _htmlEncoder;
private readonly ILogger _logger;
private readonly RazorViewEngineOptions _options;
- private readonly RazorProject _razorFileSystem;
- private readonly DiagnosticSource _diagnosticSource;
+ private readonly DiagnosticListener _diagnosticListener;
///
/// Initializes a new instance of the .
///
- [Obsolete("This constructor is obsolete and will be removed in a future version.")]
public RazorViewEngine(
IRazorPageFactoryProvider pageFactory,
IRazorPageActivator pageActivator,
HtmlEncoder htmlEncoder,
IOptions optionsAccessor,
- RazorProject razorProject,
ILoggerFactory loggerFactory,
- DiagnosticSource diagnosticSource)
+ DiagnosticListener diagnosticListener)
{
_options = optionsAccessor.Value;
@@ -79,28 +73,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor
_pageActivator = pageActivator;
_htmlEncoder = htmlEncoder;
_logger = loggerFactory.CreateLogger();
- _razorFileSystem = razorProject;
- _diagnosticSource = diagnosticSource;
+ _diagnosticListener = diagnosticListener;
ViewLookupCache = new MemoryCache(new MemoryCacheOptions());
}
- ///
- /// Initializes a new instance of the RazorViewEngine
- ///
- public RazorViewEngine(
- IRazorPageFactoryProvider pageFactory,
- IRazorPageActivator pageActivator,
- HtmlEncoder htmlEncoder,
- IOptions optionsAccessor,
- RazorProjectFileSystem razorFileSystem,
- ILoggerFactory loggerFactory,
- DiagnosticSource diagnosticSource)
-#pragma warning disable CS0618 // Type or member is obsolete
- : this (pageFactory, pageActivator, htmlEncoder, optionsAccessor, (RazorProject)razorFileSystem, loggerFactory, diagnosticSource)
-#pragma warning restore CS0618 // Type or member is obsolete
- {
- }
-
///
/// A cache for results of view lookups.
///
@@ -440,10 +416,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor
var viewStartPages = isMainPage ?
GetViewStartPages(viewDescriptor.RelativePath, expirationTokens) :
Array.Empty();
- if (viewDescriptor.IsPrecompiled)
- {
- _logger.PrecompiledViewFound(relativePath);
- }
return new ViewLocationCacheResult(
new ViewLocationCacheItem(factoryResult.RazorPageFactory, relativePath),
@@ -459,9 +431,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor
{
var viewStartPages = new List();
- foreach (var viewStartProjectItem in _razorFileSystem.FindHierarchicalItems(path, ViewStartFileName))
+ foreach (var filePath in RazorFileHierarchy.GetViewStartPaths(path))
{
- var result = _pageFactory.CreateFactory(viewStartProjectItem.FilePath);
+ var result = _pageFactory.CreateFactory(filePath);
var viewDescriptor = result.ViewDescriptor;
if (viewDescriptor?.ExpirationTokens != null)
{
@@ -476,7 +448,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
// Populate the viewStartPages list so that _ViewStarts appear in the order the need to be
// executed (closest last, furthest first). This is the reverse order in which
// ViewHierarchyUtility.GetViewStartLocations returns _ViewStarts.
- viewStartPages.Insert(0, new ViewLocationCacheItem(result.RazorPageFactory, viewStartProjectItem.FilePath));
+ viewStartPages.Insert(0, new ViewLocationCacheItem(result.RazorPageFactory, filePath));
}
}
@@ -499,7 +471,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
viewStarts[i] = viewStartItem.PageFactory();
}
- var view = new RazorView(this, _pageActivator, viewStarts, page, _htmlEncoder, _diagnosticSource);
+ var view = new RazorView(this, _pageActivator, viewStarts, page, _htmlEncoder, _diagnosticListener);
return ViewEngineResult.Found(viewName, view);
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptions.cs
index 6c6148cb24..d6100bc4e7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptions.cs
@@ -1,50 +1,20 @@
// 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;
using System.Collections.Generic;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Razor.Compilation;
-using Microsoft.CodeAnalysis;
-using Microsoft.Extensions.FileProviders;
namespace Microsoft.AspNetCore.Mvc.Razor
{
///
/// Provides programmatic configuration for the .
///
- public class RazorViewEngineOptions : IEnumerable
+ public class RazorViewEngineOptions
{
- private readonly ICompatibilitySwitch[] _switches;
- private readonly CompatibilitySwitch _allowRecompilingViewsOnFileChange;
- private Action _compilationCallback = c => { };
-
- public RazorViewEngineOptions()
- {
- _allowRecompilingViewsOnFileChange = new CompatibilitySwitch(nameof(AllowRecompilingViewsOnFileChange));
- _switches = new[]
- {
- _allowRecompilingViewsOnFileChange,
- };
- }
-
///
/// Gets a used by the .
///
public IList ViewLocationExpanders { get; } = new List();
- ///
- /// Gets the sequence of instances used by to
- /// locate Razor files.
- ///
- ///
- /// At startup, this is initialized to include an instance of
- /// that is rooted at the application root.
- ///
- public IList FileProviders { get; } = new List();
-
///
/// Gets the locations where will search for views.
///
@@ -165,81 +135,5 @@ namespace Microsoft.AspNetCore.Mvc.Razor
///
///
public IList AreaPageViewLocationFormats { get; } = new List();
-
- ///
- /// Gets the instances that should be included in Razor compilation, along with
- /// those discovered by s.
- ///
- [Obsolete("This property is obsolete and will be removed in a future version. See https://aka.ms/AA1x4gg for details.")]
- public IList AdditionalCompilationReferences { get; } = new List();
-
- ///
- /// Gets or sets the callback that is used to customize Razor compilation
- /// to change compilation settings you can update property.
- ///
- ///
- /// Customizations made here would not reflect in tooling (Intellisense).
- ///
- [Obsolete("This property is obsolete and will be removed in a future version. See https://aka.ms/AA1x4gg for details.")]
- public Action CompilationCallback
- {
- get => _compilationCallback;
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- _compilationCallback = value;
- }
- }
-
- ///
- /// Gets or sets a value that determines if Razor files (Razor Views and Razor Pages) are recompiled and updated
- /// if files change on disk.
- ///
- /// When , MVC will use to watch for changes to
- /// Razor files in configured instances.
- ///
- ///
- ///
- /// The default value is if the version is
- /// or earlier. If the version is later and is Development,
- /// the default value is . Otherwise, the default value is .
- ///
- ///
- ///
- /// This property is associated with a compatibility switch and can provide a different behavior depending on
- /// the configured compatibility version for the application. See for
- /// guidance and examples of setting the application's compatibility version.
- ///
- ///
- /// Configuring the desired value of the compatibility switch by calling this property's setter will take
- /// precedence over the value implied by the application's .
- ///
- ///
- /// If the application's compatibility version is set to or
- /// lower then this setting will have the value unless explicitly configured.
- ///
- ///
- /// If the application's compatibility version is set to or
- /// higher then this setting will have the value unless
- /// is Development or the value is explicitly configured.
- ///
- ///
- public bool AllowRecompilingViewsOnFileChange
- {
- // Note: When compatibility switches are removed in 3.0, this property should be retained as a regular boolean property.
- get => _allowRecompilingViewsOnFileChange.Value;
- set => _allowRecompilingViewsOnFileChange.Value = value;
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return ((IEnumerable)_switches).GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator() => _switches.GetEnumerator();
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptionsSetup.cs
index 6747d87726..d6ffc66da3 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptionsSetup.cs
@@ -2,45 +2,20 @@
// 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.Hosting;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Razor
{
- internal class RazorViewEngineOptionsSetup :
- ConfigureCompatibilityOptions,
- IConfigureOptions
+ internal class RazorViewEngineOptionsSetup : IConfigureOptions
{
private readonly IHostingEnvironment _hostingEnvironment;
- public RazorViewEngineOptionsSetup(
- IHostingEnvironment hostingEnvironment,
- ILoggerFactory loggerFactory,
- IOptions compatibilityOptions)
- : base(loggerFactory, compatibilityOptions)
+ public RazorViewEngineOptionsSetup(IHostingEnvironment hostingEnvironment)
{
_hostingEnvironment = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment));
}
- protected override IReadOnlyDictionary DefaultValues
- {
- get
- {
- var values = new Dictionary();
- if (Version < CompatibilityVersion.Version_2_2)
- {
- // Default to true in 2.1 or earlier. In 2.2, we have to conditionally enable this
- // and consequently this switch has no default value.
- values[nameof(RazorViewEngineOptions.AllowRecompilingViewsOnFileChange)] = true;
- }
-
- return values;
- }
- }
-
public void Configure(RazorViewEngineOptions options)
{
if (options == null)
@@ -48,22 +23,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor
throw new ArgumentNullException(nameof(options));
}
- if (_hostingEnvironment.ContentRootFileProvider != null)
- {
- options.FileProviders.Add(_hostingEnvironment.ContentRootFileProvider);
- }
-
options.ViewLocationFormats.Add("/Views/{1}/{0}" + RazorViewEngine.ViewExtension);
options.ViewLocationFormats.Add("/Views/Shared/{0}" + RazorViewEngine.ViewExtension);
options.AreaViewLocationFormats.Add("/Areas/{2}/Views/{1}/{0}" + RazorViewEngine.ViewExtension);
options.AreaViewLocationFormats.Add("/Areas/{2}/Views/Shared/{0}" + RazorViewEngine.ViewExtension);
options.AreaViewLocationFormats.Add("/Views/Shared/{0}" + RazorViewEngine.ViewExtension);
-
- if (_hostingEnvironment.IsDevelopment())
- {
- options.AllowRecompilingViewsOnFileChange = true;
- }
}
}
}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ServiceBasedTagHelperActivator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ServiceBasedTagHelperActivator.cs
similarity index 87%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ServiceBasedTagHelperActivator.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ServiceBasedTagHelperActivator.cs
index d5ba1e6409..142efbe256 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ServiceBasedTagHelperActivator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ServiceBasedTagHelperActivator.cs
@@ -6,13 +6,13 @@ using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.DependencyInjection;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.AspNetCore.Mvc.Razor
{
///
/// A that retrieves tag helpers as services from the request's
/// .
///
- public class ServiceBasedTagHelperActivator : ITagHelperActivator
+ internal class ServiceBasedTagHelperActivator : ITagHelperActivator
{
///
public TTagHelper Create(ViewContext context) where TTagHelper : ITagHelper
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/TagHelperComponentManager.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/TagHelperComponentManager.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/TagHelperComponentManager.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/TagHelperComponentManager.cs
index 38dde4f941..bdbaba846d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/TagHelperComponentManager.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/TagHelperComponentManager.cs
@@ -6,12 +6,12 @@ using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Razor.TagHelpers;
using Microsoft.AspNetCore.Razor.TagHelpers;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.AspNetCore.Mvc.Razor
{
///
/// The default implementation of the .
///
- public class TagHelperComponentManager : ITagHelperComponentManager
+ internal class TagHelperComponentManager : ITagHelperComponentManager
{
///
/// Creates a new .
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/TagHelpers/TagHelperComponentTagHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/TagHelpers/TagHelperComponentTagHelper.cs
index ddf68268bd..14f11998c9 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/TagHelpers/TagHelperComponentTagHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/TagHelpers/TagHelperComponentTagHelper.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewLocationCacheItem.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewLocationCacheItem.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewLocationCacheItem.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewLocationCacheItem.cs
index 64333eb02f..7ba1140bc8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewLocationCacheItem.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewLocationCacheItem.cs
@@ -3,12 +3,12 @@
using System;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.AspNetCore.Mvc.Razor
{
///
/// An item in .
///
- public readonly struct ViewLocationCacheItem
+ internal readonly struct ViewLocationCacheItem
{
///
/// Initializes a new instance of .
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewLocationCacheKey.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewLocationCacheKey.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewLocationCacheKey.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewLocationCacheKey.cs
index 00f3d3c8ec..2640110dd5 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewLocationCacheKey.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewLocationCacheKey.cs
@@ -5,12 +5,12 @@ using System;
using System.Collections.Generic;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.AspNetCore.Mvc.Razor
{
///
/// Key for entries in .
///
- public readonly struct ViewLocationCacheKey : IEquatable
+ internal readonly struct ViewLocationCacheKey : IEquatable
{
///
/// Initializes a new instance of .
@@ -111,8 +111,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
foreach (var item in ViewLocationExpanderValues)
{
- string yValue;
- if (!y.ViewLocationExpanderValues.TryGetValue(item.Key, out yValue) ||
+ if (!y.ViewLocationExpanderValues.TryGetValue(item.Key, out var yValue) ||
!string.Equals(item.Value, yValue, StringComparison.Ordinal))
{
return false;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewLocationCacheResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewLocationCacheResult.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewLocationCacheResult.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewLocationCacheResult.cs
index c703bcaf19..2b72934aa3 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewLocationCacheResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewLocationCacheResult.cs
@@ -4,12 +4,12 @@
using System;
using System.Collections.Generic;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.AspNetCore.Mvc.Razor
{
///
/// Result of view location cache lookup.
///
- public class ViewLocationCacheResult
+ internal class ViewLocationCacheResult
{
///
/// Initializes a new instance of
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewPath.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewPath.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewPath.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewPath.cs
index 813493ee76..640dc69432 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Internal/ViewPath.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ViewPath.cs
@@ -3,9 +3,9 @@
using Microsoft.Extensions.Primitives;
-namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+namespace Microsoft.AspNetCore.Mvc.Razor
{
- public static class ViewPath
+ internal static class ViewPath
{
public static string NormalizePath(string path)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/breakingchanges.netcore.json b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/breakingchanges.netcore.json
new file mode 100644
index 0000000000..c238459693
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/breakingchanges.netcore.json
@@ -0,0 +1,67 @@
+[
+ {
+ "TypeId": "public abstract class Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorReferenceManager",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException : System.Exception, Microsoft.AspNetCore.Diagnostics.ICompilationException",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.Compilation.MetadataReferenceFeature",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.Compilation.MetadataReferenceFeatureProvider : Microsoft.AspNetCore.Mvc.ApplicationParts.IApplicationFeatureProvider",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.Compilation.RoslynCompilationContext",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine : Microsoft.AspNetCore.Mvc.Razor.IRazorViewEngine",
+ "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.Razor.IRazorPageFactoryProvider pageFactory, Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator pageActivator, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.Extensions.Options.IOptions optionsAccessor, Microsoft.AspNetCore.Razor.Language.RazorProject razorProject, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Diagnostics.DiagnosticSource diagnosticSource)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine : Microsoft.AspNetCore.Mvc.Razor.IRazorViewEngine",
+ "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.Razor.IRazorPageFactoryProvider pageFactory, Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator pageActivator, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.Extensions.Options.IOptions optionsAccessor, Microsoft.AspNetCore.Razor.Language.RazorProjectFileSystem razorFileSystem, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Diagnostics.DiagnosticSource diagnosticSource)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.RazorView : Microsoft.AspNetCore.Mvc.ViewEngines.IView",
+ "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.Razor.IRazorViewEngine viewEngine, Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator pageActivator, System.Collections.Generic.IReadOnlyList viewStartPages, Microsoft.AspNetCore.Mvc.Razor.IRazorPage razorPage, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, System.Diagnostics.DiagnosticSource diagnosticSource)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions",
+ "MemberId": "public System.Action get_CompilationCallback()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions",
+ "MemberId": "public System.Collections.Generic.IList get_AdditionalCompilationReferences()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions",
+ "MemberId": "public System.Void set_CompilationCallback(System.Action value)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions",
+ "MemberId": "public System.Collections.Generic.IList get_FileProviders()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.Compilation.CompiledViewDescriptor",
+ "MemberId": "public System.Boolean get_IsPrecompiled()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.Compilation.CompiledViewDescriptor",
+ "MemberId": "public System.Void set_IsPrecompiled(System.Boolean value)",
+ "Kind": "Removal"
+ }
+]
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/AuthorizationPageApplicationModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/AuthorizationPageApplicationModelProvider.cs
similarity index 86%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/AuthorizationPageApplicationModelProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/AuthorizationPageApplicationModelProvider.cs
index ad047c1ede..78fc43500e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/AuthorizationPageApplicationModelProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/AuthorizationPageApplicationModelProvider.cs
@@ -4,13 +4,11 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Authorization;
-using Microsoft.AspNetCore.Mvc.Internal;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
- public class AuthorizationPageApplicationModelProvider : IPageApplicationModelProvider
+ internal class AuthorizationPageApplicationModelProvider : IPageApplicationModelProvider
{
private readonly IAuthorizationPolicyProvider _policyProvider;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/AutoValidateAntiforgeryPageApplicationModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/AutoValidateAntiforgeryPageApplicationModelProvider.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/AutoValidateAntiforgeryPageApplicationModelProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/AutoValidateAntiforgeryPageApplicationModelProvider.cs
index 5503ba5d03..b4fca876d8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/AutoValidateAntiforgeryPageApplicationModelProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/AutoValidateAntiforgeryPageApplicationModelProvider.cs
@@ -6,7 +6,7 @@ using System.Linq;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-namespace Microsoft.AspNetCore.Mvc.RazorPages
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
internal class AutoValidateAntiforgeryPageApplicationModelProvider : IPageApplicationModelProvider
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/CompiledPageActionDescriptorBuilder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/CompiledPageActionDescriptorBuilder.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/CompiledPageActionDescriptorBuilder.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/CompiledPageActionDescriptorBuilder.cs
index 41055bf878..96f7b895af 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/CompiledPageActionDescriptorBuilder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/CompiledPageActionDescriptorBuilder.cs
@@ -4,16 +4,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
///
/// Constructs a from an .
///
- public static class CompiledPageActionDescriptorBuilder
+ internal static class CompiledPageActionDescriptorBuilder
{
///
/// Creates a from the specified .
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/CompiledPageRouteModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/CompiledPageRouteModelProvider.cs
similarity index 80%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/CompiledPageRouteModelProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/CompiledPageRouteModelProvider.cs
index 544521e5a7..7471af285f 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/CompiledPageRouteModelProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/CompiledPageRouteModelProvider.cs
@@ -4,38 +4,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Razor.Compilation;
-using Microsoft.AspNetCore.Mvc.Razor.Extensions;
-using Microsoft.AspNetCore.Mvc.Razor.Internal;
+using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
using Microsoft.AspNetCore.Razor.Hosting;
-using Microsoft.AspNetCore.Razor.Language;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
- public class CompiledPageRouteModelProvider : IPageRouteModelProvider
+ internal class CompiledPageRouteModelProvider : IPageRouteModelProvider
{
+ private static readonly string RazorPageDocumentKind = "mvc.1.0.razor-page";
+ private static readonly string RouteTemplateKey = "RouteTemplate";
private readonly ApplicationPartManager _applicationManager;
private readonly RazorPagesOptions _pagesOptions;
- private readonly RazorProjectEngine _razorProjectEngine;
- private readonly ILogger _logger;
private readonly PageRouteModelFactory _routeModelFactory;
public CompiledPageRouteModelProvider(
ApplicationPartManager applicationManager,
IOptions pagesOptionsAccessor,
- RazorProjectEngine razorProjectEngine,
ILogger logger)
{
_applicationManager = applicationManager ?? throw new ArgumentNullException(nameof(applicationManager));
_pagesOptions = pagesOptionsAccessor?.Value ?? throw new ArgumentNullException(nameof(pagesOptionsAccessor));
- _razorProjectEngine = razorProjectEngine ?? throw new ArgumentNullException(nameof(razorProjectEngine));
- _logger = logger ?? throw new ArgumentNullException(nameof(razorProjectEngine));
- _routeModelFactory = new PageRouteModelFactory(_pagesOptions, _logger);
+ _routeModelFactory = new PageRouteModelFactory(_pagesOptions, logger);
}
public int Order => -1000;
@@ -76,11 +70,6 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
continue;
}
- if (!viewDescriptor.IsPrecompiled)
- {
- continue;
- }
-
if (IsRazorPage(viewDescriptor))
{
yield return viewDescriptor;
@@ -91,7 +80,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
{
if (viewDescriptor.Item != null)
{
- return viewDescriptor.Item.Kind == RazorPageDocumentClassifierPass.RazorPageDocumentKind;
+ return viewDescriptor.Item.Kind == RazorPageDocumentKind;
}
else if (viewDescriptor.ViewAttribute != null)
{
@@ -120,12 +109,6 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
var areaRootDirectory = "/Areas/";
foreach (var viewDescriptor in GetViewDescriptors(_applicationManager))
{
- if (viewDescriptor.Item != null && !ChecksumValidator.IsItemValid(_razorProjectEngine.FileSystem, viewDescriptor.Item))
- {
- // If we get here, this compiled Page has different local content, so ignore it.
- continue;
- }
-
var relativePath = viewDescriptor.RelativePath;
var routeTemplate = GetRouteTemplate(viewDescriptor);
PageRouteModel routeModel = null;
@@ -159,7 +142,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
{
return viewDescriptor.Item.Metadata
.OfType()
- .FirstOrDefault(f => f.Key == RazorPageDocumentClassifierPass.RouteTemplateKey)
+ .FirstOrDefault(f => f.Key == RouteTemplateKey)
?.Value;
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/DefaultPageApplicationModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/DefaultPageApplicationModelProvider.cs
index b486d40e8c..8e6322984b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/DefaultPageApplicationModelProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/DefaultPageApplicationModelProvider.cs
@@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
-using Microsoft.AspNetCore.Mvc.RazorPages.Internal;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Options;
using Resources = Microsoft.AspNetCore.Mvc.RazorPages.Resources;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageRouteMetadata.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteMetadata.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageRouteMetadata.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteMetadata.cs
index ec5390ea98..0ababdcddc 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageRouteMetadata.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteMetadata.cs
@@ -1,7 +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.
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
// This is used to store the uncombined parts of the final page route
internal class PageRouteMetadata
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteModel.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteModel.cs
index a150977094..6c543a6b6c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteModel.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteModel.cs
@@ -55,6 +55,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
RelativePath = other.RelativePath;
ViewEnginePath = other.ViewEnginePath;
AreaName = other.AreaName;
+ RouteParameterTransformer = other.RouteParameterTransformer;
Properties = new Dictionary(other.Properties);
Selectors = new List(other.Selectors.Select(m => new SelectorModel(m)));
@@ -113,5 +114,17 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
///
///
public IDictionary RouteValues { get; }
+
+ ///
+ /// Gets or sets an that will be used to transform
+ /// built-in route parameters such as action, controller, and area as well as
+ /// additional parameters specified by into static segments in the route template.
+ ///
+ ///
+ ///
+ /// This feature only applies when using endpoint routing.
+ ///
+ ///
+ public IOutboundParameterTransformer RouteParameterTransformer { get; set; }
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageRouteModelFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteModelFactory.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageRouteModelFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteModelFactory.cs
index d6699015be..603a0225dc 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageRouteModelFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteModelFactory.cs
@@ -4,12 +4,12 @@
using System;
using System.Diagnostics;
using System.IO;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Razor;
+using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
internal class PageRouteModelFactory
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteTransformerConvention.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteTransformerConvention.cs
index df47d3b7c2..14903649a9 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteTransformerConvention.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageRouteTransformerConvention.cs
@@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
if (ShouldApply(model))
{
- model.Properties[typeof(IOutboundParameterTransformer)] = _parameterTransformer;
+ model.RouteParameterTransformer = _parameterTransformer;
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ResponseCacheFilterApplicationModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/ResponseCacheFilterApplicationModelProvider.cs
similarity index 84%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ResponseCacheFilterApplicationModelProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/ResponseCacheFilterApplicationModelProvider.cs
index 27a8a7cb9b..09122c103a 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ResponseCacheFilterApplicationModelProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/ResponseCacheFilterApplicationModelProvider.cs
@@ -3,13 +3,13 @@
using System;
using System.Linq;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
+using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
- public class ResponseCacheFilterApplicationModelProvider : IPageApplicationModelProvider
+ internal class ResponseCacheFilterApplicationModelProvider : IPageApplicationModelProvider
{
private readonly MvcOptions _mvcOptions;
private readonly ILoggerFactory _loggerFactory;
@@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
foreach (var attribute in responseCacheAttributes)
{
var cacheProfile = attribute.GetCacheProfile(_mvcOptions);
- context.PageApplicationModel.Filters.Add(new ResponseCacheFilter(cacheProfile, _loggerFactory));
+ context.PageApplicationModel.Filters.Add(new PageResponseCacheFilter(cacheProfile, _loggerFactory));
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/TempDataFilterPageApplicationModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/TempDataFilterPageApplicationModelProvider.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/TempDataFilterPageApplicationModelProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/TempDataFilterPageApplicationModelProvider.cs
index 411c13c608..62f0878a21 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/TempDataFilterPageApplicationModelProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/TempDataFilterPageApplicationModelProvider.cs
@@ -2,11 +2,11 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.RazorPages
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
internal class TempDataFilterPageApplicationModelProvider : IPageApplicationModelProvider
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ViewDataAttributePageApplicationModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/ViewDataAttributePageApplicationModelProvider.cs
similarity index 87%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ViewDataAttributePageApplicationModelProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/ViewDataAttributePageApplicationModelProvider.cs
index cdfbe11f0c..c0e12870b7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ViewDataAttributePageApplicationModelProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/ViewDataAttributePageApplicationModelProvider.cs
@@ -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.ApplicationModels;
-using Microsoft.AspNetCore.Mvc.RazorPages.Internal;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
-namespace Microsoft.AspNetCore.Mvc.RazorPages
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
internal class ViewDataAttributePageApplicationModelProvider : IPageApplicationModelProvider
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Builder/RazorPagesEndpointRouteBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Builder/RazorPagesEndpointRouteBuilderExtensions.cs
new file mode 100644
index 0000000000..677a426f34
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Builder/RazorPagesEndpointRouteBuilderExtensions.cs
@@ -0,0 +1,42 @@
+// 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.Linq;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+using Microsoft.AspNetCore.Mvc.Routing;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Microsoft.AspNetCore.Builder
+{
+ public static class RazorPagesEndpointRouteBuilderExtensions
+ {
+ public static IEndpointConventionBuilder MapRazorPages(
+ this IEndpointRouteBuilder routeBuilder,
+ string basePath = null)
+ {
+ var mvcEndpointDataSource = routeBuilder.DataSources.OfType().FirstOrDefault();
+
+ if (mvcEndpointDataSource == null)
+ {
+ mvcEndpointDataSource = routeBuilder.ServiceProvider.GetRequiredService();
+ routeBuilder.DataSources.Add(mvcEndpointDataSource);
+ }
+
+ var conventionBuilder = new DefaultEndpointConventionBuilder();
+
+ mvcEndpointDataSource.AttributeRoutingConventionResolvers.Add(actionDescriptor =>
+ {
+ if (actionDescriptor is PageActionDescriptor pageActionDescriptor)
+ {
+ // TODO: Filter pages by path
+ return conventionBuilder;
+ }
+
+ return null;
+ });
+
+ return conventionBuilder;
+ }
+ }
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs
index 2f17cfbbca..4de29ac563 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs
@@ -4,11 +4,11 @@
using System;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
+using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
-using Microsoft.AspNetCore.Mvc.RazorPages.Internal;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using Resources = Microsoft.AspNetCore.Mvc.RazorPages.Resources;
@@ -88,9 +88,6 @@ namespace Microsoft.Extensions.DependencyInjection
// Action description and invocation
services.TryAddEnumerable(
ServiceDescriptor.Singleton());
- services.TryAddSingleton();
- services.TryAddEnumerable(
- ServiceDescriptor.Singleton());
services.TryAddEnumerable(
ServiceDescriptor.Singleton());
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/RazorPagesRazorViewEngineOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/DependencyInjection/RazorPagesRazorViewEngineOptionsSetup.cs
similarity index 94%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/RazorPagesRazorViewEngineOptionsSetup.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/DependencyInjection/RazorPagesRazorViewEngineOptionsSetup.cs
index a0d19edf2f..a39591397e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/RazorPagesRazorViewEngineOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/DependencyInjection/RazorPagesRazorViewEngineOptionsSetup.cs
@@ -4,12 +4,13 @@
using System;
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc.Razor;
+using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.Extensions.DependencyInjection
{
- public class RazorPagesRazorViewEngineOptionsSetup : IConfigureOptions
+ internal class RazorPagesRazorViewEngineOptionsSetup : IConfigureOptions
{
private readonly RazorPagesOptions _pagesOptions;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerPageFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageHandlerPageFilter.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerPageFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageHandlerPageFilter.cs
index 662fa6113a..4e491eef04 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerPageFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageHandlerPageFilter.cs
@@ -3,11 +3,11 @@
using System;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.AspNetCore.Mvc.RazorPages;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
- public class PageHandlerPageFilter : IAsyncPageFilter, IOrderedFilter
+ internal class PageHandlerPageFilter : IAsyncPageFilter, IOrderedFilter
{
///
/// Filters on handlers run furthest from the action.
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerResultFIlter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageHandlerResultFIlter.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerResultFIlter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageHandlerResultFIlter.cs
index 9d0b3dcd09..c804aeb2d3 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerResultFIlter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageHandlerResultFIlter.cs
@@ -3,11 +3,11 @@
using System;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.AspNetCore.Mvc.RazorPages;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
- public class PageHandlerResultFilter : IAsyncResultFilter, IOrderedFilter
+ internal class PageHandlerResultFilter : IAsyncResultFilter, IOrderedFilter
{
///
/// Filters on handlers run furthest from the action.
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ResponseCacheFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageResponseCacheFilter.cs
similarity index 88%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ResponseCacheFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageResponseCacheFilter.cs
index 6fde160028..989183e491 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ResponseCacheFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageResponseCacheFilter.cs
@@ -2,27 +2,26 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
///
/// A which sets the appropriate headers related to response caching.
///
- public class ResponseCacheFilter : IPageFilter, IResponseCacheFilter
+ internal class PageResponseCacheFilter : IPageFilter, IResponseCacheFilter
{
private readonly ResponseCacheFilterExecutor _executor;
private readonly ILogger _logger;
///
- /// Creates a new instance of
+ /// Creates a new instance of
///
/// The profile which contains the settings for
- /// .
+ /// .
/// The .
- public ResponseCacheFilter(CacheProfile cacheProfile, ILoggerFactory loggerFactory)
+ public PageResponseCacheFilter(CacheProfile cacheProfile, ILoggerFactory loggerFactory)
{
_executor = new ResponseCacheFilterExecutor(cacheProfile);
_logger = loggerFactory.CreateLogger(GetType());
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageSaveTempDataPropertyFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageSaveTempDataPropertyFilter.cs
similarity index 86%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageSaveTempDataPropertyFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageSaveTempDataPropertyFilter.cs
index e3f3355fde..3fc0b2b761 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageSaveTempDataPropertyFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageSaveTempDataPropertyFilter.cs
@@ -1,11 +1,10 @@
// 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;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
-namespace Microsoft.AspNetCore.Mvc.RazorPages
+namespace Microsoft.AspNetCore.Mvc.Filters
{
internal class PageSaveTempDataPropertyFilter : SaveTempDataPropertyFilterBase, IPageFilter
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageSaveTempDataPropertyFilterFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageSaveTempDataPropertyFilterFactory.cs
similarity index 87%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageSaveTempDataPropertyFilterFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageSaveTempDataPropertyFilterFactory.cs
index b50ce6b2a9..0bbc255240 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageSaveTempDataPropertyFilterFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageSaveTempDataPropertyFilterFactory.cs
@@ -3,15 +3,13 @@
using System;
using System.Collections.Generic;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.DependencyInjection;
-namespace Microsoft.AspNetCore.Mvc.RazorPages
+namespace Microsoft.AspNetCore.Mvc.Filters
{
internal class PageSaveTempDataPropertyFilterFactory : IFilterFactory
{
-
public PageSaveTempDataPropertyFilterFactory(IReadOnlyList properties)
{
Properties = properties;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageViewDataAttributeFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageViewDataAttributeFilter.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageViewDataAttributeFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageViewDataAttributeFilter.cs
index 1199f1a91e..98b353b237 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageViewDataAttributeFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageViewDataAttributeFilter.cs
@@ -2,11 +2,10 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
-using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
-namespace Microsoft.AspNetCore.Mvc.RazorPages
+namespace Microsoft.AspNetCore.Mvc.Filters
{
internal class PageViewDataAttributeFilter : IPageFilter, IViewDataValuesProviderFeature
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageViewDataAttributeFilterFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageViewDataAttributeFilterFactory.cs
similarity index 85%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageViewDataAttributeFilterFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageViewDataAttributeFilterFactory.cs
index e75f518aec..42cdda0f04 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageViewDataAttributeFilterFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Filters/PageViewDataAttributeFilterFactory.cs
@@ -3,10 +3,9 @@
using System;
using System.Collections.Generic;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
-namespace Microsoft.AspNetCore.Mvc.RazorPages
+namespace Microsoft.AspNetCore.Mvc.Filters
{
internal class PageViewDataAttributeFilterFactory : IFilterFactory
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageActivatorProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageActivatorProvider.cs
index f0ec8404a9..3d5c9ac452 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageActivatorProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageActivatorProvider.cs
@@ -11,12 +11,12 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
///
/// that uses type activation to create Pages.
///
- public class DefaultPageActivatorProvider : IPageActivatorProvider
+ internal class DefaultPageActivatorProvider : IPageActivatorProvider
{
private readonly Action _disposer = Dispose;
///
- public virtual Func CreateActivator(CompiledPageActionDescriptor actionDescriptor)
+ public Func CreateActivator(CompiledPageActionDescriptor actionDescriptor)
{
if (actionDescriptor == null)
{
@@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
return CreatePageFactory(pageTypeInfo);
}
- public virtual Action CreateReleaser(CompiledPageActionDescriptor actionDescriptor)
+ public Action CreateReleaser(CompiledPageActionDescriptor actionDescriptor)
{
if (actionDescriptor == null)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/DefaultPageArgumentBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageArgumentBinder.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/DefaultPageArgumentBinder.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageArgumentBinder.cs
index 9fd638c10c..acc6b2f001 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/DefaultPageArgumentBinder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageArgumentBinder.cs
@@ -5,12 +5,11 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
#pragma warning disable CS0618 // Type or member is obsolete
- public class DefaultPageArgumentBinder : PageArgumentBinder
+ internal class DefaultPageArgumentBinder : PageArgumentBinder
#pragma warning restore CS0618 // Type or member is obsolete
{
private readonly ParameterBinder _parameterBinder;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageFactoryProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageFactoryProvider.cs
index 709921ab28..607586c7cc 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageFactoryProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageFactoryProvider.cs
@@ -6,14 +6,14 @@ using System.Diagnostics;
using System.Reflection;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.Razor.Internal;
+using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
- public class DefaultPageFactoryProvider : IPageFactoryProvider
+ internal class DefaultPageFactoryProvider : IPageFactoryProvider
{
private readonly IPageActivatorProvider _pageActivator;
private readonly IModelMetadataProvider _modelMetadataProvider;
@@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
IModelMetadataProvider metadataProvider,
IUrlHelperFactory urlHelperFactory,
IJsonHelper jsonHelper,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
HtmlEncoder htmlEncoder,
IModelExpressionProvider modelExpressionProvider)
{
@@ -34,13 +34,13 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
UrlHelperAccessor = context => urlHelperFactory.GetUrlHelper(context),
JsonHelperAccessor = context => jsonHelper,
- DiagnosticSourceAccessor = context => diagnosticSource,
+ DiagnosticSourceAccessor = context => diagnosticListener,
HtmlEncoderAccessor = context => htmlEncoder,
ModelExpressionProviderAccessor = context => modelExpressionProvider,
};
}
- public virtual Func CreatePageFactory(CompiledPageActionDescriptor actionDescriptor)
+ public Func CreatePageFactory(CompiledPageActionDescriptor actionDescriptor)
{
if (!typeof(PageBase).GetTypeInfo().IsAssignableFrom(actionDescriptor.PageTypeInfo))
{
@@ -68,7 +68,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
};
}
- public virtual Action CreatePageDisposer(CompiledPageActionDescriptor descriptor)
+ public Action CreatePageDisposer(CompiledPageActionDescriptor descriptor)
{
if (descriptor == null)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/DefaultPageHandlerMethodSelector.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageHandlerMethodSelector.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/DefaultPageHandlerMethodSelector.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageHandlerMethodSelector.cs
index e2a619ca32..325f3e546d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/DefaultPageHandlerMethodSelector.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageHandlerMethodSelector.cs
@@ -9,17 +9,12 @@ using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
- public class DefaultPageHandlerMethodSelector : IPageHandlerMethodSelector
+ internal class DefaultPageHandlerMethodSelector : IPageHandlerMethodSelector
{
private const string Handler = "handler";
private readonly IOptions _options;
- [Obsolete("This constructor will be removed in a future release. Use the other constructor.")]
- public DefaultPageHandlerMethodSelector()
- {
- }
-
public DefaultPageHandlerMethodSelector(IOptions options)
{
if (options == null)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/DefaultPageLoader.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageLoader.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/DefaultPageLoader.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageLoader.cs
index 9bb9390bcc..0534d276ba 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/DefaultPageLoader.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageLoader.cs
@@ -11,9 +11,9 @@ using Microsoft.AspNetCore.Mvc.Razor.Compilation;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
- public class DefaultPageLoader : IPageLoader
+ internal class DefaultPageLoader : IPageLoader
{
private readonly IPageApplicationModelProvider[] _applicationModelProviders;
private readonly IViewCompilerProvider _viewCompilerProvider;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelActivatorProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelActivatorProvider.cs
index 2ec04a81ab..e66efcabb0 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelActivatorProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelActivatorProvider.cs
@@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
///
/// that uses type activation to create Razor Page instances.
///
- public class DefaultPageModelActivatorProvider : IPageModelActivatorProvider
+ internal class DefaultPageModelActivatorProvider : IPageModelActivatorProvider
{
private readonly Action _disposer = Dispose;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelFactoryProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelFactoryProvider.cs
index 6821916a4f..4b1eb168e8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelFactoryProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelFactoryProvider.cs
@@ -7,7 +7,7 @@ using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
- public class DefaultPageModelFactoryProvider : IPageModelFactoryProvider
+ internal class DefaultPageModelFactoryProvider : IPageModelFactoryProvider
{
private static readonly Func> _createActivateInfo =
CreateActivateInfo;
@@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
_modelActivator = modelActivator;
}
- public virtual Func CreateModelFactory(CompiledPageActionDescriptor descriptor)
+ public Func CreateModelFactory(CompiledPageActionDescriptor descriptor)
{
if (descriptor == null)
{
@@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
};
}
- public virtual Action CreateModelDisposer(CompiledPageActionDescriptor descriptor)
+ public Action CreateModelDisposer(CompiledPageActionDescriptor descriptor)
{
if (descriptor == null)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ExecutorFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/ExecutorFactory.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ExecutorFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/ExecutorFactory.cs
index 6bea1e9605..99571e68e3 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/ExecutorFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/ExecutorFactory.cs
@@ -6,12 +6,11 @@ using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
- public static class ExecutorFactory
+ internal static class ExecutorFactory
{
public static PageHandlerExecutorDelegate CreateExecutor(HandlerMethodDescriptor handlerDescriptor)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionDescriptorProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionDescriptorProvider.cs
index 806a032c35..23a449e731 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionDescriptorProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionDescriptorProvider.cs
@@ -4,15 +4,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.RazorPages.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
-using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
@@ -117,11 +113,8 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
private static string TransformPageRoute(PageRouteModel model, SelectorModel selectorModel)
{
- model.Properties.TryGetValue(typeof(IOutboundParameterTransformer), out var transformer);
- var pageRouteTransformer = transformer as IOutboundParameterTransformer;
-
// Transformer not set on page route
- if (pageRouteTransformer == null)
+ if (model.RouteParameterTransformer == null)
{
return selectorModel.AttributeRouteModel.Template;
}
@@ -138,7 +131,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
var segments = pageRouteMetadata.PageRoute.Split('/');
for (var i = 0; i < segments.Length; i++)
{
- segments[i] = pageRouteTransformer.TransformOutbound(segments[i]);
+ segments[i] = model.RouteParameterTransformer.TransformOutbound(segments[i]);
}
var transformedPageRoute = string.Join("/", segments);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvoker.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvoker.cs
similarity index 94%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvoker.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvoker.cs
index 4f91b0346e..8bcdad905b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvoker.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvoker.cs
@@ -10,18 +10,15 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
- public class PageActionInvoker : ResourceInvoker, IActionInvoker
+ internal class PageActionInvoker : ResourceInvoker, IActionInvoker
{
private readonly IPageHandlerMethodSelector _selector;
private readonly PageContext _pageContext;
@@ -42,7 +39,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
public PageActionInvoker(
IPageHandlerMethodSelector handlerMethodSelector,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
ILogger logger,
IActionResultTypeMapper mapper,
PageContext pageContext,
@@ -52,7 +49,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
ITempDataDictionaryFactory tempDataFactory,
HtmlHelperOptions htmlHelperOptions)
: base(
- diagnosticSource,
+ diagnosticListener,
logger,
mapper,
pageContext,
@@ -258,7 +255,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
Debug.Assert(executor != null, "We should always find a executor for a handler");
- _diagnosticSource.BeforeHandlerMethod(_pageContext, handler, _arguments, _instance);
+ _diagnosticListener.BeforeHandlerMethod(_pageContext, handler, _arguments, _instance);
_logger.ExecutingHandlerMethod(_pageContext, handler, arguments);
try
@@ -268,7 +265,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
}
finally
{
- _diagnosticSource.AfterHandlerMethod(_pageContext, handler, _arguments, _instance, _result);
+ _diagnosticListener.AfterHandlerMethod(_pageContext, handler, _arguments, _instance, _result);
}
}
@@ -350,7 +347,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
var filter = (IAsyncPageFilter)state;
var handlerSelectedContext = _handlerSelectedContext;
- _diagnosticSource.BeforeOnPageHandlerSelection(handlerSelectedContext, filter);
+ _diagnosticListener.BeforeOnPageHandlerSelection(handlerSelectedContext, filter);
_logger.BeforeExecutingMethodOnFilter(
PageLoggerExtensions.PageFilter,
nameof(IAsyncPageFilter.OnPageHandlerSelectionAsync),
@@ -373,7 +370,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
var filter = (IAsyncPageFilter)state;
- _diagnosticSource.AfterOnPageHandlerSelection(_handlerSelectedContext, filter);
+ _diagnosticListener.AfterOnPageHandlerSelection(_handlerSelectedContext, filter);
_logger.AfterExecutingMethodOnFilter(
PageLoggerExtensions.PageFilter,
nameof(IAsyncPageFilter.OnPageHandlerSelectionAsync),
@@ -390,7 +387,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
var filter = (IPageFilter)state;
var handlerSelectedContext = _handlerSelectedContext;
- _diagnosticSource.BeforeOnPageHandlerSelected(handlerSelectedContext, filter);
+ _diagnosticListener.BeforeOnPageHandlerSelected(handlerSelectedContext, filter);
_logger.BeforeExecutingMethodOnFilter(
PageLoggerExtensions.PageFilter,
nameof(IPageFilter.OnPageHandlerSelected),
@@ -398,7 +395,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
filter.OnPageHandlerSelected(handlerSelectedContext);
- _diagnosticSource.AfterOnPageHandlerSelected(handlerSelectedContext, filter);
+ _diagnosticListener.AfterOnPageHandlerSelected(handlerSelectedContext, filter);
goto case State.PageSelectHandlerNext;
}
@@ -461,7 +458,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
var filter = (IAsyncPageFilter)state;
var handlerExecutingContext = _handlerExecutingContext;
- _diagnosticSource.BeforeOnPageHandlerExecution(handlerExecutingContext, filter);
+ _diagnosticListener.BeforeOnPageHandlerExecution(handlerExecutingContext, filter);
_logger.BeforeExecutingMethodOnFilter(
PageLoggerExtensions.PageFilter,
nameof(IAsyncPageFilter.OnPageHandlerExecutionAsync),
@@ -500,7 +497,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
};
}
- _diagnosticSource.AfterOnPageHandlerExecution(_handlerExecutedContext, filter);
+ _diagnosticListener.AfterOnPageHandlerExecution(_handlerExecutedContext, filter);
_logger.AfterExecutingMethodOnFilter(
PageLoggerExtensions.PageFilter,
nameof(IAsyncPageFilter.OnPageHandlerExecutionAsync),
@@ -517,7 +514,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
var filter = (IPageFilter)state;
var handlerExecutingContext = _handlerExecutingContext;
- _diagnosticSource.BeforeOnPageHandlerExecuting(handlerExecutingContext, filter);
+ _diagnosticListener.BeforeOnPageHandlerExecuting(handlerExecutingContext, filter);
_logger.BeforeExecutingMethodOnFilter(
PageLoggerExtensions.PageFilter,
nameof(IPageFilter.OnPageHandlerExecuting),
@@ -525,7 +522,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
filter.OnPageHandlerExecuting(handlerExecutingContext);
- _diagnosticSource.AfterOnPageHandlerExecuting(handlerExecutingContext, filter);
+ _diagnosticListener.AfterOnPageHandlerExecuting(handlerExecutingContext, filter);
_logger.AfterExecutingMethodOnFilter(
PageLoggerExtensions.PageFilter,
nameof(IPageFilter.OnPageHandlerExecuting),
@@ -568,7 +565,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
var filter = (IPageFilter)state;
var handlerExecutedContext = _handlerExecutedContext;
- _diagnosticSource.BeforeOnPageHandlerExecuted(handlerExecutedContext, filter);
+ _diagnosticListener.BeforeOnPageHandlerExecuted(handlerExecutedContext, filter);
_logger.BeforeExecutingMethodOnFilter(
PageLoggerExtensions.PageFilter,
nameof(IPageFilter.OnPageHandlerExecuted),
@@ -576,7 +573,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
filter.OnPageHandlerExecuted(handlerExecutedContext);
- _diagnosticSource.AfterOnPageHandlerExecuted(handlerExecutedContext, filter);
+ _diagnosticListener.AfterOnPageHandlerExecuted(handlerExecutedContext, filter);
_logger.AfterExecutingMethodOnFilter(
PageLoggerExtensions.PageFilter,
nameof(IPageFilter.OnPageHandlerExecuted),
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvokerCacheEntry.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvokerCacheEntry.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvokerCacheEntry.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvokerCacheEntry.cs
index f2844d2023..9b964ff661 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvokerCacheEntry.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvokerCacheEntry.cs
@@ -10,9 +10,9 @@ using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
- public class PageActionInvokerCacheEntry
+ internal class PageActionInvokerCacheEntry
{
public PageActionInvokerCacheEntry(
CompiledPageActionDescriptor actionDescriptor,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvokerProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvokerProvider.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvokerProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvokerProvider.cs
index 007a2f9b14..ffb9f93305 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvokerProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvokerProvider.cs
@@ -9,19 +9,15 @@ using System.Linq;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Razor;
-using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
-using Microsoft.AspNetCore.Razor.Language;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
- public class PageActionInvokerProvider : IActionInvokerProvider
+ internal class PageActionInvokerProvider : IActionInvokerProvider
{
private const string ViewStartFileName = "_ViewStart.cshtml";
@@ -39,8 +35,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
private readonly MvcOptions _mvcOptions;
private readonly HtmlHelperOptions _htmlHelperOptions;
private readonly IPageHandlerMethodSelector _selector;
- private readonly RazorProjectFileSystem _razorFileSystem;
- private readonly DiagnosticSource _diagnosticSource;
+ private readonly DiagnosticListener _diagnosticListener;
private readonly ILogger _logger;
private readonly IActionResultTypeMapper _mapper;
private volatile InnerCache _currentCache;
@@ -59,8 +54,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
IOptions mvcOptions,
IOptions htmlHelperOptions,
IPageHandlerMethodSelector selector,
- RazorProjectFileSystem razorFileSystem,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
ILoggerFactory loggerFactory,
IActionResultTypeMapper mapper)
{
@@ -78,8 +72,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
_mvcOptions = mvcOptions.Value;
_htmlHelperOptions = htmlHelperOptions.Value;
_selector = selector;
- _razorFileSystem = razorFileSystem;
- _diagnosticSource = diagnosticSource;
+ _diagnosticListener = diagnosticListener;
_logger = loggerFactory.CreateLogger();
_mapper = mapper;
}
@@ -159,7 +152,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
return new PageActionInvoker(
_selector,
- _diagnosticSource,
+ _diagnosticListener,
_logger,
_mapper,
pageContext,
@@ -218,12 +211,9 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
{
var viewStartFactories = new List>();
// Always pick up all _ViewStarts, including the ones outside the Pages root.
- var viewStartItems = _razorFileSystem.FindHierarchicalItems(
- descriptor.RelativePath,
- ViewStartFileName);
- foreach (var item in viewStartItems)
+ foreach (var filePath in RazorFileHierarchy.GetViewStartPaths(descriptor.RelativePath))
{
- var factoryResult = _razorPageFactoryProvider.CreateFactory(item.FilePath);
+ var factoryResult = _razorPageFactoryProvider.CreateFactory(filePath);
if (factoryResult.Success)
{
viewStartFactories.Insert(0, factoryResult.RazorPageFactory);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageBinderFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageBinderFactory.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageBinderFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageBinderFactory.cs
index 72fd33d754..c29faad2dd 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageBinderFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageBinderFactory.cs
@@ -4,11 +4,9 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
internal static class PageBinderFactory
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageDirectiveFeature.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageDirectiveFeature.cs
deleted file mode 100644
index ff09f6abbf..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageDirectiveFeature.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-// 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.IO;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc.Razor.Extensions;
-using Microsoft.AspNetCore.Mvc.RazorPages.Internal;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.AspNetCore.Razor.Language.Intermediate;
-using Microsoft.Extensions.Logging;
-
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
-{
- public static class PageDirectiveFeature
- {
- private static readonly RazorProjectEngine PageDirectiveEngine = RazorProjectEngine.Create(RazorConfiguration.Default, new EmptyRazorProjectFileSystem(), builder =>
- {
- for (var i = builder.Phases.Count - 1; i >= 0; i--)
- {
- var phase = builder.Phases[i];
- builder.Phases.RemoveAt(i);
- if (phase is IRazorDocumentClassifierPhase)
- {
- break;
- }
- }
-
- RazorExtensions.Register(builder);
- builder.Features.Add(new PageDirectiveParserOptionsFeature());
- });
-
- public static bool TryGetPageDirective(ILogger logger, RazorProjectItem projectItem, out string template)
- {
- if (projectItem == null)
- {
- throw new ArgumentNullException(nameof(projectItem));
- }
-
- var codeDocument = PageDirectiveEngine.Process(projectItem);
-
- var documentIRNode = codeDocument.GetDocumentIntermediateNode();
- if (PageDirective.TryGetPageDirective(documentIRNode, out var pageDirective))
- {
- if (pageDirective.DirectiveNode is MalformedDirectiveIntermediateNode malformedNode)
- {
- logger.MalformedPageDirective(projectItem.FilePath, malformedNode.Diagnostics);
- }
-
- template = pageDirective.RouteTemplate;
- return true;
- }
-
- template = null;
- return false;
- }
-
- private class PageDirectiveParserOptionsFeature : RazorEngineFeatureBase, IConfigureRazorParserOptionsFeature
- {
- public int Order { get; }
-
- public void Configure(RazorParserOptionsBuilder options)
- {
- options.ParseLeadingDirectives = true;
- }
- }
-
- private class EmptyRazorProjectFileSystem : RazorProjectFileSystem
- {
- public override IEnumerable EnumerateItems(string basePath)
- {
- return Enumerable.Empty();
- }
-
- public override IEnumerable FindHierarchicalItems(string basePath, string path, string fileName)
- {
- return Enumerable.Empty();
- }
-
- public override RazorProjectItem GetItem(string path)
- {
- return new NotFoundProjectItem(string.Empty, path);
- }
-
- private class NotFoundProjectItem : RazorProjectItem
- {
- public NotFoundProjectItem(string basePath, string path)
- {
- BasePath = basePath;
- FilePath = path;
- }
-
- ///
- public override string BasePath { get; }
-
- ///
- public override string FilePath { get; }
-
- ///
- public override bool Exists => false;
-
- ///
- public override string PhysicalPath => throw new NotSupportedException();
-
- ///
- public override Stream Read() => throw new NotSupportedException();
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerBinderDelegate.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageHandlerBinderDelegate.cs
similarity index 57%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerBinderDelegate.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageHandlerBinderDelegate.cs
index 7bea47fc51..433f3ccfd8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerBinderDelegate.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageHandlerBinderDelegate.cs
@@ -4,7 +4,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
- public delegate Task PageHandlerBinderDelegate(PageContext pageContext, IDictionary arguments);
+ internal delegate Task PageHandlerBinderDelegate(PageContext pageContext, IDictionary arguments);
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerExecutorDelegate.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageHandlerExecutorDelegate.cs
similarity index 55%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerExecutorDelegate.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageHandlerExecutorDelegate.cs
index e90c24dc75..6c992ad84d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageHandlerExecutorDelegate.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageHandlerExecutorDelegate.cs
@@ -3,7 +3,7 @@
using System.Threading.Tasks;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
- public delegate Task PageHandlerExecutorDelegate(object handler, object[] arguments);
+ internal delegate Task PageHandlerExecutorDelegate(object handler, object[] arguments);
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs
index 967c6fa07d..9ce8e7d6a9 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs
@@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
@@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
private readonly IRazorViewEngine _razorViewEngine;
private readonly IRazorPageActivator _razorPageActivator;
- private readonly DiagnosticSource _diagnosticSource;
+ private readonly DiagnosticListener _diagnosticListener;
private readonly HtmlEncoder _htmlEncoder;
///
@@ -30,21 +30,21 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
/// The .
/// The .
/// The .
- /// The .
+ /// The .
/// The .
public PageResultExecutor(
IHttpResponseStreamWriterFactory writerFactory,
ICompositeViewEngine compositeViewEngine,
IRazorViewEngine razorViewEngine,
IRazorPageActivator razorPageActivator,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
HtmlEncoder htmlEncoder)
- : base(writerFactory, compositeViewEngine, diagnosticSource)
+ : base(writerFactory, compositeViewEngine, diagnosticListener)
{
_razorViewEngine = razorViewEngine;
_htmlEncoder = htmlEncoder;
_razorPageActivator = razorPageActivator;
- _diagnosticSource = diagnosticSource;
+ _diagnosticListener = diagnosticListener;
}
///
@@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
viewStarts,
pageAdapter,
_htmlEncoder,
- _diagnosticSource)
+ _diagnosticListener)
{
OnAfterPageActivated = (page, currentViewContext) =>
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/MvcRazorPagesDiagnosticSourceExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/MvcRazorPagesDiagnosticSourceExtensions.cs
deleted file mode 100644
index fd7ca7f0bc..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/MvcRazorPagesDiagnosticSourceExtensions.cs
+++ /dev/null
@@ -1,289 +0,0 @@
-// 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.Diagnostics;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
-
-namespace Microsoft.AspNetCore.Mvc.Internal
-{
- public static class MvcRazorPagesDiagnosticSourceExtensions
- {
- public static void BeforeHandlerMethod(
- this DiagnosticSource diagnosticSource,
- ActionContext actionContext,
- HandlerMethodDescriptor handlerMethodDescriptor,
- IDictionary arguments,
- object instance)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(handlerMethodDescriptor != null);
- Debug.Assert(arguments != null);
- Debug.Assert(instance != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeHandlerMethod"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeHandlerMethod",
- new
- {
- actionContext = actionContext,
- arguments = arguments,
- handlerMethodDescriptor = handlerMethodDescriptor,
- instance = instance,
- });
- }
- }
-
- public static void AfterHandlerMethod(
- this DiagnosticSource diagnosticSource,
- ActionContext actionContext,
- HandlerMethodDescriptor handlerMethodDescriptor,
- IDictionary arguments,
- object instance,
- IActionResult result)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(handlerMethodDescriptor != null);
- Debug.Assert(arguments != null);
- Debug.Assert(instance != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterHandlerMethod"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterHandlerMethod",
- new
- {
- actionContext = actionContext,
- arguments = arguments,
- handlerMethodDescriptor = handlerMethodDescriptor,
- instance = instance,
- result = result
- });
- }
- }
-
- public static void BeforeOnPageHandlerExecution(
- this DiagnosticSource diagnosticSource,
- PageHandlerExecutingContext handlerExecutionContext,
- IAsyncPageFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(handlerExecutionContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecution"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecution",
- new
- {
- actionDescriptor = handlerExecutionContext.ActionDescriptor,
- handlerExecutionContext = handlerExecutionContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnPageHandlerExecution(
- this DiagnosticSource diagnosticSource,
- PageHandlerExecutedContext handlerExecutedContext,
- IAsyncPageFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(handlerExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecution"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecution",
- new
- {
- actionDescriptor = handlerExecutedContext.ActionDescriptor,
- handlerExecutedContext = handlerExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnPageHandlerExecuting(
- this DiagnosticSource diagnosticSource,
- PageHandlerExecutingContext handlerExecutingContext,
- IPageFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(handlerExecutingContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuting"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuting",
- new
- {
- actionDescriptor = handlerExecutingContext.ActionDescriptor,
- handlerExecutingContext = handlerExecutingContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnPageHandlerExecuting(
- this DiagnosticSource diagnosticSource,
- PageHandlerExecutingContext handlerExecutingContext,
- IPageFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(handlerExecutingContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuting"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuting",
- new
- {
- actionDescriptor = handlerExecutingContext.ActionDescriptor,
- handlerExecutingContext = handlerExecutingContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnPageHandlerExecuted(
- this DiagnosticSource diagnosticSource,
- PageHandlerExecutedContext handlerExecutedContext,
- IPageFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(handlerExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuted"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuted",
- new
- {
- actionDescriptor = handlerExecutedContext.ActionDescriptor,
- handlerExecutedContext = handlerExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnPageHandlerExecuted(
- this DiagnosticSource diagnosticSource,
- PageHandlerExecutedContext handlerExecutedContext,
- IPageFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(handlerExecutedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuted"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuted",
- new
- {
- actionDescriptor = handlerExecutedContext.ActionDescriptor,
- handlerExecutedContext = handlerExecutedContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnPageHandlerSelection(
- this DiagnosticSource diagnosticSource,
- PageHandlerSelectedContext handlerSelectedContext,
- IAsyncPageFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(handlerSelectedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelection"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelection",
- new
- {
- actionDescriptor = handlerSelectedContext.ActionDescriptor,
- handlerSelectedContext = handlerSelectedContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnPageHandlerSelection(
- this DiagnosticSource diagnosticSource,
- PageHandlerSelectedContext handlerSelectedContext,
- IAsyncPageFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(handlerSelectedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelection"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelection",
- new
- {
- actionDescriptor = handlerSelectedContext.ActionDescriptor,
- handlerSelectedContext = handlerSelectedContext,
- filter = filter
- });
- }
- }
-
- public static void BeforeOnPageHandlerSelected(
- this DiagnosticSource diagnosticSource,
- PageHandlerSelectedContext handlerSelectedContext,
- IPageFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(handlerSelectedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelected"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelected",
- new
- {
- actionDescriptor = handlerSelectedContext.ActionDescriptor,
- handlerSelectedContext = handlerSelectedContext,
- filter = filter
- });
- }
- }
-
- public static void AfterOnPageHandlerSelected(
- this DiagnosticSource diagnosticSource,
- PageHandlerSelectedContext handlerSelectedContext,
- IPageFilter filter)
- {
- Debug.Assert(diagnosticSource != null);
- Debug.Assert(handlerSelectedContext != null);
- Debug.Assert(filter != null);
-
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelected"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelected",
- new
- {
- actionDescriptor = handlerSelectedContext.ActionDescriptor,
- handlerSelectedContext = handlerSelectedContext,
- filter = filter
- });
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionDescriptorChangeProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionDescriptorChangeProvider.cs
deleted file mode 100644
index fadb391b90..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionDescriptorChangeProvider.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-// 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.Diagnostics;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Razor;
-using Microsoft.AspNetCore.Mvc.Razor.Internal;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.Extensions.FileProviders;
-using Microsoft.Extensions.Options;
-using Microsoft.Extensions.Primitives;
-
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
-{
- public class PageActionDescriptorChangeProvider : IActionDescriptorChangeProvider
- {
- private readonly IFileProvider _fileProvider;
- private readonly string[] _searchPatterns;
- private readonly string[] _additionalFilesToTrack;
- private readonly bool _watchForChanges;
-
- public PageActionDescriptorChangeProvider(
- RazorTemplateEngine templateEngine,
- IRazorViewEngineFileProviderAccessor fileProviderAccessor,
- IOptions razorPagesOptions,
- IOptions razorViewEngineOptions)
- {
- if (templateEngine == null)
- {
- throw new ArgumentNullException(nameof(templateEngine));
- }
-
- if (fileProviderAccessor == null)
- {
- throw new ArgumentNullException(nameof(fileProviderAccessor));
- }
-
- if (razorPagesOptions == null)
- {
- throw new ArgumentNullException(nameof(razorPagesOptions));
- }
-
- _watchForChanges = razorViewEngineOptions.Value.AllowRecompilingViewsOnFileChange;
- if (!_watchForChanges)
- {
- // No need to do any additional work if we aren't going to be watching for file changes.
- return;
- }
-
- _fileProvider = fileProviderAccessor.FileProvider;
-
- var rootDirectory = razorPagesOptions.Value.RootDirectory;
- Debug.Assert(!string.IsNullOrEmpty(rootDirectory));
- rootDirectory = rootDirectory.TrimEnd('/');
-
- // Search pattern that matches all cshtml files under the Pages RootDirectory
- var pagesRootSearchPattern = rootDirectory + "/**/*.cshtml";
-
- // pagesRootSearchPattern will miss _ViewImports outside the RootDirectory despite these influencing
- // compilation. e.g. when RootDirectory = /Dir1/Dir2, the search pattern will ignore changes to
- // [/_ViewImports.cshtml, /Dir1/_ViewImports.cshtml]. We need to additionally account for these.
- var importFileAtPagesRoot = rootDirectory + "/" + templateEngine.Options.ImportsFileName;
- var additionalImportFilePaths = templateEngine.GetImportItems(importFileAtPagesRoot)
- .Select(item => item.FilePath);
-
- if (razorPagesOptions.Value.AllowAreas)
- {
- // Search pattern that matches all cshtml files under the Pages AreaRootDirectory
- var areaRootSearchPattern = "/Areas/**/*.cshtml";
-
- var importFileAtAreaPagesRoot = $"/Areas/{templateEngine.Options.ImportsFileName}";
- var importPathsOutsideAreaPagesRoot = templateEngine.GetImportItems(importFileAtAreaPagesRoot)
- .Select(item => item.FilePath);
-
- additionalImportFilePaths = additionalImportFilePaths
- .Concat(importPathsOutsideAreaPagesRoot)
- .Distinct(StringComparer.OrdinalIgnoreCase);
-
- _searchPatterns = new[]
- {
- pagesRootSearchPattern,
- areaRootSearchPattern
- };
- }
- else
- {
- _searchPatterns = new[] { pagesRootSearchPattern, };
- }
-
- _additionalFilesToTrack = additionalImportFilePaths.ToArray();
- }
-
- public IChangeToken GetChangeToken()
- {
- if (!_watchForChanges)
- {
- return NullChangeToken.Singleton;
- }
-
- var changeTokens = new IChangeToken[_additionalFilesToTrack.Length + _searchPatterns.Length];
- for (var i = 0; i < _additionalFilesToTrack.Length; i++)
- {
- changeTokens[i] = _fileProvider.Watch(_additionalFilesToTrack[i]);
- }
-
- for (var i = 0; i < _searchPatterns.Length; i++)
- {
- var wildcardChangeToken = _fileProvider.Watch(_searchPatterns[i]);
- changeTokens[_additionalFilesToTrack.Length + i] = wildcardChangeToken;
- }
-
- return new CompositeChangeToken(changeTokens);
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/RazorProjectPageRouteModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/RazorProjectPageRouteModelProvider.cs
deleted file mode 100644
index 23384fa9f7..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/RazorProjectPageRouteModelProvider.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-// 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.ApplicationModels;
-using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
-{
- public class RazorProjectPageRouteModelProvider : IPageRouteModelProvider
- {
- private const string AreaRootDirectory = "/Areas";
- private readonly RazorProjectFileSystem _razorFileSystem;
- private readonly RazorPagesOptions _pagesOptions;
- private readonly PageRouteModelFactory _routeModelFactory;
- private readonly ILogger _logger;
-
- public RazorProjectPageRouteModelProvider(
- RazorProjectFileSystem razorFileSystem,
- IOptions pagesOptionsAccessor,
- ILoggerFactory loggerFactory)
- {
- _razorFileSystem = razorFileSystem;
- _pagesOptions = pagesOptionsAccessor.Value;
- _logger = loggerFactory.CreateLogger();
- _routeModelFactory = new PageRouteModelFactory(_pagesOptions, _logger);
- }
-
- ///
- /// Ordered to execute after .
- ///
- public int Order => -1000 + 10;
-
- public void OnProvidersExecuted(PageRouteModelProviderContext context)
- {
- }
-
- public void OnProvidersExecuting(PageRouteModelProviderContext context)
- {
- // When RootDirectory and AreaRootDirectory overlap, e.g. RootDirectory = /, AreaRootDirectory = /Areas;
- // we need to ensure that the page is only route-able via the area route. By adding area routes first,
- // we'll ensure non area routes get skipped when it encounters an IsAlreadyRegistered check.
-
- if (_pagesOptions.AllowAreas)
- {
- AddAreaPageModels(context);
- }
-
- AddPageModels(context);
- }
-
- private void AddPageModels(PageRouteModelProviderContext context)
- {
- foreach (var item in _razorFileSystem.EnumerateItems(_pagesOptions.RootDirectory))
- {
- var relativePath = item.CombinedPath;
- if (context.RouteModels.Any(m => string.Equals(relativePath, m.RelativePath, StringComparison.OrdinalIgnoreCase)))
- {
- // A route for this file was already registered either by the CompiledPageRouteModel or as an area route.
- // by this provider. Skip registering an additional entry.
-
- // Note: We're comparing duplicates based on root-relative paths. This eliminates a page from being discovered
- // by overlapping area and non-area routes where ViewEnginePath would be different.
- continue;
- }
-
- if (!PageDirectiveFeature.TryGetPageDirective(_logger, item, out var routeTemplate))
- {
- // .cshtml pages without @page are not RazorPages.
- continue;
- }
-
- if (_pagesOptions.AllowAreas && relativePath.StartsWith(AreaRootDirectory, StringComparison.OrdinalIgnoreCase))
- {
- // Ignore Razor pages that are under the area root directory when AllowAreas is enabled.
- // Conforming page paths will be added by AddAreaPageModels.
- _logger.UnsupportedAreaPath(relativePath);
- continue;
- }
-
- var routeModel = _routeModelFactory.CreateRouteModel(relativePath, routeTemplate);
- if (routeModel != null)
- {
- context.RouteModels.Add(routeModel);
- }
- }
- }
-
- private void AddAreaPageModels(PageRouteModelProviderContext context)
- {
- foreach (var item in _razorFileSystem.EnumerateItems(AreaRootDirectory))
- {
- var relativePath = item.CombinedPath;
- if (context.RouteModels.Any(m => string.Equals(relativePath, m.RelativePath, StringComparison.OrdinalIgnoreCase)))
- {
- // A route for this file was already registered either by the CompiledPageRouteModel.
- // Skip registering an additional entry.
- continue;
- }
-
- if (!PageDirectiveFeature.TryGetPageDirective(_logger, item, out var routeTemplate))
- {
- // .cshtml pages without @page are not RazorPages.
- continue;
- }
-
- var routeModel = _routeModelFactory.CreateAreaRouteModel(relativePath, routeTemplate);
- if (routeModel != null)
- {
- context.RouteModels.Add(routeModel);
- }
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Microsoft.AspNetCore.Mvc.RazorPages.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Microsoft.AspNetCore.Mvc.RazorPages.csproj
index 1655f9da77..fef57ee4d1 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Microsoft.AspNetCore.Mvc.RazorPages.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Microsoft.AspNetCore.Mvc.RazorPages.csproj
@@ -2,7 +2,7 @@
ASP.NET Core MVC Razor Pages.
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc;cshtml;razor
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/MvcRazorPagesDiagnosticSourceExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/MvcRazorPagesDiagnosticSourceExtensions.cs
new file mode 100644
index 0000000000..5747c9828f
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/MvcRazorPagesDiagnosticSourceExtensions.cs
@@ -0,0 +1,397 @@
+// 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.Diagnostics;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
+
+namespace Microsoft.AspNetCore.Mvc.RazorPages
+{
+ internal static class MvcRazorPagesDiagnosticSourceExtensions
+ {
+ public static void BeforeHandlerMethod(
+ this DiagnosticListener diagnosticListener,
+ ActionContext actionContext,
+ HandlerMethodDescriptor handlerMethodDescriptor,
+ IDictionary arguments,
+ object instance)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionContext != null);
+ Debug.Assert(handlerMethodDescriptor != null);
+ Debug.Assert(arguments != null);
+ Debug.Assert(instance != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeHandlerMethodImpl(diagnosticListener, actionContext, handlerMethodDescriptor, arguments, instance);
+ }
+ }
+
+ private static void BeforeHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IDictionary arguments, object instance)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeHandlerMethod"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeHandlerMethod",
+ new
+ {
+ actionContext = actionContext,
+ arguments = arguments,
+ handlerMethodDescriptor = handlerMethodDescriptor,
+ instance = instance,
+ });
+ }
+ }
+
+ public static void AfterHandlerMethod(
+ this DiagnosticListener diagnosticListener,
+ ActionContext actionContext,
+ HandlerMethodDescriptor handlerMethodDescriptor,
+ IDictionary arguments,
+ object instance,
+ IActionResult result)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(actionContext != null);
+ Debug.Assert(handlerMethodDescriptor != null);
+ Debug.Assert(arguments != null);
+ Debug.Assert(instance != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterHandlerMethodImpl(diagnosticListener, actionContext, handlerMethodDescriptor, arguments, instance, result);
+ }
+ }
+
+ private static void AfterHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IDictionary arguments, object instance, IActionResult result)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterHandlerMethod"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterHandlerMethod",
+ new
+ {
+ actionContext = actionContext,
+ arguments = arguments,
+ handlerMethodDescriptor = handlerMethodDescriptor,
+ instance = instance,
+ result = result
+ });
+ }
+ }
+
+ public static void BeforeOnPageHandlerExecution(
+ this DiagnosticListener diagnosticListener,
+ PageHandlerExecutingContext handlerExecutionContext,
+ IAsyncPageFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(handlerExecutionContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnPageHandlerExecutionImpl(diagnosticListener, handlerExecutionContext, filter);
+ }
+ }
+
+ private static void BeforeOnPageHandlerExecutionImpl(DiagnosticListener diagnosticListener, PageHandlerExecutingContext handlerExecutionContext, IAsyncPageFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecution"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecution",
+ new
+ {
+ actionDescriptor = handlerExecutionContext.ActionDescriptor,
+ handlerExecutionContext = handlerExecutionContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnPageHandlerExecution(
+ this DiagnosticListener diagnosticListener,
+ PageHandlerExecutedContext handlerExecutedContext,
+ IAsyncPageFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(handlerExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnPageHandlerExecutionImpl(diagnosticListener, handlerExecutedContext, filter);
+ }
+ }
+
+ private static void AfterOnPageHandlerExecutionImpl(DiagnosticListener diagnosticListener, PageHandlerExecutedContext handlerExecutedContext, IAsyncPageFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecution"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecution",
+ new
+ {
+ actionDescriptor = handlerExecutedContext.ActionDescriptor,
+ handlerExecutedContext = handlerExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnPageHandlerExecuting(
+ this DiagnosticListener diagnosticListener,
+ PageHandlerExecutingContext handlerExecutingContext,
+ IPageFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(handlerExecutingContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnPageHandlerExecutingImpl(diagnosticListener, handlerExecutingContext, filter);
+ }
+ }
+
+ private static void BeforeOnPageHandlerExecutingImpl(DiagnosticListener diagnosticListener, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuting"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuting",
+ new
+ {
+ actionDescriptor = handlerExecutingContext.ActionDescriptor,
+ handlerExecutingContext = handlerExecutingContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnPageHandlerExecuting(
+ this DiagnosticListener diagnosticListener,
+ PageHandlerExecutingContext handlerExecutingContext,
+ IPageFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(handlerExecutingContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnPageHandlerExecutingImpl(diagnosticListener, handlerExecutingContext, filter);
+ }
+ }
+
+ private static void AfterOnPageHandlerExecutingImpl(DiagnosticListener diagnosticListener, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuting"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuting",
+ new
+ {
+ actionDescriptor = handlerExecutingContext.ActionDescriptor,
+ handlerExecutingContext = handlerExecutingContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnPageHandlerExecuted(
+ this DiagnosticListener diagnosticListener,
+ PageHandlerExecutedContext handlerExecutedContext,
+ IPageFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(handlerExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnPageHandlerExecutedImpl(diagnosticListener, handlerExecutedContext, filter);
+ }
+ }
+
+ private static void BeforeOnPageHandlerExecutedImpl(DiagnosticListener diagnosticListener, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuted"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuted",
+ new
+ {
+ actionDescriptor = handlerExecutedContext.ActionDescriptor,
+ handlerExecutedContext = handlerExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnPageHandlerExecuted(
+ this DiagnosticListener diagnosticListener,
+ PageHandlerExecutedContext handlerExecutedContext,
+ IPageFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(handlerExecutedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnPageHandlerExecutedImpl(diagnosticListener, handlerExecutedContext, filter);
+ }
+ }
+
+ private static void AfterOnPageHandlerExecutedImpl(DiagnosticListener diagnosticListener, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuted"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuted",
+ new
+ {
+ actionDescriptor = handlerExecutedContext.ActionDescriptor,
+ handlerExecutedContext = handlerExecutedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnPageHandlerSelection(
+ this DiagnosticListener diagnosticListener,
+ PageHandlerSelectedContext handlerSelectedContext,
+ IAsyncPageFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(handlerSelectedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnPageHandlerSelectionImpl(diagnosticListener, handlerSelectedContext, filter);
+ }
+ }
+
+ private static void BeforeOnPageHandlerSelectionImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelection"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelection",
+ new
+ {
+ actionDescriptor = handlerSelectedContext.ActionDescriptor,
+ handlerSelectedContext = handlerSelectedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnPageHandlerSelection(
+ this DiagnosticListener diagnosticListener,
+ PageHandlerSelectedContext handlerSelectedContext,
+ IAsyncPageFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(handlerSelectedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnPageHandlerSelectionImpl(diagnosticListener, handlerSelectedContext, filter);
+ }
+ }
+
+ private static void AfterOnPageHandlerSelectionImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelection"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelection",
+ new
+ {
+ actionDescriptor = handlerSelectedContext.ActionDescriptor,
+ handlerSelectedContext = handlerSelectedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void BeforeOnPageHandlerSelected(
+ this DiagnosticListener diagnosticListener,
+ PageHandlerSelectedContext handlerSelectedContext,
+ IPageFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(handlerSelectedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeOnPageHandlerSelectedImpl(diagnosticListener, handlerSelectedContext, filter);
+ }
+ }
+
+ private static void BeforeOnPageHandlerSelectedImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelected"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelected",
+ new
+ {
+ actionDescriptor = handlerSelectedContext.ActionDescriptor,
+ handlerSelectedContext = handlerSelectedContext,
+ filter = filter
+ });
+ }
+ }
+
+ public static void AfterOnPageHandlerSelected(
+ this DiagnosticListener diagnosticListener,
+ PageHandlerSelectedContext handlerSelectedContext,
+ IPageFilter filter)
+ {
+ Debug.Assert(diagnosticListener != null);
+ Debug.Assert(handlerSelectedContext != null);
+ Debug.Assert(filter != null);
+
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterOnPageHandlerSelectedImpl(diagnosticListener, handlerSelectedContext, filter);
+ }
+ }
+
+ private static void AfterOnPageHandlerSelectedImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelected"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelected",
+ new
+ {
+ actionDescriptor = handlerSelectedContext.ActionDescriptor,
+ handlerSelectedContext = handlerSelectedContext,
+ filter = filter
+ });
+ }
+ }
+ }
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageBase.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageBase.cs
index 3dda563ebb..1d43071cf7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageBase.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageBase.cs
@@ -10,7 +10,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.Rendering;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageLoggerExtensions.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageLoggerExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageLoggerExtensions.cs
index 1ff89f5512..2407767fc7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageLoggerExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageLoggerExtensions.cs
@@ -2,14 +2,12 @@
// 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.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
-using Microsoft.AspNetCore.Razor.Language;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
+namespace Microsoft.AspNetCore.Mvc.RazorPages
{
internal static class PageLoggerExtensions
{
@@ -151,20 +149,6 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal
_pageFilterShortCircuit(logger, filter, null);
}
- public static void MalformedPageDirective(this ILogger logger, string filePath, IList diagnostics)
- {
- if (logger.IsEnabled(LogLevel.Warning))
- {
- var messages = new string[diagnostics.Count];
- for (var i = 0; i < diagnostics.Count; i++)
- {
- messages[i] = diagnostics[i].GetMessage();
- }
-
- _malformedPageDirective(logger, filePath, messages, null);
- }
- }
-
public static void NotMostEffectiveFilter(this ILogger logger, Type policyType)
{
_notMostEffectiveFilter(logger, policyType, null);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageModel.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageModel.cs
index 17384ca1ce..630084b897 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageModel.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageModel.cs
@@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
using Microsoft.AspNetCore.Mvc.Routing;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/breakingchanges.netcore.json b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/breakingchanges.netcore.json
new file mode 100644
index 0000000000..e2fa5d1d6c
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/breakingchanges.netcore.json
@@ -0,0 +1,31 @@
+[
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageActivatorProvider : Microsoft.AspNetCore.Mvc.RazorPages.IPageActivatorProvider",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageFactoryProvider : Microsoft.AspNetCore.Mvc.RazorPages.IPageFactoryProvider",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageHandlerMethodSelector : Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.IPageHandlerMethodSelector",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelActivatorProvider : Microsoft.AspNetCore.Mvc.RazorPages.IPageModelActivatorProvider",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelFactoryProvider : Microsoft.AspNetCore.Mvc.RazorPages.IPageModelFactoryProvider",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageResultExecutor : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor",
+ "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine compositeViewEngine, Microsoft.AspNetCore.Mvc.Razor.IRazorViewEngine razorViewEngine, Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator razorPageActivator, System.Diagnostics.DiagnosticSource diagnosticSource, System.Text.Encodings.Web.HtmlEncoder htmlEncoder)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public static class Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageDirectiveFeature",
+ "Kind": "Removal"
+ }
+]
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/AttributeMatcher.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/AttributeMatcher.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/AttributeMatcher.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/AttributeMatcher.cs
index 5caa08dc5b..309f2aa574 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/AttributeMatcher.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/AttributeMatcher.cs
@@ -5,12 +5,12 @@ using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Razor.TagHelpers;
-namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
+namespace Microsoft.AspNetCore.Mvc.TagHelpers
{
///
/// Methods for determining how an should run based on the attributes that were specified.
///
- public static class AttributeMatcher
+ internal static class AttributeMatcher
{
///
/// Determines the most effective mode a can run in based on which modes have
@@ -73,15 +73,13 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
// Perf: Avoid allocating enumerator
for (var i = 0; i < requiredAttributes.Length; i++)
{
- TagHelperAttribute attribute;
- if (!context.AllAttributes.TryGetAttribute(requiredAttributes[i], out attribute))
+ if (!context.AllAttributes.TryGetAttribute(requiredAttributes[i], out var attribute))
{
// Missing attribute.
return true;
}
- var valueAsString = attribute.Value as string;
- if (valueAsString != null && string.IsNullOrEmpty(valueAsString))
+ if (attribute.Value is string valueAsString && string.IsNullOrEmpty(valueAsString))
{
// Treat attributes with empty values as missing.
return true;
@@ -91,4 +89,4 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
return false;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperService.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperService.cs
index 7db418f9b4..88c4e0332c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperService.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperService.cs
@@ -9,7 +9,6 @@ using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
-using Microsoft.AspNetCore.Mvc.TagHelpers.Internal;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Logging;
@@ -80,10 +79,8 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Cache
while (content == null)
{
- Task result;
-
// Is there any request already processing the value?
- if (!_workers.TryGetValue(key, out result))
+ if (!_workers.TryGetValue(key, out var result))
{
// There is a small race condition here between TryGetValue and TryAdd that might cause the
// content to be computed more than once. We don't care about this race as the probability of
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/CacheTagHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/CacheTagHelper.cs
index de3fc45194..a097528945 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/CacheTagHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/CacheTagHelper.cs
@@ -10,8 +10,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.TagHelpers.Cache;
-using Microsoft.AspNetCore.Mvc.TagHelpers.Internal;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Primitives;
@@ -44,9 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
/// used by the .
/// The to use.
public CacheTagHelper(
-#pragma warning disable PUB0001 // Pubternal type in public API
CacheTagHelperMemoryCacheFactory factory,
-#pragma warning restore PUB0001
HtmlEncoder htmlEncoder)
: base(htmlEncoder)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/CacheTagHelperMemoryCacheFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/CacheTagHelperMemoryCacheFactory.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/CacheTagHelperMemoryCacheFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/CacheTagHelperMemoryCacheFactory.cs
index 7239f80260..6b1ac41fb8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/CacheTagHelperMemoryCacheFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/CacheTagHelperMemoryCacheFactory.cs
@@ -4,7 +4,7 @@
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
+namespace Microsoft.AspNetCore.Mvc.TagHelpers
{
public class CacheTagHelperMemoryCacheFactory
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/CurrentValues.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/CurrentValues.cs
similarity index 85%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/CurrentValues.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/CurrentValues.cs
index 6126d91507..8794df7203 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/CurrentValues.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/CurrentValues.cs
@@ -4,9 +4,9 @@
using System.Collections.Generic;
using System.Diagnostics;
-namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
+namespace Microsoft.AspNetCore.Mvc.TagHelpers
{
- public class CurrentValues
+ internal class CurrentValues
{
public CurrentValues(ICollection values)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/DependencyInjection/TagHelperExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/DependencyInjection/TagHelperExtensions.cs
index 5161244492..e39242536a 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/DependencyInjection/TagHelperExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/DependencyInjection/TagHelperExtensions.cs
@@ -4,7 +4,6 @@
using System;
using Microsoft.AspNetCore.Mvc.TagHelpers;
using Microsoft.AspNetCore.Mvc.TagHelpers.Cache;
-using Microsoft.AspNetCore.Mvc.TagHelpers.Internal;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Microsoft.Extensions.DependencyInjection
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/FileProviderGlobbingDirectory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/FileProviderGlobbingDirectory.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/FileProviderGlobbingDirectory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/FileProviderGlobbingDirectory.cs
index c2d0bf6227..5cb63e410f 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/FileProviderGlobbingDirectory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/FileProviderGlobbingDirectory.cs
@@ -6,9 +6,9 @@ using System.Collections.Generic;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.FileSystemGlobbing.Abstractions;
-namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
+namespace Microsoft.AspNetCore.Mvc.TagHelpers
{
- public class FileProviderGlobbingDirectory : DirectoryInfoBase
+ internal class FileProviderGlobbingDirectory : DirectoryInfoBase
{
private const char DirectorySeparatorChar = '/';
private readonly IFileProvider _fileProvider;
@@ -96,4 +96,4 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
return new FileProviderGlobbingFile(fileInfo, this);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/FileProviderGlobbingFile.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/FileProviderGlobbingFile.cs
similarity index 90%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/FileProviderGlobbingFile.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/FileProviderGlobbingFile.cs
index 2696781c8c..67ccc9e046 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/FileProviderGlobbingFile.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/FileProviderGlobbingFile.cs
@@ -5,9 +5,9 @@ using System;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.FileSystemGlobbing.Abstractions;
-namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
+namespace Microsoft.AspNetCore.Mvc.TagHelpers
{
- public class FileProviderGlobbingFile : FileInfoBase
+ internal class FileProviderGlobbingFile : FileInfoBase
{
private const char DirectorySeparatorChar = '/';
@@ -34,4 +34,4 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
public override DirectoryInfoBase ParentDirectory { get; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/GlobbingUrlBuilder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/GlobbingUrlBuilder.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/GlobbingUrlBuilder.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/GlobbingUrlBuilder.cs
index ce891ad84e..82c176bc8b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/GlobbingUrlBuilder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/GlobbingUrlBuilder.cs
@@ -10,7 +10,7 @@ using Microsoft.Extensions.FileSystemGlobbing;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Primitives;
-namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
+namespace Microsoft.AspNetCore.Mvc.TagHelpers
{
///
/// Utility methods for 's that support
@@ -381,4 +381,4 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/InputTagHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/InputTagHelper.cs
index 8ea3effdd4..16e7950dba 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/InputTagHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/InputTagHelper.cs
@@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Microsoft.AspNetCore.Mvc.TagHelpers
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/JavaScriptResources.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/JavaScriptResources.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/JavaScriptResources.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/JavaScriptResources.cs
index ad0bdf93a4..394d9de910 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/JavaScriptResources.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/JavaScriptResources.cs
@@ -7,12 +7,12 @@ using System.Diagnostics;
using System.IO;
using System.Reflection;
-namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
+namespace Microsoft.AspNetCore.Mvc.TagHelpers
{
///
/// Methods for loading JavaScript from assembly embedded resources.
///
- public static class JavaScriptResources
+ internal static class JavaScriptResources
{
private static readonly Assembly ResourcesAssembly = typeof(JavaScriptResources).GetTypeInfo().Assembly;
@@ -58,4 +58,4 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
return input.Substring(0, input.Length - 2);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs
index d082db1ef6..34d4ef1fa1 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs
@@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Razor.Infrastructure;
using Microsoft.AspNetCore.Mvc.Razor.TagHelpers;
using Microsoft.AspNetCore.Mvc.Routing;
-using Microsoft.AspNetCore.Mvc.TagHelpers.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Caching.Memory;
@@ -241,9 +240,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
protected JavaScriptEncoder JavaScriptEncoder { get; }
// Internal for ease of use when testing.
-#pragma warning disable PUB0001 // Pubternal type in public API
protected internal GlobbingUrlBuilder GlobbingUrlBuilder { get; set; }
-#pragma warning restore PUB0001
internal IFileVersionProvider FileVersionProvider { get; private set; }
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Microsoft.AspNetCore.Mvc.TagHelpers.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Microsoft.AspNetCore.Mvc.TagHelpers.csproj
index 5bd518d2f0..082cb972b8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Microsoft.AspNetCore.Mvc.TagHelpers.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Microsoft.AspNetCore.Mvc.TagHelpers.csproj
@@ -2,7 +2,7 @@
ASP.NET Core MVC default tag helpers. Contains tag helpers for anchor tags, HTML input elements, caching, scripts, links (for CSS), and more.
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc;taghelper;taghelpers
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/ModeAttributesOfT.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/ModeAttributesOfT.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/ModeAttributesOfT.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/ModeAttributesOfT.cs
index d5079b7d46..6aafc88d8f 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/ModeAttributesOfT.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/ModeAttributesOfT.cs
@@ -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.TagHelpers.Internal
+namespace Microsoft.AspNetCore.Mvc.TagHelpers
{
///
/// A mapping of a mode to its required attributes.
///
/// The type representing the 's mode.
- public class ModeAttributes
+ internal class ModeAttributes
{
///
/// Initializes a new instance of .
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/MvcTagHelpersLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/MvcTagHelpersLoggerExtensions.cs
similarity index 94%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/MvcTagHelpersLoggerExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/MvcTagHelpersLoggerExtensions.cs
index 1943e1bcb8..7a78c67530 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/MvcTagHelpersLoggerExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/MvcTagHelpersLoggerExtensions.cs
@@ -4,7 +4,7 @@
using System;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal
+namespace Microsoft.AspNetCore.Mvc.TagHelpers
{
internal static class MvcTagHelperLoggerExtensions
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/OptionTagHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/OptionTagHelper.cs
index 8f2678e968..3cfaf3bb4c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/OptionTagHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/OptionTagHelper.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
-using Microsoft.AspNetCore.Mvc.TagHelpers.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
@@ -76,8 +75,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
if (!output.Attributes.ContainsName("selected"))
{
// Is this element a child of a element the SelectTagHelper targeted?
- object formDataEntry;
- context.Items.TryGetValue(typeof(SelectTagHelper), out formDataEntry);
+ context.Items.TryGetValue(typeof(SelectTagHelper), out var formDataEntry);
// ... And did the SelectTagHelper determine any selected values?
var currentValues = formDataEntry as CurrentValues;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/PartialTagHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/PartialTagHelper.cs
index 617fa5d3a2..3797ea5ff1 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/PartialTagHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/PartialTagHelper.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Microsoft.AspNetCore.Mvc.TagHelpers
@@ -34,10 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
public PartialTagHelper(
ICompositeViewEngine viewEngine,
-#pragma warning disable PUB0001 // Pubternal type in public API
- IViewBufferScope viewBufferScope
-#pragma warning restore PUB0001
- )
+ IViewBufferScope viewBufferScope)
{
_viewEngine = viewEngine ?? throw new ArgumentNullException(nameof(viewEngine));
_viewBufferScope = viewBufferScope ?? throw new ArgumentNullException(nameof(viewBufferScope));
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs
index c9b217c1da..5720d7cd62 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs
@@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Razor.Infrastructure;
using Microsoft.AspNetCore.Mvc.Razor.TagHelpers;
using Microsoft.AspNetCore.Mvc.Routing;
-using Microsoft.AspNetCore.Mvc.TagHelpers.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Caching.Memory;
@@ -209,9 +208,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
protected JavaScriptEncoder JavaScriptEncoder { get; }
// Internal for ease of use when testing.
-#pragma warning disable PUB0001 // Pubternal type in public API
protected internal GlobbingUrlBuilder GlobbingUrlBuilder { get; set; }
-#pragma warning restore PUB0001
// Shared writer for determining the string content of a TagHelperAttribute's Value.
private StringWriter StringWriter
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/SelectTagHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/SelectTagHelper.cs
index f0e5dd2d06..c3d946bc8d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/SelectTagHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/SelectTagHelper.cs
@@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
-using Microsoft.AspNetCore.Mvc.TagHelpers.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/TagHelperOutputExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/TagHelperOutputExtensions.cs
index 91be1e59de..c79aa9fcfa 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/TagHelperOutputExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/TagHelperOutputExtensions.cs
@@ -116,8 +116,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
}
else if (string.Equals(attribute.Key, "class", StringComparison.OrdinalIgnoreCase))
{
- TagHelperAttribute classAttribute;
- var found = tagHelperOutput.Attributes.TryGetAttribute("class", out classAttribute);
+ var found = tagHelperOutput.Attributes.TryGetAttribute("class", out var classAttribute);
Debug.Assert(found);
var newAttribute = new TagHelperAttribute(
@@ -394,8 +393,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
var wroteLeft = false;
if (_left != null)
{
- var htmlContent = _left as IHtmlContent;
- if (htmlContent != null)
+ if (_left is IHtmlContent htmlContent)
{
// Ignore case where htmlContent is HtmlString.Empty. At worst, will add a leading space to the
// generated attribute value.
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/breakingchanges.netcore.json b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/breakingchanges.netcore.json
new file mode 100644
index 0000000000..ece8a05977
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/breakingchanges.netcore.json
@@ -0,0 +1,32 @@
+[
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper",
+ "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.IViewBufferScope viewBufferScope)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper : Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper",
+ "MemberId": "protected Microsoft.AspNetCore.Mvc.TagHelpers.Internal.GlobbingUrlBuilder get_GlobbingUrlBuilder()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper : Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper",
+ "MemberId": "protected System.Void set_GlobbingUrlBuilder(Microsoft.AspNetCore.Mvc.TagHelpers.Internal.GlobbingUrlBuilder value)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper : Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper",
+ "MemberId": "protected Microsoft.AspNetCore.Mvc.TagHelpers.Internal.GlobbingUrlBuilder get_GlobbingUrlBuilder()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper : Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper",
+ "MemberId": "protected System.Void set_GlobbingUrlBuilder(Microsoft.AspNetCore.Mvc.TagHelpers.Internal.GlobbingUrlBuilder value)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper : Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelperBase",
+ "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.TagHelpers.Internal.CacheTagHelperMemoryCacheFactory factory, System.Text.Encodings.Web.HtmlEncoder htmlEncoder)",
+ "Kind": "Removal"
+ }
+]
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Testing/Microsoft.AspNetCore.Mvc.Testing.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Testing/Microsoft.AspNetCore.Mvc.Testing.csproj
index 058ec2af63..83c53ddb69 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Testing/Microsoft.AspNetCore.Mvc.Testing.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Testing/Microsoft.AspNetCore.Mvc.Testing.csproj
@@ -2,7 +2,7 @@
Support for writing functional tests for MVC applications.
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc;aspnetcoremvctesting
@@ -17,7 +17,7 @@
-
+
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Testing/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Testing.targets b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Testing/Microsoft.AspNetCore.Mvc.Testing.targets
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.Testing/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Testing.targets
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.Testing/Microsoft.AspNetCore.Mvc.Testing.targets
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/AntiforgeryExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/AntiforgeryExtensions.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/AntiforgeryExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/AntiforgeryExtensions.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/AttributeDictionary.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/AttributeDictionary.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/AttributeDictionary.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/AttributeDictionary.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/AutoValidateAntiforgeryTokenAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/AutoValidateAntiforgeryTokenAttribute.cs
index 673e52c261..8fc6724074 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/AutoValidateAntiforgeryTokenAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/AutoValidateAntiforgeryTokenAttribute.cs
@@ -3,7 +3,7 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ArrayPoolBufferSource.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ArrayPoolBufferSource.cs
similarity index 81%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ArrayPoolBufferSource.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ArrayPoolBufferSource.cs
index b21e645cbc..bbfbf72440 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ArrayPoolBufferSource.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ArrayPoolBufferSource.cs
@@ -3,9 +3,9 @@
using System.Buffers;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
- public class ArrayPoolBufferSource : ICharBufferSource
+ internal class ArrayPoolBufferSource : ICharBufferSource
{
private readonly ArrayPool _pool;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/CharArrayBufferSource.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/CharArrayBufferSource.cs
similarity index 78%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/CharArrayBufferSource.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/CharArrayBufferSource.cs
index 50d526172d..fa6ae6cbe9 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/CharArrayBufferSource.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/CharArrayBufferSource.cs
@@ -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.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
- public class CharArrayBufferSource : ICharBufferSource
+ internal class CharArrayBufferSource : ICharBufferSource
{
public static readonly CharArrayBufferSource Instance = new CharArrayBufferSource();
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ICharBufferSource.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ICharBufferSource.cs
similarity index 72%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ICharBufferSource.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ICharBufferSource.cs
index 99e23c1997..439aa46973 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ICharBufferSource.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ICharBufferSource.cs
@@ -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.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
- public interface ICharBufferSource
+ internal interface ICharBufferSource
{
char[] Rent(int bufferSize);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/IViewBufferScope.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/IViewBufferScope.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/IViewBufferScope.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/IViewBufferScope.cs
index 2b6f7ee37d..6cb21ee100 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/IViewBufferScope.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/IViewBufferScope.cs
@@ -3,7 +3,7 @@
using System.IO;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
///
/// Creates and manages the lifetime of instances.
@@ -29,6 +29,6 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
///
/// The .
/// A .
- PagedBufferedTextWriter CreateWriter(TextWriter writer);
+ TextWriter CreateWriter(TextWriter writer);
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MemoryPoolViewBufferScope.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/MemoryPoolViewBufferScope.cs
similarity index 94%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MemoryPoolViewBufferScope.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/MemoryPoolViewBufferScope.cs
index 9b72316f02..be686e5fe0 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MemoryPoolViewBufferScope.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/MemoryPoolViewBufferScope.cs
@@ -6,12 +6,12 @@ using System.Buffers;
using System.Collections.Generic;
using System.IO;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
///
/// A that uses pooled memory.
///
- public class MemoryPoolViewBufferScope : IViewBufferScope, IDisposable
+ internal class MemoryPoolViewBufferScope : IViewBufferScope, IDisposable
{
public static readonly int MinimumSize = 16;
private readonly ArrayPool _viewBufferPool;
@@ -96,7 +96,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
}
///
- public PagedBufferedTextWriter CreateWriter(TextWriter writer)
+ public TextWriter CreateWriter(TextWriter writer)
{
if (writer == null)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/PagedBufferedTextWriter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/PagedBufferedTextWriter.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/PagedBufferedTextWriter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/PagedBufferedTextWriter.cs
index 4c8b1937c9..9c74598b24 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/PagedBufferedTextWriter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/PagedBufferedTextWriter.cs
@@ -9,9 +9,9 @@ using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
- public class PagedBufferedTextWriter : TextWriter
+ internal class PagedBufferedTextWriter : TextWriter
{
private readonly TextWriter _inner;
private readonly PagedCharBuffer _charBuffer;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/PagedCharBuffer.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/PagedCharBuffer.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/PagedCharBuffer.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/PagedCharBuffer.cs
index 0c4931c7b9..877a81910c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/PagedCharBuffer.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/PagedCharBuffer.cs
@@ -5,9 +5,9 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
- public class PagedCharBuffer : IDisposable
+ internal class PagedCharBuffer : IDisposable
{
public const int PageSize = 1024;
private int _charIndex;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBuffer.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBuffer.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBuffer.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBuffer.cs
index dfe23dce7c..de5964e46b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBuffer.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBuffer.cs
@@ -10,13 +10,13 @@ using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
///
/// An that is backed by a buffer provided by .
///
[DebuggerDisplay("{DebuggerToString()}")]
- public class ViewBuffer : IHtmlContentBuilder
+ internal class ViewBuffer : IHtmlContentBuilder
{
public static readonly int PartialViewPageSize = 32;
public static readonly int TagHelperPageSize = 32;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBufferPage.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBufferPage.cs
similarity index 89%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBufferPage.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBufferPage.cs
index dfc47673ec..af360d9fcd 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBufferPage.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBufferPage.cs
@@ -3,9 +3,9 @@
using System.Runtime.CompilerServices;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
- public class ViewBufferPage
+ internal class ViewBufferPage
{
public ViewBufferPage(ViewBufferValue[] buffer)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBufferTextWriter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBufferTextWriter.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBufferTextWriter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBufferTextWriter.cs
index e7d3761677..84f3a993a2 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBufferTextWriter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBufferTextWriter.cs
@@ -8,7 +8,7 @@ using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
///
///
@@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
/// the writer and switches to writing to the unbuffered writer for all further write operations.
///
///
- public class ViewBufferTextWriter : TextWriter
+ internal class ViewBufferTextWriter : TextWriter
{
private readonly TextWriter _inner;
private readonly HtmlEncoder _htmlEncoder;
@@ -161,15 +161,13 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
return;
}
- IHtmlContentContainer container;
- IHtmlContent content;
- if ((container = value as IHtmlContentContainer) != null)
+ if (value is IHtmlContentContainer container)
{
Write(container);
}
- else if ((content = value as IHtmlContent) != null)
+ else if (value is IHtmlContent htmlContent)
{
- Write(content);
+ Write(htmlContent);
}
else
{
@@ -227,16 +225,14 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
return;
}
- IHtmlContentContainer container;
- IHtmlContent content;
- if ((container = value as IHtmlContentContainer) != null)
+ if (value is IHtmlContentContainer container)
{
Write(container);
Write(NewLine);
}
- else if ((content = value as IHtmlContent) != null)
+ else if (value is IHtmlContent htmlContent)
{
- Write(content);
+ Write(htmlContent);
Write(NewLine);
}
else
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBufferValue.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBufferValue.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBufferValue.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBufferValue.cs
index 68691a9868..4f2bd4bf82 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewBufferValue.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Buffers/ViewBufferValue.cs
@@ -6,7 +6,7 @@ using System.IO;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Html;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
///
/// Encapsulates a string or value.
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/CachedExpressionCompiler.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/CachedExpressionCompiler.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/CachedExpressionCompiler.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/CachedExpressionCompiler.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Controller.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Controller.cs
index c0aaa0e3b3..7af52c185a 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Controller.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Controller.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/CookieTempDataProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/CookieTempDataProvider.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/CookieTempDataProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/CookieTempDataProvider.cs
index 073c400f78..6a52e7b636 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/CookieTempDataProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/CookieTempDataProvider.cs
@@ -5,11 +5,11 @@ using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.WebUtilities;
using Microsoft.AspNetCore.Internal;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
-using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
+using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/DefaultDisplayTemplates.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultDisplayTemplates.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/DefaultDisplayTemplates.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultDisplayTemplates.cs
index eb071f5807..d1671a248e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/DefaultDisplayTemplates.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultDisplayTemplates.cs
@@ -10,11 +10,12 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.Extensions.DependencyInjection;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
- public static class DefaultDisplayTemplates
+ internal static class DefaultDisplayTemplates
{
public static IHtmlContent BooleanTemplate(IHtmlHelper htmlHelper)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/DefaultEditorTemplates.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultEditorTemplates.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/DefaultEditorTemplates.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultEditorTemplates.cs
index 408448c651..847bd5d34e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/DefaultEditorTemplates.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultEditorTemplates.cs
@@ -13,11 +13,12 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.Extensions.DependencyInjection;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
- public static class DefaultEditorTemplates
+ internal static class DefaultEditorTemplates
{
private const string HtmlAttributeKey = "htmlAttributes";
private const string UsePasswordValue = "Switch.Microsoft.AspNetCore.Mvc.UsePasswordValue";
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultHtmlGenerator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultHtmlGenerator.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultHtmlGenerator.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultHtmlGenerator.cs
index d0121241b6..ec79c64859 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultHtmlGenerator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultHtmlGenerator.cs
@@ -13,10 +13,8 @@ using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultHtmlGeneratorExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultHtmlGeneratorExtensions.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultHtmlGeneratorExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultHtmlGeneratorExtensions.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultValidationHtmlAttributeProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultValidationHtmlAttributeProvider.cs
similarity index 94%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultValidationHtmlAttributeProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultValidationHtmlAttributeProvider.cs
index 02b04d8e53..1b2d5d1b7a 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultValidationHtmlAttributeProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DefaultValidationHtmlAttributeProvider.cs
@@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Mvc.Rendering;
@@ -30,10 +29,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
public DefaultValidationHtmlAttributeProvider(
IOptions optionsAccessor,
IModelMetadataProvider metadataProvider,
-#pragma warning disable PUB0001 // Pubternal type in public API
- ClientValidatorCache clientValidatorCache
-#pragma warning restore PUB0001
- )
+ ClientValidatorCache clientValidatorCache)
{
if (optionsAccessor == null)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs
index ebedcbc56c..01457ce718 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs
@@ -7,14 +7,15 @@ using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
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.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DependencyInjection/MvcViewOptionsSetup.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewOptionsSetup.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DependencyInjection/MvcViewOptionsSetup.cs
index 5e59f56345..29548e907d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DependencyInjection/MvcViewOptionsSetup.cs
@@ -2,17 +2,17 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.Extensions.DependencyInjection
{
///
/// Sets up default options for .
///
- public class MvcViewOptionsSetup : IConfigureOptions
+ internal class MvcViewOptionsSetup : IConfigureOptions
{
private readonly IOptions _dataAnnotationsLocalizationOptions;
private readonly IValidationAttributeAdapterProvider _validationAttributeAdapterProvider;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/TempDataMvcOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DependencyInjection/TempDataMvcOptionsSetup.cs
similarity index 69%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/TempDataMvcOptionsSetup.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DependencyInjection/TempDataMvcOptionsSetup.cs
index 9d471020b3..4f6d7360e1 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/TempDataMvcOptionsSetup.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DependencyInjection/TempDataMvcOptionsSetup.cs
@@ -1,14 +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;
+using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.Extensions.DependencyInjection
{
///
/// Sets up default options for .
///
- public class TempDataMvcOptionsSetup : IConfigureOptions
+ internal class TempDataMvcOptionsSetup : IConfigureOptions
{
public void Configure(MvcOptions options)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/DynamicViewData.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DynamicViewData.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/DynamicViewData.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DynamicViewData.cs
index 8f17e95800..9068baec2e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/DynamicViewData.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/DynamicViewData.cs
@@ -5,9 +5,9 @@ using System;
using System.Collections.Generic;
using System.Dynamic;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
- public class DynamicViewData : DynamicObject
+ internal class DynamicViewData : DynamicObject
{
private readonly Func _viewDataFunc;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ExpressionHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ExpressionHelper.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ExpressionHelper.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ExpressionHelper.cs
index 4de9146bb2..aa2bd0df4e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ExpressionHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ExpressionHelper.cs
@@ -9,9 +9,9 @@ using System.Linq.Expressions;
using System.Reflection;
using System.Text;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
- public static class ExpressionHelper
+ internal static class ExpressionHelper
{
public static string GetExpressionText(string expression)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ExpressionMetadataProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ExpressionMetadataProvider.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ExpressionMetadataProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ExpressionMetadataProvider.cs
index 0f8b11eacb..ae5aeba14b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ExpressionMetadataProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ExpressionMetadataProvider.cs
@@ -8,9 +8,9 @@ using System.Linq.Expressions;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
- public static class ExpressionMetadataProvider
+ internal static class ExpressionMetadataProvider
{
public static ModelExplorer FromLambdaExpression(
Expression> expression,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ExpressionTextCache.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ExpressionTextCache.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ExpressionTextCache.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ExpressionTextCache.cs
index cc774bebfc..6468769363 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ExpressionTextCache.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ExpressionTextCache.cs
@@ -7,7 +7,7 @@ using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
///
/// This class holds the cache for the expression text that is computed by ExpressionHelper.
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/AutoValidateAntiforgeryTokenAuthorizationFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/AutoValidateAntiforgeryTokenAuthorizationFilter.cs
similarity index 88%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/AutoValidateAntiforgeryTokenAuthorizationFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/AutoValidateAntiforgeryTokenAuthorizationFilter.cs
index f159ed2da3..032fa98ec6 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/AutoValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/AutoValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -6,9 +6,9 @@ using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
- public class AutoValidateAntiforgeryTokenAuthorizationFilter : ValidateAntiforgeryTokenAuthorizationFilter
+ internal class AutoValidateAntiforgeryTokenAuthorizationFilter : ValidateAntiforgeryTokenAuthorizationFilter
{
public AutoValidateAntiforgeryTokenAuthorizationFilter(IAntiforgery antiforgery, ILoggerFactory loggerFactory)
: base(antiforgery, loggerFactory)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerSaveTempDataPropertyFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerSaveTempDataPropertyFilter.cs
similarity index 89%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerSaveTempDataPropertyFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerSaveTempDataPropertyFilter.cs
index e375ae94bc..bd83709054 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerSaveTempDataPropertyFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerSaveTempDataPropertyFilter.cs
@@ -2,9 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class ControllerSaveTempDataPropertyFilter : SaveTempDataPropertyFilterBase, IActionFilter
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerSaveTempDataPropertyFilterFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerSaveTempDataPropertyFilterFactory.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerSaveTempDataPropertyFilterFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerSaveTempDataPropertyFilterFactory.cs
index 22b7754f72..3ee6b4b718 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerSaveTempDataPropertyFilterFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerSaveTempDataPropertyFilterFactory.cs
@@ -4,10 +4,9 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.DependencyInjection;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class ControllerSaveTempDataPropertyFilterFactory : IFilterFactory
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerViewDataAttributeFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerViewDataAttributeFilter.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerViewDataAttributeFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerViewDataAttributeFilter.cs
index f08508736d..7a37a43663 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerViewDataAttributeFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerViewDataAttributeFilter.cs
@@ -3,9 +3,8 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class ControllerViewDataAttributeFilter : IActionFilter, IViewDataValuesProviderFeature
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerViewDataAttributeFilterFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerViewDataAttributeFilterFactory.cs
similarity index 89%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerViewDataAttributeFilterFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerViewDataAttributeFilterFactory.cs
index 61e9e172df..9293aca872 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ControllerViewDataAttributeFilterFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ControllerViewDataAttributeFilterFactory.cs
@@ -4,9 +4,8 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class ControllerViewDataAttributeFilterFactory : IFilterFactory
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ISaveTempDataCallback.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ISaveTempDataCallback.cs
similarity index 70%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ISaveTempDataCallback.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ISaveTempDataCallback.cs
index 6f3aa16493..c331e6064b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ISaveTempDataCallback.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ISaveTempDataCallback.cs
@@ -3,9 +3,9 @@
using Microsoft.AspNetCore.Mvc.Filters;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
- public interface ISaveTempDataCallback : IFilterMetadata
+ internal interface ISaveTempDataCallback : IFilterMetadata
{
void OnTempDataSaving(ITempDataDictionary tempData);
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/IViewDataValuesProviderFeature.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/IViewDataValuesProviderFeature.cs
similarity index 69%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/IViewDataValuesProviderFeature.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/IViewDataValuesProviderFeature.cs
index 50648d6ecf..1908b0cfef 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/IViewDataValuesProviderFeature.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/IViewDataValuesProviderFeature.cs
@@ -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.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
- public interface IViewDataValuesProviderFeature
+ internal interface IViewDataValuesProviderFeature
{
void ProvideViewDataValues(ViewDataDictionary viewData);
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/LifecycleProperty.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/LifecycleProperty.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/LifecycleProperty.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/LifecycleProperty.cs
index 5eaf6e1491..f6cfd08eaa 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/LifecycleProperty.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/LifecycleProperty.cs
@@ -6,10 +6,10 @@ using System.Diagnostics;
using System.Reflection;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
[DebuggerDisplay("{PropertyInfo, nq}")]
- public readonly struct LifecycleProperty
+ internal readonly struct LifecycleProperty
{
private readonly PropertyHelper _propertyHelper;
private readonly bool _isReferenceTypeOrNullable;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/SaveTempDataFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/SaveTempDataFilter.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/SaveTempDataFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/SaveTempDataFilter.cs
index 52e98e0677..0ab2ec33a1 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/SaveTempDataFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/SaveTempDataFilter.cs
@@ -7,12 +7,12 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Filters;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
///
/// A filter that saves temp data.
///
- public class SaveTempDataFilter : IResourceFilter, IResultFilter
+ internal class SaveTempDataFilter : IResourceFilter, IResultFilter
{
// Internal for unit testing
internal static readonly object SaveTempDataFilterContextKey = new object();
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/SaveTempDataPropertyFilterBase.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/SaveTempDataPropertyFilterBase.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/SaveTempDataPropertyFilterBase.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/SaveTempDataPropertyFilterBase.cs
index ab4c79dff8..360aedfdbb 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/SaveTempDataPropertyFilterBase.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/SaveTempDataPropertyFilterBase.cs
@@ -7,9 +7,9 @@ using System.Diagnostics;
using System.Reflection;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
- public abstract class SaveTempDataPropertyFilterBase : ISaveTempDataCallback
+ internal abstract class SaveTempDataPropertyFilterBase : ISaveTempDataCallback
{
protected readonly ITempDataDictionaryFactory _tempDataFactory;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/TempDataApplicationModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/TempDataApplicationModelProvider.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/TempDataApplicationModelProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/TempDataApplicationModelProvider.cs
index 7a111b4919..dce36d87da 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/TempDataApplicationModelProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/TempDataApplicationModelProvider.cs
@@ -3,11 +3,9 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Options;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class TempDataApplicationModelProvider : IApplicationModelProvider
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/TempDataSerializer.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/TempDataSerializer.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/TempDataSerializer.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/TempDataSerializer.cs
index fd92d4d8ca..244ea1f94e 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/TempDataSerializer.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/TempDataSerializer.cs
@@ -14,9 +14,9 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Bson;
using Newtonsoft.Json.Linq;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
- public class TempDataSerializer
+ internal class TempDataSerializer
{
private readonly JsonSerializer _jsonSerializer =
JsonSerializer.Create(JsonSerializerSettingsProvider.CreateSerializerSettings());
@@ -62,9 +62,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
StringComparer.OrdinalIgnoreCase);
foreach (var item in tempDataDictionary)
{
- var jArrayValue = item.Value as JArray;
- var jObjectValue = item.Value as JObject;
- if (jArrayValue != null && jArrayValue.Count > 0)
+ if (item.Value is JArray jArrayValue && jArrayValue.Count > 0)
{
var arrayType = jArrayValue[0].Type;
if (_tokenTypeLookup.TryGetValue(arrayType, out var returnType))
@@ -85,7 +83,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
throw new InvalidOperationException(message);
}
}
- else if (jObjectValue != null)
+ else if (item.Value is JObject jObjectValue)
{
if (!jObjectValue.HasValues)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ValidateAntiforgeryTokenAuthorizationFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ValidateAntiforgeryTokenAuthorizationFilter.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ValidateAntiforgeryTokenAuthorizationFilter.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ValidateAntiforgeryTokenAuthorizationFilter.cs
index 901ea36cf8..bad3aabeed 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -7,9 +7,9 @@ using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
- public class ValidateAntiforgeryTokenAuthorizationFilter : IAsyncAuthorizationFilter, IAntiforgeryPolicy
+ internal class ValidateAntiforgeryTokenAuthorizationFilter : IAsyncAuthorizationFilter, IAntiforgeryPolicy
{
private readonly IAntiforgery _antiforgery;
private readonly ILogger _logger;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewDataAttributeApplicationModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ViewDataAttributeApplicationModelProvider.cs
similarity index 91%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewDataAttributeApplicationModelProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ViewDataAttributeApplicationModelProvider.cs
index 3237558537..7995e5d345 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewDataAttributeApplicationModelProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ViewDataAttributeApplicationModelProvider.cs
@@ -3,10 +3,8 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class ViewDataAttributeApplicationModelProvider : IApplicationModelProvider
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewDataAttributePropertyProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ViewDataAttributePropertyProvider.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewDataAttributePropertyProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ViewDataAttributePropertyProvider.cs
index 494a4b6c2d..102033ca9c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewDataAttributePropertyProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Filters/ViewDataAttributePropertyProvider.cs
@@ -6,9 +6,9 @@ using System.Collections.Generic;
using System.Reflection;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
- public static class ViewDataAttributePropertyProvider
+ internal static class ViewDataAttributePropertyProvider
{
public static IReadOnlyList GetViewDataProperties(Type type)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/FormContext.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/FormContext.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/FormContext.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/FormContext.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/FormatWeekHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/FormatWeekHelper.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/FormatWeekHelper.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/FormatWeekHelper.cs
index 56e8329a69..5ed508cd7d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/FormatWeekHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/FormatWeekHelper.cs
@@ -5,9 +5,9 @@ using System;
using System.Globalization;
using System.Threading;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
- public class FormatWeekHelper
+ internal static class FormatWeekHelper
{
public static string GetFormattedWeek(ModelExplorer modelExplorer)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/HtmlAttributePropertyHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/HtmlAttributePropertyHelper.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/HtmlAttributePropertyHelper.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/HtmlAttributePropertyHelper.cs
index 3b0db8ee6e..9f9161293d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/HtmlAttributePropertyHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/HtmlAttributePropertyHelper.cs
@@ -6,7 +6,7 @@ using System.Collections.Concurrent;
using System.Reflection;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
internal class HtmlAttributePropertyHelper : PropertyHelper
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/HtmlHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/HtmlHelper.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/HtmlHelper.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/HtmlHelper.cs
index 108ac5d7bf..8d5c7554ed 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/HtmlHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/HtmlHelper.cs
@@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
@@ -43,9 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
IHtmlGenerator htmlGenerator,
ICompositeViewEngine viewEngine,
IModelMetadataProvider metadataProvider,
-#pragma warning disable PUB0001 // Pubternal type in public API
IViewBufferScope bufferScope,
-#pragma warning restore PUB0001
HtmlEncoder htmlEncoder,
UrlEncoder urlEncoder)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/HtmlHelperOfT.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/HtmlHelperOfT.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/HtmlHelperOfT.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/HtmlHelperOfT.cs
index f4bb418c20..34df7e0068 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/HtmlHelperOfT.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/HtmlHelperOfT.cs
@@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
@@ -24,15 +24,10 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
IHtmlGenerator htmlGenerator,
ICompositeViewEngine viewEngine,
IModelMetadataProvider metadataProvider,
-#pragma warning disable PUB0001 // Pubternal type in public API
IViewBufferScope bufferScope,
-#pragma warning restore PUB0001
HtmlEncoder htmlEncoder,
UrlEncoder urlEncoder,
-#pragma warning disable PUB0001 // Pubternal type in public API
- ExpressionTextCache expressionTextCache
-#pragma warning restore PUB0001
- )
+ ExpressionTextCache expressionTextCache)
: base(
htmlGenerator,
viewEngine,
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/HtmlHelperOptions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/HtmlHelperOptions.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/HtmlHelperOptions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/HtmlHelperOptions.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/IAntiforgeryPolicy.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/IAntiforgeryPolicy.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/IAntiforgeryPolicy.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/IAntiforgeryPolicy.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/IFileVersionProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/IFileVersionProvider.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/IFileVersionProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/IFileVersionProvider.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/IHtmlGenerator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/IHtmlGenerator.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/IHtmlGenerator.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/IHtmlGenerator.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/IModelExpressionProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/IModelExpressionProvider.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/IModelExpressionProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/IModelExpressionProvider.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ITempDataDictionary.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ITempDataDictionary.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ITempDataDictionary.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ITempDataDictionary.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ITempDataDictionaryFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ITempDataDictionaryFactory.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ITempDataDictionaryFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ITempDataDictionaryFactory.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ITempDataProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ITempDataProvider.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ITempDataProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ITempDataProvider.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/InputType.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/InputType.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/InputType.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/InputType.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewFeaturesDiagnosticSourceExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewFeaturesDiagnosticSourceExtensions.cs
deleted file mode 100644
index 305b16a87d..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewFeaturesDiagnosticSourceExtensions.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-// 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.Diagnostics;
-using Microsoft.AspNetCore.Mvc.Rendering;
-using Microsoft.AspNetCore.Mvc.ViewComponents;
-using Microsoft.AspNetCore.Mvc.ViewEngines;
-
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
-{
- internal static class MvcViewFeaturesDiagnosticSourceExtensions
- {
- public static void BeforeViewComponent(
- this DiagnosticSource diagnosticSource,
- ViewComponentContext context,
- object viewComponent)
- {
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeViewComponent"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeViewComponent",
- new
- {
- actionDescriptor = context.ViewContext.ActionDescriptor,
- viewComponentContext = context,
- viewComponent = viewComponent
- });
- }
- }
-
- public static void AfterViewComponent(
- this DiagnosticSource diagnosticSource,
- ViewComponentContext context,
- IViewComponentResult result,
- object viewComponent)
- {
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterViewComponent"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterViewComponent",
- new
- {
- actionDescriptor = context.ViewContext.ActionDescriptor,
- viewComponentContext = context,
- viewComponentResult = result,
- viewComponent = viewComponent
- });
- }
- }
-
- public static void ViewComponentBeforeViewExecute(
- this DiagnosticSource diagnosticSource,
- ViewComponentContext context,
- IView view)
- {
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewComponentBeforeViewExecute"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.ViewComponentBeforeViewExecute",
- new
- {
- actionDescriptor = context.ViewContext.ActionDescriptor,
- viewComponentContext = context,
- view = view
- });
- }
- }
-
- public static void ViewComponentAfterViewExecute(
- this DiagnosticSource diagnosticSource,
- ViewComponentContext context,
- IView view)
- {
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewComponentAfterViewExecute"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.ViewComponentAfterViewExecute",
- new
- {
- actionDescriptor = context.ViewContext.ActionDescriptor,
- viewComponentContext = context,
- view = view
- });
- }
- }
-
- public static void BeforeView(
- this DiagnosticSource diagnosticSource,
- IView view,
- ViewContext viewContext)
- {
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeView"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.BeforeView",
- new { view = view, viewContext = viewContext, });
- }
- }
-
- public static void AfterView(
- this DiagnosticSource diagnosticSource,
- IView view,
- ViewContext viewContext)
- {
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterView"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.AfterView",
- new { view = view, viewContext = viewContext, });
- }
- }
-
- public static void ViewFound(
- this DiagnosticSource diagnosticSource,
- ActionContext actionContext,
- bool isMainPage,
- PartialViewResult viewResult,
- string viewName,
- IView view)
- {
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewFound"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.ViewFound",
- new
- {
- actionContext = actionContext,
- isMainPage = isMainPage,
- result = viewResult,
- viewName = viewName,
- view = view,
- });
- }
- }
-
- public static void ViewNotFound(
- this DiagnosticSource diagnosticSource,
- ActionContext actionContext,
- bool isMainPage,
- PartialViewResult viewResult,
- string viewName,
- IEnumerable searchedLocations)
- {
- if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewNotFound"))
- {
- diagnosticSource.Write(
- "Microsoft.AspNetCore.Mvc.ViewNotFound",
- new
- {
- actionContext = actionContext,
- isMainPage = isMainPage,
- result = viewResult,
- viewName = viewName,
- searchedLocations = searchedLocations,
- });
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/JsonHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/JsonHelper.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/JsonHelper.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/JsonHelper.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/MemberExpressionCacheKey.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MemberExpressionCacheKey.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/MemberExpressionCacheKey.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MemberExpressionCacheKey.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/MemberExpressionCacheKeyComparer.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MemberExpressionCacheKeyComparer.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/MemberExpressionCacheKeyComparer.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MemberExpressionCacheKeyComparer.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj
index 878ac41bd4..f1c9951d7b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj
@@ -6,7 +6,7 @@ Commonly used types:
Microsoft.AspNetCore.Mvc.Controller
Microsoft.AspNetCore.Mvc.ValidateAntiForgeryTokenAttribute
Microsoft.AspNetCore.Mvc.ViewComponent
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
true
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ModelExplorer.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelExplorer.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ModelExplorer.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelExplorer.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ModelExplorerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelExplorerExtensions.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ModelExplorerExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelExplorerExtensions.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ModelExpression.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelExpression.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ModelExpression.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelExpression.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ModelExpressionProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelExpressionProvider.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ModelExpressionProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelExpressionProvider.cs
index f6880a66f7..9d4c73b745 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ModelExpressionProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelExpressionProvider.cs
@@ -4,7 +4,6 @@
using System;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
@@ -23,10 +22,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
/// The .
public ModelExpressionProvider(
IModelMetadataProvider modelMetadataProvider,
-#pragma warning disable PUB0001 // Pubternal type in public API
- ExpressionTextCache expressionTextCache
-#pragma warning restore PUB0001
- )
+ ExpressionTextCache expressionTextCache)
{
if (modelMetadataProvider == null)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ModelMetadataProviderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelMetadataProviderExtensions.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ModelMetadataProviderExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelMetadataProviderExtensions.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelStateDictionaryExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelStateDictionaryExtensions.cs
index 7e023c4b7f..a80479e75d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelStateDictionaryExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ModelStateDictionaryExtensions.cs
@@ -4,7 +4,7 @@
using System;
using System.Linq;
using System.Linq.Expressions;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesDiagnosticSourceExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesDiagnosticSourceExtensions.cs
new file mode 100644
index 0000000000..fa237a7d5d
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesDiagnosticSourceExtensions.cs
@@ -0,0 +1,232 @@
+// 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.Diagnostics;
+using Microsoft.AspNetCore.Mvc.Rendering;
+using Microsoft.AspNetCore.Mvc.ViewComponents;
+using Microsoft.AspNetCore.Mvc.ViewEngines;
+
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
+{
+ internal static class MvcViewFeaturesDiagnosticSourceExtensions
+ {
+ public static void BeforeViewComponent(
+ this DiagnosticListener diagnosticListener,
+ ViewComponentContext context,
+ object viewComponent)
+ {
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeViewComponentImpl(diagnosticListener, context, viewComponent);
+ }
+ }
+
+ private static void BeforeViewComponentImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, object viewComponent)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeViewComponent"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeViewComponent",
+ new
+ {
+ actionDescriptor = context.ViewContext.ActionDescriptor,
+ viewComponentContext = context,
+ viewComponent = viewComponent
+ });
+ }
+ }
+
+ public static void AfterViewComponent(
+ this DiagnosticListener diagnosticListener,
+ ViewComponentContext context,
+ IViewComponentResult result,
+ object viewComponent)
+ {
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterViewComponentImpl(diagnosticListener, context, result, viewComponent);
+ }
+ }
+
+ private static void AfterViewComponentImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, IViewComponentResult result, object viewComponent)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterViewComponent"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterViewComponent",
+ new
+ {
+ actionDescriptor = context.ViewContext.ActionDescriptor,
+ viewComponentContext = context,
+ viewComponentResult = result,
+ viewComponent = viewComponent
+ });
+ }
+ }
+
+ public static void ViewComponentBeforeViewExecute(
+ this DiagnosticListener diagnosticListener,
+ ViewComponentContext context,
+ IView view)
+ {
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ ViewComponentBeforeViewExecuteImpl(diagnosticListener, context, view);
+ }
+ }
+
+ private static void ViewComponentBeforeViewExecuteImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, IView view)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewComponentBeforeViewExecute"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.ViewComponentBeforeViewExecute",
+ new
+ {
+ actionDescriptor = context.ViewContext.ActionDescriptor,
+ viewComponentContext = context,
+ view = view
+ });
+ }
+ }
+
+ public static void ViewComponentAfterViewExecute(
+ this DiagnosticListener diagnosticListener,
+ ViewComponentContext context,
+ IView view)
+ {
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ ViewComponentAfterViewExecuteImpl(diagnosticListener, context, view);
+ }
+ }
+
+ private static void ViewComponentAfterViewExecuteImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, IView view)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewComponentAfterViewExecute"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.ViewComponentAfterViewExecute",
+ new
+ {
+ actionDescriptor = context.ViewContext.ActionDescriptor,
+ viewComponentContext = context,
+ view = view
+ });
+ }
+ }
+
+ public static void BeforeView(
+ this DiagnosticListener diagnosticListener,
+ IView view,
+ ViewContext viewContext)
+ {
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ BeforeViewImpl(diagnosticListener, view, viewContext);
+ }
+ }
+
+ private static void BeforeViewImpl(DiagnosticListener diagnosticListener, IView view, ViewContext viewContext)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeView"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.BeforeView",
+ new { view = view, viewContext = viewContext, });
+ }
+ }
+
+ public static void AfterView(
+ this DiagnosticListener diagnosticListener,
+ IView view,
+ ViewContext viewContext)
+ {
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ AfterViewImpl(diagnosticListener, view, viewContext);
+ }
+ }
+
+ private static void AfterViewImpl(DiagnosticListener diagnosticListener, IView view, ViewContext viewContext)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterView"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.AfterView",
+ new { view = view, viewContext = viewContext, });
+ }
+ }
+
+ public static void ViewFound(
+ this DiagnosticListener diagnosticListener,
+ ActionContext actionContext,
+ bool isMainPage,
+ PartialViewResult viewResult,
+ string viewName,
+ IView view)
+ {
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ ViewFoundImpl(diagnosticListener, actionContext, isMainPage, viewResult, viewName, view);
+ }
+ }
+
+ private static void ViewFoundImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, PartialViewResult viewResult, string viewName, IView view)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewFound"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.ViewFound",
+ new
+ {
+ actionContext = actionContext,
+ isMainPage = isMainPage,
+ result = viewResult,
+ viewName = viewName,
+ view = view,
+ });
+ }
+ }
+
+ public static void ViewNotFound(
+ this DiagnosticListener diagnosticListener,
+ ActionContext actionContext,
+ bool isMainPage,
+ PartialViewResult viewResult,
+ string viewName,
+ IEnumerable searchedLocations)
+ {
+ // Inlinable fast-path check if Diagnositcs is enabled
+ if (diagnosticListener.IsEnabled())
+ {
+ ViewNotFoundImpl(diagnosticListener, actionContext, isMainPage, viewResult, viewName, searchedLocations);
+ }
+ }
+
+ private static void ViewNotFoundImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, PartialViewResult viewResult, string viewName, IEnumerable searchedLocations)
+ {
+ if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewNotFound"))
+ {
+ diagnosticListener.Write(
+ "Microsoft.AspNetCore.Mvc.ViewNotFound",
+ new
+ {
+ actionContext = actionContext,
+ isMainPage = isMainPage,
+ result = viewResult,
+ viewName = viewName,
+ searchedLocations = searchedLocations,
+ });
+ }
+ }
+ }
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewFeaturesLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesLoggerExtensions.cs
similarity index 99%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewFeaturesLoggerExtensions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesLoggerExtensions.cs
index 7f77416b12..070d4ec775 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewFeaturesLoggerExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesLoggerExtensions.cs
@@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.Extensions.Logging;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
internal static class MvcViewFeaturesLoggerExtensions
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/MvcViewOptionsConfigureCompatibilityOptions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewOptionsConfigureCompatibilityOptions.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/MvcViewOptionsConfigureCompatibilityOptions.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewOptionsConfigureCompatibilityOptions.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/NameAndIdProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/NameAndIdProvider.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/NameAndIdProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/NameAndIdProvider.cs
index 83f9e518e9..c13e46cf23 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/NameAndIdProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/NameAndIdProvider.cs
@@ -4,12 +4,12 @@
using System;
using Microsoft.AspNetCore.Mvc.Rendering;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
///
/// Provides cached values for "name" and "id" HTML attributes.
///
- public static class NameAndIdProvider
+ internal static class NameAndIdProvider
{
private static readonly object PreviousNameAndIdKey = typeof(PreviousNameAndId);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/NullView.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/NullView.cs
similarity index 88%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/NullView.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/NullView.cs
index 6ce44ca33c..77d595e522 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/NullView.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/NullView.cs
@@ -6,9 +6,9 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
- public class NullView : IView
+ internal class NullView : IView
{
public static readonly NullView Instance = new NullView();
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/PageRemoteAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/PageRemoteAttribute.cs
new file mode 100644
index 0000000000..9d8978c9be
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/PageRemoteAttribute.cs
@@ -0,0 +1,59 @@
+// 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 Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
+using Microsoft.AspNetCore.Mvc.Routing;
+using Microsoft.Extensions.DependencyInjection;
+using Resources = Microsoft.AspNetCore.Mvc.ViewFeatures.Resources;
+
+namespace Microsoft.AspNetCore.Mvc
+{
+ ///
+ /// A for razor page handler which configures Unobtrusive validation
+ /// to send an Ajax request to the web site. The invoked handler should return JSON indicating
+ /// whether the value is valid.
+ ///
+ /// Does no server-side validation of the final form submission.
+ [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
+ public class PageRemoteAttribute : RemoteAttributeBase
+ {
+ ///
+ /// The handler name used when generating the URL where client should send a validation request.
+ ///
+ ///
+ /// If not set the ambient value will be used when generating the URL.
+ ///
+ public string PageHandler { get; set; }
+
+ ///
+ /// The page name used when generating the URL where client should send a validation request.
+ ///
+ ///
+ /// If not set the ambient value will be used when generating the URL.
+ ///
+ public string PageName { get; set; }
+
+ ///
+ protected override string GetUrl(ClientModelValidationContext context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ var services = context.ActionContext.HttpContext.RequestServices;
+ var factory = services.GetRequiredService();
+ var urlHelper = factory.GetUrlHelper(context.ActionContext);
+
+ var url = urlHelper.Page(PageName, PageHandler, RouteData);
+
+ if (url == null)
+ {
+ throw new InvalidOperationException(Resources.RemoteAttribute_NoUrlFound);
+ }
+
+ return url;
+ }
+ }
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/PartialViewResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/PartialViewResultExecutor.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/PartialViewResultExecutor.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/PartialViewResultExecutor.cs
index 2644558bc6..18476d7008 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/PartialViewResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/PartialViewResultExecutor.cs
@@ -10,7 +10,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ViewEngines;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
@@ -31,7 +30,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
/// The .
/// The .
/// The .
- /// The .
+ /// The .
/// The .
/// The .
public PartialViewResultExecutor(
@@ -39,10 +38,10 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
IHttpResponseStreamWriterFactory writerFactory,
ICompositeViewEngine viewEngine,
ITempDataDictionaryFactory tempDataFactory,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
ILoggerFactory loggerFactory,
IModelMetadataProvider modelMetadataProvider)
- : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticSource, modelMetadataProvider)
+ : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticListener, modelMetadataProvider)
{
if (loggerFactory == null)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Properties/AssemblyInfo.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Properties/AssemblyInfo.cs
index c49b597b20..581085ab42 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Properties/AssemblyInfo.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Properties/AssemblyInfo.cs
@@ -3,6 +3,14 @@
using System.Runtime.CompilerServices;
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.RazorPages, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.TagHelpers, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.RazorPages.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.TagHelpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Views.TestCommon, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.ViewFeatures.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/RemoteAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/RemoteAttribute.cs
index 119ba657a3..574f11cf91 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/RemoteAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/RemoteAttribute.cs
@@ -2,35 +2,21 @@
// 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.ComponentModel.DataAnnotations;
-using System.Globalization;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Mvc.Routing;
-using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Localization;
-using Microsoft.Extensions.Options;
+using Resources = Microsoft.AspNetCore.Mvc.ViewFeatures.Resources;
namespace Microsoft.AspNetCore.Mvc
{
///
- /// A which configures Unobtrusive validation to send an Ajax request to the
+ /// A for controllers which configures Unobtrusive validation to send an Ajax request to the
/// web site. The invoked action should return JSON indicating whether the value is valid.
///
/// Does no server-side validation of the final form submission.
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
- public class RemoteAttribute : ValidationAttribute, IClientModelValidator
+ public class RemoteAttribute : RemoteAttributeBase
{
- private string _additionalFields = string.Empty;
- private string[] _additionalFieldsSplit = Array.Empty();
- private bool _checkedForLocalizer;
- private IStringLocalizer _stringLocalizer;
-
///
/// Initializes a new instance of the class.
///
@@ -38,10 +24,7 @@ namespace Microsoft.AspNetCore.Mvc
/// Intended for subclasses that support URL generation with no route, action, or controller names.
///
protected RemoteAttribute()
- : base(errorMessageAccessor: () => Resources.RemoteAttribute_RemoteValidationFailed)
- {
- RouteData = new RouteValueDictionary();
- }
+ { }
///
/// Initializes a new instance of the class.
@@ -113,90 +96,14 @@ namespace Microsoft.AspNetCore.Mvc
{
RouteData["area"] = areaName;
}
-
- ///
- /// Gets or sets the HTTP method ("Get" or "Post") client should use when sending a validation
- /// request.
- ///
- public string HttpMethod { get; set; }
-
- ///
- /// Gets or sets the comma-separated names of fields the client should include in a validation request.
- ///
- public string AdditionalFields
- {
- get => _additionalFields;
- set
- {
- _additionalFields = value ?? string.Empty;
- _additionalFieldsSplit = SplitAndTrimPropertyNames(value)
- .Select(field => FormatPropertyForClientValidation(field))
- .ToArray();
- }
- }
-
- ///
- /// Gets the used when generating the URL where client should send a
- /// validation request.
- ///
- protected RouteValueDictionary RouteData { get; }
-
+
///
/// Gets or sets the route name used when generating the URL where client should send a validation request.
///
protected string RouteName { get; set; }
- ///
- /// Formats and for use in generated HTML.
- ///
- ///
- /// Name of the property associated with this instance.
- ///
- /// Comma-separated names of fields the client should include in a validation request.
- ///
- /// Excludes any whitespace from in the return value.
- /// Prefixes each field name in the return value with "*.".
- ///
- public string FormatAdditionalFieldsForClientValidation(string property)
- {
- if (string.IsNullOrEmpty(property))
- {
- throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(property));
- }
-
- var delimitedAdditionalFields = string.Join(",", _additionalFieldsSplit);
- if (!string.IsNullOrEmpty(delimitedAdditionalFields))
- {
- delimitedAdditionalFields = "," + delimitedAdditionalFields;
- }
-
- var formattedString = FormatPropertyForClientValidation(property) + delimitedAdditionalFields;
-
- return formattedString;
- }
-
- ///
- /// Formats for use in generated HTML.
- ///
- /// One field name the client should include in a validation request.
- /// Name of a field the client should include in a validation request.
- /// Returns with a "*." prefix.
- public static string FormatPropertyForClientValidation(string property)
- {
- if (string.IsNullOrEmpty(property))
- {
- throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(property));
- }
-
- return "*." + property;
- }
-
- ///
- /// Returns the URL where the client should send a validation request.
- ///
- /// The used to generate the URL.
- /// The URL where the client should send a validation request.
- protected virtual string GetUrl(ClientModelValidationContext context)
+ ///
+ protected override string GetUrl(ClientModelValidationContext context)
{
if (context == null)
{
@@ -220,101 +127,5 @@ namespace Microsoft.AspNetCore.Mvc
return url;
}
-
- ///
- public override string FormatErrorMessage(string name)
- {
- return string.Format(CultureInfo.CurrentCulture, ErrorMessageString, name);
- }
-
- ///
- ///
- /// Always returns true since this does no validation itself.
- /// Related validations occur only when the client sends a validation request.
- ///
- public override bool IsValid(object value)
- {
- return true;
- }
-
- public virtual void AddValidation(ClientModelValidationContext context)
- {
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- MergeAttribute(context.Attributes, "data-val", "true");
-
- CheckForLocalizer(context);
- var errorMessage = GetErrorMessage(context.ModelMetadata.GetDisplayName());
- MergeAttribute(context.Attributes, "data-val-remote", errorMessage);
-
- MergeAttribute(context.Attributes, "data-val-remote-url", GetUrl(context));
-
- if (!string.IsNullOrEmpty(HttpMethod))
- {
- MergeAttribute(context.Attributes, "data-val-remote-type", HttpMethod);
- }
-
- var additionalFields = FormatAdditionalFieldsForClientValidation(context.ModelMetadata.PropertyName);
- MergeAttribute(context.Attributes, "data-val-remote-additionalfields", additionalFields);
- }
-
- private static void MergeAttribute(IDictionary attributes, string key, string value)
- {
- if (!attributes.ContainsKey(key))
- {
- attributes.Add(key, value);
- }
- }
-
- private static IEnumerable SplitAndTrimPropertyNames(string original)
- {
- if (string.IsNullOrEmpty(original))
- {
- return Array.Empty();
- }
-
- var split = original
- .Split(',')
- .Select(piece => piece.Trim())
- .Where(trimmed => !string.IsNullOrEmpty(trimmed));
-
- return split;
- }
-
- private void CheckForLocalizer(ClientModelValidationContext context)
- {
- if (!_checkedForLocalizer)
- {
- _checkedForLocalizer = true;
-
- var services = context.ActionContext.HttpContext.RequestServices;
- var options = services.GetRequiredService>();
- var factory = services.GetService();
-
- var provider = options.Value.DataAnnotationLocalizerProvider;
- if (factory != null && provider != null)
- {
- _stringLocalizer = provider(
- context.ModelMetadata.ContainerType ?? context.ModelMetadata.ModelType,
- factory);
- }
- }
- }
-
- private string GetErrorMessage(string displayName)
- {
- if (_stringLocalizer != null &&
- !string.IsNullOrEmpty(ErrorMessage) &&
- string.IsNullOrEmpty(ErrorMessageResourceName) &&
- ErrorMessageResourceType == null)
- {
- return _stringLocalizer[ErrorMessage, displayName];
- }
-
- return FormatErrorMessage(displayName);
- }
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/RemoteAttributeBase.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/RemoteAttributeBase.cs
new file mode 100644
index 0000000000..46b06b54a0
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/RemoteAttributeBase.cs
@@ -0,0 +1,224 @@
+// 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.ComponentModel.DataAnnotations;
+using System.Globalization;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc.DataAnnotations;
+using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Localization;
+using Microsoft.Extensions.Options;
+using Resources = Microsoft.AspNetCore.Mvc.ViewFeatures.Resources;
+
+
+namespace Microsoft.AspNetCore.Mvc
+{
+ ///
+ /// A which configures Unobtrusive validation to send an Ajax request to the
+ /// web site. The invoked endpoint should return JSON indicating whether the value is valid.
+ ///
+ /// Does no server-side validation of the final form submission.
+ [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
+ public abstract class RemoteAttributeBase : ValidationAttribute, IClientModelValidator
+ {
+ private string _additionalFields = string.Empty;
+ private string[] _additionalFieldsSplit = Array.Empty();
+ private bool _checkedForLocalizer;
+ private IStringLocalizer _stringLocalizer;
+
+ protected RemoteAttributeBase()
+ : base(errorMessageAccessor: () => Resources.RemoteAttribute_RemoteValidationFailed)
+ {
+ RouteData = new RouteValueDictionary();
+ }
+
+ ///
+ /// Gets the used when generating the URL where client should send a
+ /// validation request.
+ ///
+ protected RouteValueDictionary RouteData { get; }
+
+ ///
+ /// Gets or sets the HTTP method ("Get" or "Post") client should use when sending a validation
+ /// request.
+ ///
+ public string HttpMethod { get; set; }
+
+ ///
+ /// Gets or sets the comma-separated names of fields the client should include in a validation request.
+ ///
+ public string AdditionalFields
+ {
+ get => _additionalFields;
+ set
+ {
+ _additionalFields = value ?? string.Empty;
+ _additionalFieldsSplit = SplitAndTrimPropertyNames(value)
+ .Select(field => FormatPropertyForClientValidation(field))
+ .ToArray();
+ }
+ }
+
+ ///
+ /// Formats and for use in generated HTML.
+ ///
+ ///
+ /// Name of the property associated with this instance.
+ ///
+ /// Comma-separated names of fields the client should include in a validation request.
+ ///
+ /// Excludes any whitespace from in the return value.
+ /// Prefixes each field name in the return value with "*.".
+ ///
+ public string FormatAdditionalFieldsForClientValidation(string property)
+ {
+ if (string.IsNullOrEmpty(property))
+ {
+ throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(property));
+ }
+
+ var delimitedAdditionalFields = string.Join(",", _additionalFieldsSplit);
+ if (!string.IsNullOrEmpty(delimitedAdditionalFields))
+ {
+ delimitedAdditionalFields = "," + delimitedAdditionalFields;
+ }
+
+ var formattedString = FormatPropertyForClientValidation(property) + delimitedAdditionalFields;
+
+ return formattedString;
+ }
+
+ ///
+ /// Formats for use in generated HTML.
+ ///
+ /// One field name the client should include in a validation request.
+ /// Name of a field the client should include in a validation request.
+ /// Returns with a "*." prefix.
+ public static string FormatPropertyForClientValidation(string property)
+ {
+ if (string.IsNullOrEmpty(property))
+ {
+ throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(property));
+ }
+
+ return "*." + property;
+ }
+
+ ///
+ /// Returns the URL where the client should send a validation request.
+ ///
+ /// The used to generate the URL.
+ /// The URL where the client should send a validation request.
+ protected abstract string GetUrl(ClientModelValidationContext context);
+
+ ///
+ public override string FormatErrorMessage(string name)
+ {
+ return string.Format(CultureInfo.CurrentCulture, ErrorMessageString, name);
+ }
+
+ ///
+ ///
+ /// Always returns true since this does no validation itself.
+ /// Related validations occur only when the client sends a validation request.
+ ///
+ public override bool IsValid(object value)
+ {
+ return true;
+ }
+
+ ///
+ /// Adds Unobtrusive validation HTML attributes to .
+ ///
+ ///
+ /// to add Unobtrusive validation HTML attributes to.
+ ///
+ ///
+ /// Calls derived implementation of .
+ ///
+ public virtual void AddValidation(ClientModelValidationContext context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ MergeAttribute(context.Attributes, "data-val", "true");
+
+ CheckForLocalizer(context);
+ var errorMessage = GetErrorMessage(context.ModelMetadata.GetDisplayName());
+ MergeAttribute(context.Attributes, "data-val-remote", errorMessage);
+
+ MergeAttribute(context.Attributes, "data-val-remote-url", GetUrl(context));
+
+ if (!string.IsNullOrEmpty(HttpMethod))
+ {
+ MergeAttribute(context.Attributes, "data-val-remote-type", HttpMethod);
+ }
+
+ var additionalFields = FormatAdditionalFieldsForClientValidation(context.ModelMetadata.PropertyName);
+ MergeAttribute(context.Attributes, "data-val-remote-additionalfields", additionalFields);
+ }
+
+ private static void MergeAttribute(IDictionary attributes, string key, string value)
+ {
+ if (!attributes.ContainsKey(key))
+ {
+ attributes.Add(key, value);
+ }
+ }
+
+ private static IEnumerable SplitAndTrimPropertyNames(string original)
+ {
+ if (string.IsNullOrEmpty(original))
+ {
+ return Array.Empty();
+ }
+
+ var split = original
+ .Split(',')
+ .Select(piece => piece.Trim())
+ .Where(trimmed => !string.IsNullOrEmpty(trimmed));
+
+ return split;
+ }
+
+ private void CheckForLocalizer(ClientModelValidationContext context)
+ {
+ if (!_checkedForLocalizer)
+ {
+ _checkedForLocalizer = true;
+
+ var services = context.ActionContext.HttpContext.RequestServices;
+ var options = services.GetRequiredService>();
+ var factory = services.GetService();
+
+ var provider = options.Value.DataAnnotationLocalizerProvider;
+ if (factory != null && provider != null)
+ {
+ _stringLocalizer = provider(
+ context.ModelMetadata.ContainerType ?? context.ModelMetadata.ModelType,
+ factory);
+ }
+ }
+ }
+
+ private string GetErrorMessage(string displayName)
+ {
+ if (_stringLocalizer != null &&
+ !string.IsNullOrEmpty(ErrorMessage) &&
+ string.IsNullOrEmpty(ErrorMessageResourceName) &&
+ ErrorMessageResourceType == null)
+ {
+ return _stringLocalizer[ErrorMessage, displayName];
+ }
+
+ return FormatErrorMessage(displayName);
+ }
+ }
+}
+
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/MvcForm.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/MvcForm.cs
index 78837e1b23..32d90b2356 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/MvcForm.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/MvcForm.cs
@@ -4,7 +4,7 @@
using System;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
namespace Microsoft.AspNetCore.Mvc.Rendering
{
@@ -76,21 +76,20 @@ namespace Microsoft.AspNetCore.Mvc.Rendering
return;
}
- var viewBufferWriter = _viewContext.Writer as ViewBufferTextWriter;
- if (viewBufferWriter == null)
- {
- foreach (var content in formContext.EndOfFormContent)
- {
- content.WriteTo(_viewContext.Writer, _htmlEncoder);
- }
- }
- else
+ if (_viewContext.Writer is ViewBufferTextWriter viewBufferWriter)
{
foreach (var content in formContext.EndOfFormContent)
{
viewBufferWriter.Write(content);
}
}
+ else
+ {
+ foreach (var content in formContext.EndOfFormContent)
+ {
+ content.WriteTo(_viewContext.Writer, _htmlEncoder);
+ }
+ }
}
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/ViewContext.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/ViewContext.cs
index 88b8b0d74d..f80bf61758 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/ViewContext.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/ViewContext.cs
@@ -6,7 +6,6 @@ using System.IO;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
namespace Microsoft.AspNetCore.Mvc.Rendering
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/SaveTempDataAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/SaveTempDataAttribute.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/SaveTempDataAttribute.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/SaveTempDataAttribute.cs
index 1c9af6ca28..a42be35202 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/SaveTempDataAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/SaveTempDataAttribute.cs
@@ -3,7 +3,7 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/SessionStateTempDataProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/SessionStateTempDataProvider.cs
similarity index 96%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/SessionStateTempDataProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/SessionStateTempDataProvider.cs
index f933e1163f..50fd26799c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/SessionStateTempDataProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/SessionStateTempDataProvider.cs
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
@@ -33,8 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
// Accessing Session property will throw if the session middleware is not enabled.
var session = context.Session;
- byte[] value;
- if (session.TryGetValue(TempDataSessionStateKey, out value))
+ if (session.TryGetValue(TempDataSessionStateKey, out var value))
{
// If we got it from Session, remove it so that no other request gets it
session.Remove(TempDataSessionStateKey);
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/StringHtmlContent.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/StringHtmlContent.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/StringHtmlContent.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/StringHtmlContent.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TempDataDictionary.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TempDataDictionary.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TempDataDictionary.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TempDataDictionary.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TempDataDictionaryFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TempDataDictionaryFactory.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TempDataDictionaryFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TempDataDictionaryFactory.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TemplateBuilder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TemplateBuilder.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TemplateBuilder.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TemplateBuilder.cs
index 62d4b3ea86..405f224878 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TemplateBuilder.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TemplateBuilder.cs
@@ -8,10 +8,11 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
- public class TemplateBuilder
+ internal class TemplateBuilder
{
private readonly IViewEngine _viewEngine;
private readonly IViewBufferScope _bufferScope;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TemplateInfo.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TemplateInfo.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TemplateInfo.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TemplateInfo.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TemplateRenderer.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TemplateRenderer.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TemplateRenderer.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TemplateRenderer.cs
index f90a3441ed..7b90535cdf 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TemplateRenderer.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TemplateRenderer.cs
@@ -11,11 +11,12 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.Extensions.DependencyInjection;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
- public class TemplateRenderer
+ internal class TemplateRenderer
{
private const string DisplayTemplateViewPath = "DisplayTemplates";
private const string EditorTemplateViewPath = "EditorTemplates";
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TryGetValueDelegate.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TryGetValueDelegate.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TryGetValueDelegate.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TryGetValueDelegate.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TryGetValueProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TryGetValueProvider.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/TryGetValueProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/TryGetValueProvider.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ValidateAntiForgeryTokenAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ValidateAntiForgeryTokenAttribute.cs
index fcf1bd3f8f..cfdc6e14c8 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ValidateAntiForgeryTokenAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ValidateAntiForgeryTokenAttribute.cs
@@ -3,7 +3,7 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ValidationHelpers.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ValidationHelpers.cs
similarity index 97%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ValidationHelpers.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ValidationHelpers.cs
index 54c40227dd..fec4837dde 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ValidationHelpers.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ValidationHelpers.cs
@@ -6,9 +6,9 @@ using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
- public static class ValidationHelpers
+ internal static class ValidationHelpers
{
public static string GetModelErrorMessageOrDefault(ModelError modelError)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ValidationHtmlAttributeProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ValidationHtmlAttributeProvider.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ValidationHtmlAttributeProvider.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ValidationHtmlAttributeProvider.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponent.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponent.cs
index f0ae37312b..125fdc86ac 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponent.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponent.cs
@@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponentResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponentResult.cs
index cbdb85574c..433f44eff4 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponentResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponentResult.cs
@@ -5,7 +5,6 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewComponentResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponentResultExecutor.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewComponentResultExecutor.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponentResultExecutor.cs
index 164de35ba1..6a4fd56ba4 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewComponentResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponentResultExecutor.cs
@@ -5,11 +5,11 @@ using System;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
+using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentActivator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentActivator.cs
index ee04bc53b6..f4b1509016 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentActivator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentActivator.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
namespace Microsoft.AspNetCore.Mvc.ViewComponents
@@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
/// to a public property of a view component marked
/// with .
///
- public class DefaultViewComponentActivator : IViewComponentActivator
+ internal class DefaultViewComponentActivator : IViewComponentActivator
{
private readonly ITypeActivatorCache _typeActivatorCache;
@@ -25,9 +25,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
///
/// The used to create new view component instances.
///
-#pragma warning disable PUB0001 // Pubternal type in public API
public DefaultViewComponentActivator(ITypeActivatorCache typeActivatorCache)
-#pragma warning restore PUB0001
{
if (typeActivatorCache == null)
{
@@ -38,7 +36,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
}
///
- public virtual object Create(ViewComponentContext context)
+ public object Create(ViewComponentContext context)
{
if (context == null)
{
@@ -62,7 +60,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
}
///
- public virtual void Release(ViewComponentContext context, object viewComponent)
+ public void Release(ViewComponentContext context, object viewComponent)
{
if (context == null)
{
@@ -74,11 +72,10 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
throw new InvalidOperationException(nameof(viewComponent));
}
- var disposable = viewComponent as IDisposable;
- if (disposable != null)
+ if (viewComponent is IDisposable disposable)
{
disposable.Dispose();
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentHelper.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentHelper.cs
index ad979c9ae0..d446a6c172 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentHelper.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentHelper.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewComponents
@@ -41,9 +41,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
HtmlEncoder htmlEncoder,
IViewComponentSelector selector,
IViewComponentInvokerFactory invokerFactory,
-#pragma warning disable PUB0001 // Pubternal type in public API
IViewBufferScope viewBufferScope
-#pragma warning restore PUB0001
)
{
if (descriptorProvider == null)
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvoker.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvoker.cs
index 9111ccef3b..a7f6fa6617 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvoker.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvoker.cs
@@ -7,7 +7,6 @@ using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
@@ -16,11 +15,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
///
/// Default implementation for .
///
- public class DefaultViewComponentInvoker : IViewComponentInvoker
+ internal class DefaultViewComponentInvoker : IViewComponentInvoker
{
private readonly IViewComponentFactory _viewComponentFactory;
private readonly ViewComponentInvokerCache _viewComponentInvokerCache;
- private readonly DiagnosticSource _diagnosticSource;
+ private readonly DiagnosticListener _diagnosticListener;
private readonly ILogger _logger;
///
@@ -28,14 +27,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
///
/// The .
/// The .
- /// The .
+ /// The .
/// The .
public DefaultViewComponentInvoker(
IViewComponentFactory viewComponentFactory,
-#pragma warning disable PUB0001 // Pubternal type in public API
ViewComponentInvokerCache viewComponentInvokerCache,
-#pragma warning restore PUB0001
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
ILogger logger)
{
if (viewComponentFactory == null)
@@ -48,9 +45,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
throw new ArgumentNullException(nameof(viewComponentInvokerCache));
}
- if (diagnosticSource == null)
+ if (diagnosticListener == null)
{
- throw new ArgumentNullException(nameof(diagnosticSource));
+ throw new ArgumentNullException(nameof(diagnosticListener));
}
if (logger == null)
@@ -60,7 +57,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
_viewComponentFactory = viewComponentFactory;
_viewComponentInvokerCache = viewComponentInvokerCache;
- _diagnosticSource = diagnosticSource;
+ _diagnosticListener = diagnosticListener;
_logger = logger;
}
@@ -104,7 +101,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
{
var arguments = PrepareArguments(context.Arguments, executor);
- _diagnosticSource.BeforeViewComponent(context, component);
+ _diagnosticListener.BeforeViewComponent(context, component);
_logger.ViewComponentExecuting(context, arguments);
var stopwatch = ValueStopwatch.StartNew();
@@ -131,7 +128,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
var viewComponentResult = CoerceToViewComponentResult(resultAsObject);
_logger.ViewComponentExecuted(context, stopwatch.GetElapsedTime(), viewComponentResult);
- _diagnosticSource.AfterViewComponent(context, viewComponentResult, component);
+ _diagnosticListener.AfterViewComponent(context, viewComponentResult, component);
_viewComponentFactory.ReleaseViewComponent(context, component);
@@ -147,7 +144,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
{
var arguments = PrepareArguments(context.Arguments, executor);
- _diagnosticSource.BeforeViewComponent(context, component);
+ _diagnosticListener.BeforeViewComponent(context, component);
_logger.ViewComponentExecuting(context, arguments);
var stopwatch = ValueStopwatch.StartNew();
@@ -164,7 +161,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
var viewComponentResult = CoerceToViewComponentResult(result);
_logger.ViewComponentExecuted(context, stopwatch.GetElapsedTime(), viewComponentResult);
- _diagnosticSource.AfterViewComponent(context, viewComponentResult, component);
+ _diagnosticListener.AfterViewComponent(context, viewComponentResult, component);
_viewComponentFactory.ReleaseViewComponent(context, component);
@@ -179,20 +176,17 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
throw new InvalidOperationException(Resources.ViewComponent_MustReturnValue);
}
- var componentResult = value as IViewComponentResult;
- if (componentResult != null)
+ if (value is IViewComponentResult componentResult)
{
return componentResult;
}
- var stringResult = value as string;
- if (stringResult != null)
+ if (value is string stringResult)
{
return new ContentViewComponentResult(stringResult);
}
- var htmlContent = value as IHtmlContent;
- if (htmlContent != null)
+ if (value is IHtmlContent htmlContent)
{
return new HtmlContentViewComponentResult(htmlContent);
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvokerFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvokerFactory.cs
index 3d67017743..dc9a02161b 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvokerFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvokerFactory.cs
@@ -3,24 +3,21 @@
using System;
using System.Diagnostics;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.ViewComponents
{
- public class DefaultViewComponentInvokerFactory : IViewComponentInvokerFactory
+ internal class DefaultViewComponentInvokerFactory : IViewComponentInvokerFactory
{
private readonly IViewComponentFactory _viewComponentFactory;
private readonly ViewComponentInvokerCache _viewComponentInvokerCache;
private readonly ILogger _logger;
- private readonly DiagnosticSource _diagnosticSource;
+ private readonly DiagnosticListener _diagnosticListener;
public DefaultViewComponentInvokerFactory(
IViewComponentFactory viewComponentFactory,
-#pragma warning disable PUB0001 // Pubternal type in public API
ViewComponentInvokerCache viewComponentInvokerCache,
-#pragma warning restore PUB0001
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
ILoggerFactory loggerFactory)
{
if (viewComponentFactory == null)
@@ -33,9 +30,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
throw new ArgumentNullException(nameof(viewComponentInvokerCache));
}
- if (diagnosticSource == null)
+ if (diagnosticListener == null)
{
- throw new ArgumentNullException(nameof(diagnosticSource));
+ throw new ArgumentNullException(nameof(diagnosticListener));
}
if (loggerFactory == null)
@@ -44,7 +41,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
}
_viewComponentFactory = viewComponentFactory;
- _diagnosticSource = diagnosticSource;
+ _diagnosticListener = diagnosticListener;
_viewComponentInvokerCache = viewComponentInvokerCache;
_logger = loggerFactory.CreateLogger();
@@ -64,7 +61,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
return new DefaultViewComponentInvoker(
_viewComponentFactory,
_viewComponentInvokerCache,
- _diagnosticSource,
+ _diagnosticListener,
_logger);
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewComponentInvokerCache.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewComponentInvokerCache.cs
index e19a2673c5..fe5168a63c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewComponentInvokerCache.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewComponentInvokerCache.cs
@@ -3,13 +3,13 @@
using System;
using System.Collections.Concurrent;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.ViewComponents;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
+using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.Extensions.Internal;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewComponents
{
- public class ViewComponentInvokerCache
+ internal class ViewComponentInvokerCache
{
private readonly IViewComponentDescriptorCollectionProvider _collectionProvider;
@@ -42,8 +42,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
var cache = CurrentCache;
var viewComponentDescriptor = viewComponentContext.ViewComponentDescriptor;
- ObjectMethodExecutor executor;
- if (cache.Entries.TryGetValue(viewComponentDescriptor, out executor))
+ if (cache.Entries.TryGetValue(viewComponentDescriptor, out var executor))
{
return executor;
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewViewComponentResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewViewComponentResult.cs
index 7ccf1df877..e9196c5a18 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewViewComponentResult.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewViewComponentResult.cs
@@ -9,7 +9,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.ViewComponents
@@ -23,7 +22,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
private const string ViewPathFormat = "Components/{0}/{1}";
private const string DefaultViewName = "Default";
- private DiagnosticSource _diagnosticSource;
+ private DiagnosticListener _diagnosticListener;
///
/// Gets or sets the view name.
@@ -116,12 +115,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
var view = result.EnsureSuccessful(originalLocations).View;
using (view as IDisposable)
{
- if (_diagnosticSource == null)
+ if (_diagnosticListener == null)
{
- _diagnosticSource = viewContext.HttpContext.RequestServices.GetRequiredService();
+ _diagnosticListener = viewContext.HttpContext.RequestServices.GetRequiredService();
}
- _diagnosticSource.ViewComponentBeforeViewExecute(context, view);
+ _diagnosticListener.ViewComponentBeforeViewExecute(context, view);
var childViewContext = new ViewContext(
viewContext,
@@ -130,7 +129,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
context.Writer);
await view.RenderAsync(childViewContext);
- _diagnosticSource.ViewComponentAfterViewExecute(context, view);
+ _diagnosticListener.ViewComponentAfterViewExecute(context, view);
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewContextAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewContextAttribute.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewContextAttribute.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewContextAttribute.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataAttribute.cs
index ca0cee6ea0..e9b4c84aa2 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataAttribute.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataAttribute.cs
@@ -2,9 +2,7 @@
// 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.Mvc.ViewFeatures;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
namespace Microsoft.AspNetCore.Mvc
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataDictionary.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionary.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataDictionary.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionary.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataDictionaryAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionaryAttribute.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataDictionaryAttribute.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionaryAttribute.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataDictionaryControllerPropertyActivator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionaryControllerPropertyActivator.cs
similarity index 98%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataDictionaryControllerPropertyActivator.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionaryControllerPropertyActivator.cs
index 352c4aba5b..c3c34d4cfc 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataDictionaryControllerPropertyActivator.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionaryControllerPropertyActivator.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Concurrent;
using System.Threading;
using Microsoft.AspNetCore.Mvc.Controllers;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Internal;
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewDataDictionaryFactory.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionaryFactory.cs
similarity index 95%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewDataDictionaryFactory.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionaryFactory.cs
index 86bd602f6c..76fa685923 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ViewDataDictionaryFactory.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionaryFactory.cs
@@ -7,9 +7,9 @@ using System.Linq.Expressions;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
+namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
- public static class ViewDataDictionaryFactory
+ internal static class ViewDataDictionaryFactory
{
public static Func CreateFactory(TypeInfo modelType)
{
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataDictionaryOfT.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionaryOfT.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataDictionaryOfT.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataDictionaryOfT.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataEvaluator.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataEvaluator.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataEvaluator.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataEvaluator.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataInfo.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataInfo.cs
similarity index 100%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewDataInfo.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewDataInfo.cs
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewExecutor.cs
similarity index 93%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewExecutor.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewExecutor.cs
index 748a9c94b7..5ac1031f56 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewExecutor.cs
@@ -5,12 +5,12 @@ using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
@@ -32,16 +32,16 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
/// The .
/// The .
/// The .
- /// The .
+ /// The .
/// The .
public ViewExecutor(
IOptions viewOptions,
IHttpResponseStreamWriterFactory writerFactory,
ICompositeViewEngine viewEngine,
ITempDataDictionaryFactory tempDataFactory,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
IModelMetadataProvider modelMetadataProvider)
- : this(writerFactory, viewEngine, diagnosticSource)
+ : this(writerFactory, viewEngine, diagnosticListener)
{
if (viewOptions == null)
{
@@ -53,9 +53,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
throw new ArgumentNullException(nameof(tempDataFactory));
}
- if (diagnosticSource == null)
+ if (diagnosticListener == null)
{
- throw new ArgumentNullException(nameof(diagnosticSource));
+ throw new ArgumentNullException(nameof(diagnosticListener));
}
ViewOptions = viewOptions.Value;
@@ -68,11 +68,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
///
/// The .
/// The .
- /// The .
+ /// The .
protected ViewExecutor(
IHttpResponseStreamWriterFactory writerFactory,
ICompositeViewEngine viewEngine,
- DiagnosticSource diagnosticSource)
+ DiagnosticListener diagnosticListener)
{
if (writerFactory == null)
{
@@ -84,20 +84,20 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
throw new ArgumentNullException(nameof(viewEngine));
}
- if (diagnosticSource == null)
+ if (diagnosticListener == null)
{
- throw new ArgumentNullException(nameof(diagnosticSource));
+ throw new ArgumentNullException(nameof(diagnosticListener));
}
WriterFactory = writerFactory;
ViewEngine = viewEngine;
- DiagnosticSource = diagnosticSource;
+ DiagnosticSource = diagnosticListener;
}
///
/// Gets the .
///
- protected DiagnosticSource DiagnosticSource { get; }
+ protected DiagnosticListener DiagnosticSource { get; }
///
/// Gets the .
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewResultExecutor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewResultExecutor.cs
similarity index 92%
rename from src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewResultExecutor.cs
rename to src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewResultExecutor.cs
index 4a2ca98b6d..8cc09aac3c 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewResultExecutor.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewResultExecutor.cs
@@ -10,7 +10,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ViewEngines;
-using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
@@ -31,7 +30,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
/// The .
/// The .
/// The .
- /// The .
+ /// The .
/// The .
/// The .
public ViewResultExecutor(
@@ -39,10 +38,10 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
IHttpResponseStreamWriterFactory writerFactory,
ICompositeViewEngine viewEngine,
ITempDataDictionaryFactory tempDataFactory,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
ILoggerFactory loggerFactory,
IModelMetadataProvider modelMetadataProvider)
- : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticSource, modelMetadataProvider)
+ : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticListener, modelMetadataProvider)
{
if (loggerFactory == null)
{
@@ -108,6 +107,25 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
}
}
+ if (DiagnosticSource.IsEnabled())
+ {
+ OutputDiagnostics(actionContext, viewResult, viewName, stopwatch, result);
+ }
+
+ if (result.Success)
+ {
+ Logger.ViewFound(result.View, stopwatch.GetElapsedTime());
+ }
+ else
+ {
+ Logger.ViewNotFound(viewName, result.SearchedLocations);
+ }
+
+ return result;
+ }
+
+ private void OutputDiagnostics(ActionContext actionContext, ViewResult viewResult, string viewName, ValueStopwatch stopwatch, ViewEngineResult result)
+ {
if (result.Success)
{
if (DiagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewFound"))
@@ -123,8 +141,6 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
view = result.View,
});
}
-
- Logger.ViewFound(result.View, stopwatch.GetElapsedTime());
}
else
{
@@ -141,10 +157,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
searchedLocations = result.SearchedLocations
});
}
- Logger.ViewNotFound(viewName, result.SearchedLocations);
}
-
- return result;
}
///
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/breakingchanges.netcore.json b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/breakingchanges.netcore.json
new file mode 100644
index 0000000000..b7624467da
--- /dev/null
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/breakingchanges.netcore.json
@@ -0,0 +1,72 @@
+[
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.RemoteAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IClientModelValidator",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentActivator : Microsoft.AspNetCore.Mvc.ViewComponents.IViewComponentActivator",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker : Microsoft.AspNetCore.Mvc.ViewComponents.IViewComponentInvoker",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvokerFactory : Microsoft.AspNetCore.Mvc.ViewComponents.IViewComponentInvokerFactory",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionaryControllerPropertyActivator : Microsoft.AspNetCore.Mvc.Internal.IControllerPropertyActivator",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor",
+ "MemberId": "protected .ctor(Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, System.Diagnostics.DiagnosticSource diagnosticSource)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor",
+ "MemberId": "protected System.Diagnostics.DiagnosticSource get_DiagnosticSource()",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor",
+ "MemberId": "public .ctor(Microsoft.Extensions.Options.IOptions viewOptions, Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory tempDataFactory, System.Diagnostics.DiagnosticSource diagnosticSource, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider modelMetadataProvider)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpressionProvider : Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider",
+ "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider modelMetadataProvider, Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ExpressionTextCache expressionTextCache)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper : Microsoft.AspNetCore.Mvc.IViewComponentHelper, Microsoft.AspNetCore.Mvc.ViewFeatures.IViewContextAware",
+ "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.ViewComponents.IViewComponentDescriptorCollectionProvider descriptorProvider, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.AspNetCore.Mvc.ViewComponents.IViewComponentSelector selector, Microsoft.AspNetCore.Mvc.ViewComponents.IViewComponentInvokerFactory invokerFactory, Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.IViewBufferScope viewBufferScope)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, Microsoft.AspNetCore.Mvc.ViewFeatures.IViewContextAware",
+ "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.ViewFeatures.IHtmlGenerator htmlGenerator, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.IViewBufferScope bufferScope, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, System.Text.Encodings.Web.UrlEncoder urlEncoder)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper : Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper, Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper",
+ "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.ViewFeatures.IHtmlGenerator htmlGenerator, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.IViewBufferScope bufferScope, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, System.Text.Encodings.Web.UrlEncoder urlEncoder, Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ExpressionTextCache expressionTextCache)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultValidationHtmlAttributeProvider : Microsoft.AspNetCore.Mvc.ViewFeatures.ValidationHtmlAttributeProvider",
+ "MemberId": "public .ctor(Microsoft.Extensions.Options.IOptions optionsAccessor, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.Internal.ClientValidatorCache clientValidatorCache)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.PartialViewResultExecutor : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor, Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor",
+ "MemberId": "public .ctor(Microsoft.Extensions.Options.IOptions viewOptions, Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory tempDataFactory, System.Diagnostics.DiagnosticSource diagnosticSource, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider modelMetadataProvider)",
+ "Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor, Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor",
+ "MemberId": "public .ctor(Microsoft.Extensions.Options.IOptions viewOptions, Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory tempDataFactory, System.Diagnostics.DiagnosticSource diagnosticSource, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider modelMetadataProvider)",
+ "Kind": "Removal"
+ }
+]
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ApiController.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ApiController.cs
deleted file mode 100644
index ef5c4d6a38..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ApiController.cs
+++ /dev/null
@@ -1,580 +0,0 @@
-// 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.Net;
-using System.Net.Http;
-using System.Security.Principal;
-using System.Text;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-using Microsoft.AspNetCore.Mvc.Routing;
-using Microsoft.AspNetCore.Mvc.WebApiCompatShim;
-using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json;
-
-namespace System.Web.Http
-{
- [UseWebApiRoutes]
- [UseWebApiActionConventions]
- [UseWebApiParameterConventions]
- [UseWebApiOverloading]
- [Controller]
- public abstract class ApiController : IDisposable
- {
- private ControllerContext _controllerContext;
- private HttpRequestMessage _request;
- private IModelMetadataProvider _metadataProvider;
- private IObjectModelValidator _objectValidator;
- private IUrlHelper _urlHelper;
-
- ///
- /// Gets the .
- ///
- public ActionContext ActionContext => ControllerContext;
-
- ///
- /// Gets or sets the .
- ///
- /// The setter is intended for unit testing purposes only.
- [ControllerContext]
- public ControllerContext ControllerContext
- {
- get
- {
- if (_controllerContext == null)
- {
- _controllerContext = new ControllerContext();
- }
-
- return _controllerContext;
- }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- _controllerContext = value;
- }
- }
-
- ///
- /// Gets the http context.
- ///
- public HttpContext Context
- {
- get
- {
- return ControllerContext.HttpContext;
- }
- }
-
- ///
- /// Gets the .
- ///
- /// The setter is intended for unit testing purposes only.
- public IModelMetadataProvider MetadataProvider
- {
- get
- {
- if (_metadataProvider == null)
- {
- _metadataProvider = Context?.RequestServices.GetRequiredService();
- }
-
- return _metadataProvider;
- }
- set
- {
- _metadataProvider = value;
- }
- }
-
- ///
- /// Gets or sets the .
- ///
- public IObjectModelValidator ObjectValidator
- {
- get
- {
- if (_objectValidator == null)
- {
- _objectValidator = Context?.RequestServices.GetRequiredService();
- }
-
- return _objectValidator;
- }
- set
- {
- _objectValidator = value;
- }
- }
-
- ///
- /// Gets model state after the model binding process. This ModelState will be empty before model binding
- /// happens.
- ///
- public ModelStateDictionary ModelState
- {
- get
- {
- return ControllerContext.ModelState;
- }
- }
-
- ///
- /// Gets or sets the HTTP request message.
- ///
- /// The setter is intended for unit testing purposes only.
- public HttpRequestMessage Request
- {
- get
- {
- if (_request == null && ActionContext != null)
- {
- _request = ControllerContext.HttpContext.GetHttpRequestMessage();
- }
-
- return _request;
- }
- set
- {
- _request = value;
- }
- }
-
- ///
- /// Gets a factory used to generate URLs to other APIs.
- ///
- /// The setter is intended for unit testing purposes only.
- public IUrlHelper Url
- {
- get
- {
- if (_urlHelper == null)
- {
- var factory = Context?.RequestServices.GetRequiredService();
- _urlHelper = factory?.GetUrlHelper(ActionContext);
- }
-
- return _urlHelper;
- }
- set
- {
- _urlHelper = value;
- }
- }
-
- ///
- /// Gets or sets the current principal associated with this request.
- ///
- public IPrincipal User
- {
- get
- {
- return Context?.User;
- }
- }
-
- ///
- /// Creates a (400 Bad Request).
- ///
- /// A .
- [NonAction]
- public virtual BadRequestResult BadRequest()
- {
- return new BadRequestResult();
- }
-
- ///
- /// Creates a (400 Bad Request) with the specified error message.
- ///
- /// The user-visible error message.
- /// A with the specified error message.
- [NonAction]
- public virtual BadRequestErrorMessageResult BadRequest(string message)
- {
- if (message == null)
- {
- throw new ArgumentNullException(nameof(message));
- }
-
- return new BadRequestErrorMessageResult(message);
- }
-
- ///
- /// Creates an (400 Bad Request) with the specified model state.
- ///
- /// The model state to include in the error.
- /// An with the specified model state.
- [NonAction]
- public virtual InvalidModelStateResult BadRequest(ModelStateDictionary modelState)
- {
- if (modelState == null)
- {
- throw new ArgumentNullException(nameof(modelState));
- }
-
- return new InvalidModelStateResult(modelState, includeErrorDetail: false);
- }
-
- /// Creates a (409 Conflict).
- /// A .
- [NonAction]
- public virtual ConflictResult Conflict()
- {
- return new ConflictResult();
- }
-
- ///
- /// Creates a with the specified values.
- ///
- /// The type of content in the entity body.
- /// The HTTP status code for the response message.
- /// The content value to negotiate and format in the entity body.
- /// A with the specified values.
- [NonAction]
- public virtual NegotiatedContentResult Content(HttpStatusCode statusCode, T value)
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- return new NegotiatedContentResult(statusCode, value);
- }
-
- ///
- /// Creates a (201 Created) with the specified values.
- ///
- ///
- /// The location at which the content has been created. Must be a relative or absolute URL.
- ///
- /// The content value to format in the entity body.
- /// A with the specified values.
- [NonAction]
- public virtual CreatedResult Created(string location, object content)
- {
- if (location == null)
- {
- throw new ArgumentNullException(nameof(location));
- }
-
- return new CreatedResult(location, content);
- }
-
- ///
- /// Creates a (201 Created) with the specified values.
- ///
- /// The location at which the content has been created.
- /// The content value to format in the entity body.
- /// A with the specified values.
- [NonAction]
- public virtual CreatedResult Created(Uri uri, object content)
- {
- if (uri == null)
- {
- throw new ArgumentNullException(nameof(uri));
- }
-
- string location;
- if (uri.IsAbsoluteUri)
- {
- location = uri.AbsoluteUri;
- }
- else
- {
- location = uri.GetComponents(UriComponents.SerializationInfoString, UriFormat.UriEscaped);
- }
- return Created(location, content);
- }
-
- ///
- /// Creates a (201 Created) with the specified values.
- ///
- /// The name of the route to use for generating the URL.
- /// The route data to use for generating the URL.
- /// The content value to format in the entity body.
- /// A with the specified values.
- [NonAction]
- public virtual CreatedAtRouteResult CreatedAtRoute(
- string routeName,
- object routeValues,
- object content)
- {
- if (routeName == null)
- {
- throw new ArgumentNullException(nameof(routeName));
- }
-
- return new CreatedAtRouteResult(routeName, routeValues, content);
- }
-
- /// Creates an (500 Internal Server Error).
- ///
- /// A .
- [NonAction]
- public virtual InternalServerErrorResult InternalServerError()
- {
- return new InternalServerErrorResult();
- }
-
- ///
- /// Creates an (500 Internal Server Error) with the specified exception.
- ///
- /// The exception to include in the error.
- /// An with the specified exception.
- [NonAction]
- public virtual ExceptionResult InternalServerError(Exception exception)
- {
- if (exception == null)
- {
- throw new ArgumentNullException(nameof(exception));
- }
-
- return new ExceptionResult(exception, includeErrorDetail: false);
- }
-
- ///
- /// Creates an (200 OK) with the specified value.
- ///
- /// The type of content in the entity body.
- /// The content value to serialize in the entity body.
- /// A with the specified value.
- [NonAction]
- public virtual JsonResult Json(T content)
- {
- if (content == null)
- {
- throw new ArgumentNullException(nameof(content));
- }
-
- return new JsonResult(content);
- }
-
- ///
- /// Creates an (200 OK) with the specified values.
- ///
- /// The type of content in the entity body.
- /// The content value to serialize in the entity body.
- /// The serializer settings.
- /// A with the specified values.
- [NonAction]
- public virtual JsonResult Json(T content, JsonSerializerSettings serializerSettings)
- {
- if (content == null)
- {
- throw new ArgumentNullException(nameof(content));
- }
-
- if (serializerSettings == null)
- {
- throw new ArgumentNullException(nameof(serializerSettings));
- }
-
- return new JsonResult(content, serializerSettings);
- }
-
- ///
- /// Creates an (200 OK) with the specified values.
- ///
- /// The type of content in the entity body.
- /// The content value to serialize in the entity body.
- /// The serializer settings.
- /// The content encoding.
- /// A with the specified values.
- [NonAction]
- public virtual JsonResult Json(
- T content,
- JsonSerializerSettings serializerSettings,
- Encoding encoding)
- {
- if (content == null)
- {
- throw new ArgumentNullException(nameof(content));
- }
-
- if (serializerSettings == null)
- {
- throw new ArgumentNullException(nameof(serializerSettings));
- }
-
- if (encoding == null)
- {
- throw new ArgumentNullException(nameof(encoding));
- }
-
- var result = new JsonResult(content, serializerSettings);
- result.ContentType = $"application/json; charset={encoding.WebName}";
-
- return result;
- }
-
- ///
- /// Creates an (404 Not Found).
- ///
- /// A .
- [NonAction]
- public virtual NotFoundResult NotFound()
- {
- return new NotFoundResult();
- }
-
- ///
- /// Creates an (200 OK).
- ///
- /// An .
- [NonAction]
- public virtual OkResult Ok()
- {
- return new OkResult();
- }
-
- ///
- /// Creates an (200 OK) with the specified values.
- ///
- /// The type of content in the entity body.
- /// The content value to negotiate and format in the entity body.
- /// An with the specified values.
- [NonAction]
- public virtual OkObjectResult Ok(T content)
- {
- return new OkObjectResult(content);
- }
-
- ///
- /// Creates a (302 Found) with the specified value.
- ///
- /// The location to which to redirect.
- /// A with the specified value.
- [NonAction]
- public virtual RedirectResult Redirect(string location)
- {
- if (location == null)
- {
- throw new ArgumentNullException(nameof(location));
- }
-
- // This is how redirect was implemented in legacy webapi - string URIs are assumed to be absolute.
- return Redirect(new Uri(location));
- }
-
- ///
- /// Creates a (302 Found) with the specified value.
- ///
- /// The location to which to redirect.
- /// A with the specified value.
- [NonAction]
- public virtual RedirectResult Redirect(Uri location)
- {
- if (location == null)
- {
- throw new ArgumentNullException(nameof(location));
- }
-
- string uri;
- if (location.IsAbsoluteUri)
- {
- uri = location.AbsoluteUri;
- }
- else
- {
- uri = location.GetComponents(UriComponents.SerializationInfoString, UriFormat.UriEscaped);
- }
-
- return new RedirectResult(uri);
- }
-
- ///
- /// Creates a (302 Found) with the specified values.
- ///
- /// The name of the route to use for generating the URL.
- /// The route data to use for generating the URL.
- /// A with the specified values.
- [NonAction]
- public virtual RedirectToRouteResult RedirectToRoute(string routeName, object routeValues)
- {
- if (routeName == null)
- {
- throw new ArgumentNullException(nameof(routeName));
- }
-
- if (routeValues == null)
- {
- throw new ArgumentNullException(nameof(routeValues));
- }
-
- return new RedirectToRouteResult(routeName, routeValues)
- {
- UrlHelper = Url,
- };
- }
-
- ///
- /// Creates a with the specified response.
- ///
- /// The HTTP response message.
- /// A for the specified response.
- [NonAction]
- public virtual ResponseMessageResult ResponseMessage(HttpResponseMessage response)
- {
- if (response == null)
- {
- throw new ArgumentNullException(nameof(response));
- }
-
- return new ResponseMessageResult(response);
- }
-
- ///
- /// Creates a with the specified status code.
- ///
- /// The HTTP status code for the response message
- /// A with the specified status code.
- [NonAction]
- public virtual StatusCodeResult StatusCode(HttpStatusCode status)
- {
- return new StatusCodeResult((int)status);
- }
-
- ///
- public void Dispose() => Dispose(disposing: true);
-
- ///
- /// Validates the given entity and adds the validation errors to the
- /// under an empty prefix.
- ///
- /// The type of the entity to be validated.
- /// The entity being validated.
- public void Validate(TEntity entity)
- {
- Validate(entity, keyPrefix: string.Empty);
- }
-
- ///
- /// Validates the given entity and adds the validation errors to the .
- ///
- /// The type of the entity to be validated.
- /// The entity being validated.
- ///
- /// The key prefix under which the model state errors would be added in the
- /// .
- ///
- public void Validate(TEntity entity, string keyPrefix)
- {
- ObjectValidator.Validate(
- ControllerContext,
- validationState: null,
- prefix: keyPrefix,
- model: entity);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/BadRequestErrorMessageResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/BadRequestErrorMessageResult.cs
deleted file mode 100644
index f9f313f899..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/BadRequestErrorMessageResult.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-
-namespace System.Web.Http
-{
- ///
- /// An action result that returns a response and performs
- /// content negotiation on an with a .
- ///
- public class BadRequestErrorMessageResult : ObjectResult
- {
- /// Initializes a new instance of the class.
- /// The user-visible error message.
- public BadRequestErrorMessageResult(string message)
- : base(new HttpError(message))
- {
- if (message == null)
- {
- throw new ArgumentNullException(nameof(message));
- }
-
- Message = message;
- }
-
- ///
- /// Gets the error message.
- ///
- public string Message { get; private set; }
-
- ///
- public override Task ExecuteResultAsync(ActionContext context)
- {
- context.HttpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
- return base.ExecuteResultAsync(context);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ConflictResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ConflictResult.cs
deleted file mode 100644
index ee83c08611..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ConflictResult.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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.Http;
-using Microsoft.AspNetCore.Mvc;
-
-namespace System.Web.Http
-{
- ///
- /// An action result that returns an empty response.
- ///
- public class ConflictResult : StatusCodeResult
- {
- ///
- /// Initializes a new instance of the class.
- ///
- public ConflictResult()
- : base(StatusCodes.Status409Conflict)
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiActionConventions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiActionConventions.cs
deleted file mode 100644
index e2ac33be1a..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiActionConventions.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// 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.WebApiCompatShim
-{
- ///
- /// Indicates actions without attribute routes in a controller use ASP.NET Web API routing conventions.
- ///
- public interface IUseWebApiActionConventions
- {
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiOverloading.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiOverloading.cs
deleted file mode 100644
index cb92ea4661..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiOverloading.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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.WebApiCompatShim
-{
- ///
- /// Indicates actions in a controller should be selected only if all non-optional parameters are satisfied. Applies
- /// the to all actions in the controller.
- ///
- public interface IUseWebApiOverloading
- {
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiParameterConventions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiParameterConventions.cs
deleted file mode 100644
index 1f74ef2fc6..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiParameterConventions.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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.WebApiCompatShim
-{
- ///
- /// Indicates the model binding system should use ASP.NET Web API conventions for parameters of a controller's
- /// actions. For example, bind simple types from the URI.
- ///
- public interface IUseWebApiParameterConventions
- {
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiRoutes.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiRoutes.cs
deleted file mode 100644
index f0efadbd90..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/IUseWebApiRoutes.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// 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.WebApiCompatShim
-{
- ///
- /// Indicates the controller is in the "api" area.
- ///
- public interface IUseWebApiRoutes
- {
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiActionConventionsAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiActionConventionsAttribute.cs
deleted file mode 100644
index 15a0725f50..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiActionConventionsAttribute.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- ///
- /// Indicates actions without attribute routes in a controller use ASP.NET Web API routing conventions.
- ///
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
- public class UseWebApiActionConventionsAttribute : Attribute, IUseWebApiActionConventions
- {
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiOverloadingAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiOverloadingAttribute.cs
deleted file mode 100644
index f253f0f0bf..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiOverloadingAttribute.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- ///
- /// Indicates actions in a controller should be selected only if all non-optional parameters are satisfied. Applies
- /// the to all actions in the controller.
- ///
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
- public class UseWebApiOverloadingAttribute : Attribute, IUseWebApiOverloading
- {
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiParameterConventionsAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiParameterConventionsAttribute.cs
deleted file mode 100644
index 3626945271..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiParameterConventionsAttribute.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- ///
- /// Indicates the model binding system should use ASP.NET Web API conventions for parameters of a controller's
- /// actions. For example, bind simple types from the URI.
- ///
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
- public class UseWebApiParameterConventionsAttribute : Attribute, IUseWebApiParameterConventions
- {
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiRoutesAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiRoutesAttribute.cs
deleted file mode 100644
index 17d14aba37..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/UseWebApiRoutesAttribute.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- ///
- /// Indicates the controller is in the "api" area.
- ///
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
- public class UseWebApiRoutesAttribute : Attribute, IUseWebApiRoutes
- {
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiActionConventionsApplicationModelConvention.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiActionConventionsApplicationModelConvention.cs
deleted file mode 100644
index 95b4168a9a..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiActionConventionsApplicationModelConvention.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-// 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 Microsoft.AspNetCore.Mvc.ApplicationModels;
-using Microsoft.AspNetCore.Mvc.Internal;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- public class WebApiActionConventionsApplicationModelConvention : IControllerModelConvention
- {
- private static readonly string[] SupportedHttpMethodConventions = new string[]
- {
- "GET",
- "PUT",
- "POST",
- "DELETE",
- "PATCH",
- "HEAD",
- "OPTIONS",
- };
-
- public void Apply(ControllerModel controller)
- {
- if (controller == null)
- {
- throw new ArgumentNullException(nameof(controller));
- }
-
- if (IsConventionApplicable(controller))
- {
- var newActions = new List();
-
- foreach (var action in controller.Actions)
- {
- SetHttpMethodFromConvention(action);
-
- // Action Name doesn't really come into play with attribute routed actions. However for a
- // non-attribute-routed action we need to create a 'named' version and an 'unnamed' version.
- if (!IsActionAttributeRouted(action))
- {
- var namedAction = action;
-
- var unnamedAction = new ActionModel(namedAction);
- unnamedAction.RouteValues.Add("action", null);
- newActions.Add(unnamedAction);
- }
- }
-
- foreach (var action in newActions)
- {
- controller.Actions.Add(action);
- }
- }
- }
-
- private bool IsConventionApplicable(ControllerModel controller)
- {
- return controller.Attributes.OfType().Any();
- }
-
- private bool IsActionAttributeRouted(ActionModel action)
- {
- foreach (var controllerSelectorModel in action.Controller.Selectors)
- {
- if (controllerSelectorModel.AttributeRouteModel?.Template != null)
- {
- return true;
- }
- }
-
- foreach (var actionSelectorModel in action.Selectors)
- {
- if (actionSelectorModel.AttributeRouteModel?.Template != null)
- {
- return true;
- }
- }
-
- return false;
- }
-
- private void SetHttpMethodFromConvention(ActionModel action)
- {
- foreach (var selector in action.Selectors)
- {
- if (selector.ActionConstraints.OfType().Count() > 0)
- {
- // If the HttpMethods are set from attributes, don't override it with the convention
- return;
- }
- }
-
- // The Method name is used to infer verb constraints. Changing the action name has no impact.
- foreach (var verb in SupportedHttpMethodConventions)
- {
- if (action.ActionMethod.Name.StartsWith(verb, StringComparison.OrdinalIgnoreCase))
- {
- foreach (var selector in action.Selectors)
- {
- selector.ActionConstraints.Add(new HttpMethodActionConstraint(new[] { verb }));
- }
-
- return;
- }
- }
-
- // If no convention matches, then assume POST
- foreach (var actionSelectorModel in action.Selectors)
- {
- actionSelectorModel.ActionConstraints.Add(new HttpMethodActionConstraint(new[] { "POST" }));
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiOverloadingApplicationModelConvention.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiOverloadingApplicationModelConvention.cs
deleted file mode 100644
index 5a90c715ca..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiOverloadingApplicationModelConvention.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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.ApplicationModels;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- public class WebApiOverloadingApplicationModelConvention : IActionModelConvention
- {
- public void Apply(ActionModel action)
- {
- if (action == null)
- {
- throw new ArgumentNullException(nameof(action));
- }
-
- if (IsConventionApplicable(action.Controller))
- {
- foreach (var actionSelectorModel in action.Selectors)
- {
- actionSelectorModel.ActionConstraints.Add(new OverloadActionConstraint());
- }
- }
- }
-
- private bool IsConventionApplicable(ControllerModel controller)
- {
- return controller.Attributes.OfType().Any();
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiParameterConventionsApplicationModelConvention.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiParameterConventionsApplicationModelConvention.cs
deleted file mode 100644
index 473ee95bb7..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiParameterConventionsApplicationModelConvention.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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.ComponentModel;
-using System.Linq;
-using System.Reflection;
-using System.Web.Http;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- public class WebApiParameterConventionsApplicationModelConvention : IActionModelConvention
- {
- public void Apply(ActionModel action)
- {
- if (action == null)
- {
- throw new ArgumentNullException(nameof(action));
- }
-
- if (IsConventionApplicable(action.Controller))
- {
- var optionalParameters = new HashSet();
- var uriBindingSource = (new FromUriAttribute()).BindingSource;
- foreach (var parameter in action.Parameters)
- {
- // Some IBindingSourceMetadata attributes like ModelBinder attribute return null
- // as their binding source. Special case to ensure we do not ignore them.
- if (parameter.BindingInfo?.BindingSource != null ||
- parameter.Attributes.OfType().Any())
- {
- // This has a binding behavior configured, just leave it alone.
- }
- else if (CanConvertFromString(parameter.ParameterInfo.ParameterType))
- {
- // Simple types are by-default from the URI.
- parameter.BindingInfo = parameter.BindingInfo ?? new BindingInfo();
- parameter.BindingInfo.BindingSource = uriBindingSource;
- }
- else
- {
- // Complex types are by-default from the body.
- parameter.BindingInfo = parameter.BindingInfo ?? new BindingInfo();
- parameter.BindingInfo.BindingSource = BindingSource.Body;
- }
-
- // For all non IOptionalBinderMetadata, which are not URL source (like FromQuery etc.) do not
- // participate in overload selection and hence are added to the hashset so that they can be
- // ignored in OverloadActionConstraint.
- var optionalMetadata = parameter.Attributes.OfType().SingleOrDefault();
- if (parameter.ParameterInfo.HasDefaultValue && parameter.BindingInfo.BindingSource == uriBindingSource ||
- optionalMetadata != null && optionalMetadata.IsOptional ||
- optionalMetadata == null && parameter.BindingInfo.BindingSource != uriBindingSource)
- {
- optionalParameters.Add(parameter.ParameterName);
- }
- }
-
- action.Properties.Add("OptionalParameters", optionalParameters);
- }
- }
-
- private bool IsConventionApplicable(ControllerModel controller)
- {
- return controller.Attributes.OfType().Any();
- }
-
- private static bool CanConvertFromString(Type destinationType)
- {
- destinationType = Nullable.GetUnderlyingType(destinationType) ?? destinationType;
- return IsSimpleType(destinationType) ||
- TypeDescriptor.GetConverter(destinationType).CanConvertFrom(typeof(string));
- }
-
- private static bool IsSimpleType(Type type)
- {
- return type.GetTypeInfo().IsPrimitive ||
- type.Equals(typeof(decimal)) ||
- type.Equals(typeof(string)) ||
- type.Equals(typeof(DateTime)) ||
- type.Equals(typeof(Guid)) ||
- type.Equals(typeof(DateTimeOffset)) ||
- type.Equals(typeof(TimeSpan)) ||
- type.Equals(typeof(Uri));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiRoutesApplicationModelConvention.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiRoutesApplicationModelConvention.cs
deleted file mode 100644
index cb397dcd74..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiRoutesApplicationModelConvention.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.ApplicationModels;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- public class WebApiRoutesApplicationModelConvention : IControllerModelConvention
- {
- private readonly string _area;
-
- public WebApiRoutesApplicationModelConvention(string area)
- {
- _area = area;
- }
-
- public void Apply(ControllerModel controller)
- {
- if (controller == null)
- {
- throw new ArgumentNullException(nameof(controller));
- }
-
- if (IsConventionApplicable(controller))
- {
- controller.RouteValues.Add("area", _area);
- }
- }
-
- private bool IsConventionApplicable(ControllerModel controller)
- {
- return controller.Attributes.OfType().Any();
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ExceptionResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ExceptionResult.cs
deleted file mode 100644
index ea5a7c86ea..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ExceptionResult.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-
-namespace System.Web.Http
-{
- ///
- /// An action result that returns a response and
- /// performs content negotiation on an based on an .
- ///
- public class ExceptionResult : ObjectResult
- {
- /// Initializes a new instance of the class.
- /// The exception to include in the error.
- ///
- /// if the error should include exception messages; otherwise, .
- ///
- public ExceptionResult(Exception exception, bool includeErrorDetail)
- : base(new HttpError(exception, includeErrorDetail))
- {
- Exception = exception;
- IncludeErrorDetail = includeErrorDetail;
- }
-
- ///
- /// Gets the exception to include in the error.
- ///
- public Exception Exception { get; private set; }
-
- ///
- /// Gets a value indicating whether the error should include exception messages.
- ///
- public bool IncludeErrorDetail { get; private set; }
-
- ///
- public override Task ExecuteResultAsync(ActionContext context)
- {
- context.HttpContext.Response.StatusCode = StatusCodes.Status500InternalServerError;
- return base.ExecuteResultAsync(context);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/FormDataCollectionExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/FormDataCollectionExtensions.cs
deleted file mode 100644
index a9539e83a0..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/FormDataCollectionExtensions.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-// 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.Net.Http.Formatting;
-using System.Text;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- public static class FormDataCollectionExtensions
- {
- // This is a helper method to use Model Binding over a JQuery syntax.
- // Normalize from JQuery to MVC keys. The model binding infrastructure uses MVC keys
- // x[] --> x
- // [] --> ""
- // x[field] --> x.field, where field is not a number
- public static string NormalizeJQueryToMvc(string key)
- {
- if (key == null)
- {
- return string.Empty;
- }
-
- StringBuilder sb = null;
- var i = 0;
- while (true)
- {
- var indexOpen = key.IndexOf('[', i);
- if (indexOpen < 0)
- {
- // Fast path, no normalization needed.
- // This skips the string conversion and allocating the string builder.
- if (i == 0)
- {
- return key;
- }
- sb = sb ?? new StringBuilder();
- sb.Append(key, i, key.Length - i);
- break; // no more brackets
- }
-
- sb = sb ?? new StringBuilder();
- sb.Append(key, i, indexOpen - i); // everything up to "["
-
- // Find closing bracket.
- var indexClose = key.IndexOf(']', indexOpen);
- if (indexClose == -1)
- {
- throw new ArgumentException(Resources.JQuerySyntaxMissingClosingBracket, nameof(key));
- }
-
- if (indexClose == indexOpen + 1)
- {
- // Empty bracket. Signifies array. Just remove.
- }
- else
- {
- if (char.IsDigit(key[indexOpen + 1]))
- {
- // array index. Leave unchanged.
- sb.Append(key, indexOpen, indexClose - indexOpen + 1);
- }
- else
- {
- // Field name. Convert to dot notation.
- sb.Append('.');
- sb.Append(key, indexOpen + 1, indexClose - indexOpen - 1);
- }
- }
-
- i = indexClose + 1;
- if (i >= key.Length)
- {
- break; // end of string
- }
- }
- return sb.ToString();
- }
-
- public static IEnumerable> GetJQueryNameValuePairs(
- this FormDataCollection formData)
- {
- if (formData == null)
- {
- throw new ArgumentNullException(nameof(formData));
- }
-
- var count = 0;
-
- foreach (var kv in formData)
- {
- ThrowIfMaxHttpCollectionKeysExceeded(count);
-
- var key = NormalizeJQueryToMvc(kv.Key);
- var value = kv.Value ?? string.Empty;
- yield return new KeyValuePair(key, value);
-
- count++;
- }
- }
-
- private static void ThrowIfMaxHttpCollectionKeysExceeded(int count)
- {
- if (count >= MediaTypeFormatter.MaxHttpCollectionKeys)
- {
- var message = Resources.FormatMaxHttpCollectionKeyLimitReached(
- MediaTypeFormatter.MaxHttpCollectionKeys,
- typeof(MediaTypeFormatter));
- throw new InvalidOperationException(message);
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Formatters/HttpResponseMessageOutputFormatter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Formatters/HttpResponseMessageOutputFormatter.cs
deleted file mode 100644
index f224fa4c49..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Formatters/HttpResponseMessageOutputFormatter.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// 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 System.Net.Http;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Http.Features;
-using Microsoft.AspNetCore.Mvc.Formatters;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- public class HttpResponseMessageOutputFormatter : IOutputFormatter
- {
- public bool CanWriteResult(OutputFormatterCanWriteContext context)
- {
- return context.Object is HttpResponseMessage;
- }
-
- public async Task WriteAsync(OutputFormatterWriteContext context)
- {
- var response = context.HttpContext.Response;
-
- var responseMessage = context.Object as HttpResponseMessage;
- if (responseMessage == null)
- {
- var message = Resources.FormatHttpResponseMessageFormatter_UnsupportedType(
- nameof(HttpResponseMessageOutputFormatter),
- nameof(HttpResponseMessage));
-
- throw new InvalidOperationException(message);
- }
-
- using (responseMessage)
- {
- response.StatusCode = (int)responseMessage.StatusCode;
-
- var responseFeature = context.HttpContext.Features.Get();
- if (responseFeature != null)
- {
- responseFeature.ReasonPhrase = responseMessage.ReasonPhrase;
- }
-
- var responseHeaders = responseMessage.Headers;
-
- // Ignore the Transfer-Encoding header if it is just "chunked".
- // We let the host decide about whether the response should be chunked or not.
- if (responseHeaders.TransferEncodingChunked == true &&
- responseHeaders.TransferEncoding.Count == 1)
- {
- responseHeaders.TransferEncoding.Clear();
- }
-
- foreach (var header in responseHeaders)
- {
- response.Headers.Append(header.Key, header.Value.ToArray());
- }
-
- if (responseMessage.Content != null)
- {
- var contentHeaders = responseMessage.Content.Headers;
-
- // Copy the response content headers only after ensuring they are complete.
- // We ask for Content-Length first because HttpContent lazily computes this
- // and only afterwards writes the value into the content headers.
- var unused = contentHeaders.ContentLength;
-
- foreach (var header in contentHeaders)
- {
- response.Headers.Append(header.Key, header.Value.ToArray());
- }
-
- await responseMessage.Content.CopyToAsync(response.Body);
- }
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpError.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpError.cs
deleted file mode 100644
index f86b30da3a..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpError.cs
+++ /dev/null
@@ -1,285 +0,0 @@
-// 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 System.Xml;
-using System.Xml.Schema;
-using System.Xml.Serialization;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using ShimResources = Microsoft.AspNetCore.Mvc.WebApiCompatShim.Resources;
-
-namespace System.Web.Http
-{
- ///
- /// Defines a serializable container for storing error information. This information is stored
- /// as key/value pairs. The dictionary keys to look up standard error information are available
- /// on the type.
- ///
- [XmlRoot("Error")]
- public sealed class HttpError : Dictionary, IXmlSerializable
- {
- ///
- /// Initializes a new instance of the class.
- ///
- public HttpError()
- : base(StringComparer.OrdinalIgnoreCase)
- {
- }
-
- ///
- /// Initializes a new instance of the class containing error message
- /// .
- ///
- /// The error message to associate with this instance.
- public HttpError(string message)
- : this()
- {
- if (message == null)
- {
- throw new ArgumentNullException(nameof(message));
- }
-
- Message = message;
- }
-
- ///
- /// Initializes a new instance of the class for .
- ///
- /// The exception to use for error information.
- ///
- /// true to include the exception information in the error;false otherwise.
- ///
- public HttpError(Exception exception, bool includeErrorDetail)
- : this()
- {
- if (exception == null)
- {
- throw new ArgumentNullException(nameof(exception));
- }
-
- Message = ShimResources.HttpError_GenericError;
-
- if (includeErrorDetail)
- {
- Add(HttpErrorKeys.ExceptionMessageKey, exception.Message);
- Add(HttpErrorKeys.ExceptionTypeKey, exception.GetType().FullName);
- Add(HttpErrorKeys.StackTraceKey, exception.StackTrace);
- if (exception.InnerException != null)
- {
- Add(HttpErrorKeys.InnerExceptionKey, new HttpError(exception.InnerException, includeErrorDetail));
- }
- }
- }
-
- ///
- /// Initializes a new instance of the class for .
- ///
- /// The invalid model state to use for error information.
- ///
- /// true to include exception messages in the error; false otherwise.
- ///
- public HttpError(ModelStateDictionary modelState, bool includeErrorDetail)
- : this()
- {
- if (modelState == null)
- {
- throw new ArgumentNullException(nameof(modelState));
- }
-
- if (modelState.IsValid)
- {
- throw new ArgumentException(ShimResources.HttpError_ValidModelState, nameof(modelState));
- }
-
- Message = ShimResources.HttpError_BadRequest;
-
- var modelStateError = new HttpError();
- foreach (KeyValuePair keyModelStatePair in modelState)
- {
- var key = keyModelStatePair.Key;
- var errors = keyModelStatePair.Value.Errors;
- if (errors != null && errors.Count > 0)
- {
- var errorMessages = errors.Select(error =>
- {
- if (includeErrorDetail && error.Exception != null)
- {
- return error.Exception.Message;
- }
- else
- {
- return
- string.IsNullOrEmpty(error.ErrorMessage) ?
- ShimResources.HttpError_GenericError :
- error.ErrorMessage;
- }
- }).ToArray();
- modelStateError.Add(key, errorMessages);
- }
- }
-
- Add(HttpErrorKeys.ModelStateKey, modelStateError);
- }
-
- ///
- /// The high-level, user-visible message explaining the cause of the error. Information carried in this field
- /// should be considered public in that it will go over the wire regardless of the value of error detail
- /// policy. As a result care should be taken not to disclose sensitive information about the server or the
- /// application.
- ///
- public string Message
- {
- get { return GetPropertyValue(HttpErrorKeys.MessageKey); }
- set { this[HttpErrorKeys.MessageKey] = value; }
- }
-
- ///
- /// The containing information about the errors that occurred during model binding.
- ///
- ///
- /// The inclusion of information carried in the is
- /// controlled by the error detail policy. All other information in the
- /// should be considered public in that it will go over the wire. As a result care should be taken not to
- /// disclose sensitive information about the server or the application.
- ///
- public HttpError ModelState
- {
- get { return GetPropertyValue(HttpErrorKeys.ModelStateKey); }
- }
-
- ///
- /// A detailed description of the error intended for the developer to understand exactly what failed.
- ///
- ///
- /// The inclusion of this field is controlled by the error detail policy. The
- /// field is expected to contain information about the server or the application that should not
- /// be disclosed broadly.
- ///
- public string MessageDetail
- {
- get { return GetPropertyValue(HttpErrorKeys.MessageDetailKey); }
- set { this[HttpErrorKeys.MessageDetailKey] = value; }
- }
-
- ///
- /// The message of the if available.
- ///
- ///
- /// The inclusion of this field is controlled by the error detail policy. The
- /// field is expected to contain information about the server or the application that should not
- /// be disclosed broadly.
- ///
- public string ExceptionMessage
- {
- get { return GetPropertyValue(HttpErrorKeys.ExceptionMessageKey); }
- set { this[HttpErrorKeys.ExceptionMessageKey] = value; }
- }
-
- ///
- /// The type of the if available.
- ///
- ///
- /// The inclusion of this field is controlled by the error detail policy. The
- /// field is expected to contain information about the server or the application that should not
- /// be disclosed broadly.
- ///
- public string ExceptionType
- {
- get { return GetPropertyValue(HttpErrorKeys.ExceptionTypeKey); }
- set { this[HttpErrorKeys.ExceptionTypeKey] = value; }
- }
-
- ///
- /// The stack trace information associated with this instance if available.
- ///
- ///
- /// The inclusion of this field is controlled by the error detail policy. The
- /// field is expected to contain information about the server or the application that should not
- /// be disclosed broadly.
- ///
- public string StackTrace
- {
- get { return GetPropertyValue(HttpErrorKeys.StackTraceKey); }
- set { this[HttpErrorKeys.StackTraceKey] = value; }
- }
-
- ///
- /// The inner associated with this instance if available.
- ///
- ///
- /// The inclusion of this field is controlled by the error detail policy. The
- /// field is expected to contain information about the server or the application that should not
- /// be disclosed broadly.
- ///
- public HttpError InnerException
- {
- get { return GetPropertyValue(HttpErrorKeys.InnerExceptionKey); }
- }
-
- ///
- /// Gets a particular property value from this error instance.
- ///
- /// The type of the property.
- /// The name of the error property.
- /// The value of the error property.
- public TValue GetPropertyValue(string key)
- {
- object value;
- if (TryGetValue(key, out value) && value is TValue)
- {
- return (TValue)value;
- }
-
- return default(TValue);
- }
-
- XmlSchema IXmlSerializable.GetSchema()
- {
- return null;
- }
-
- void IXmlSerializable.ReadXml(XmlReader reader)
- {
- if (reader.IsEmptyElement)
- {
- reader.Read();
- return;
- }
-
- reader.ReadStartElement();
- while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
- {
- var key = XmlConvert.DecodeName(reader.LocalName);
- var value = reader.ReadInnerXml();
-
- Add(key, value);
- reader.MoveToContent();
- }
- reader.ReadEndElement();
- }
-
- void IXmlSerializable.WriteXml(XmlWriter writer)
- {
- foreach (var keyValuePair in this)
- {
- var key = keyValuePair.Key;
- var value = keyValuePair.Value;
- writer.WriteStartElement(XmlConvert.EncodeLocalName(key));
- if (value != null)
- {
- var innerError = value as HttpError;
- if (innerError == null)
- {
- writer.WriteValue(value);
- }
- else
- {
- ((IXmlSerializable)innerError).WriteXml(writer);
- }
- }
- writer.WriteEndElement();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpErrorKeys.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpErrorKeys.cs
deleted file mode 100644
index 48cb0dec17..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpErrorKeys.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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 System.Web.Http
-{
- ///
- /// Provides keys to look up error information stored in the dictionary.
- ///
- public static class HttpErrorKeys
- {
- ///
- /// Provides a key for the Message.
- ///
- public static readonly string MessageKey = "Message";
-
- ///
- /// Provides a key for the MessageDetail.
- ///
- public static readonly string MessageDetailKey = "MessageDetail";
-
- ///
- /// Provides a key for the ModelState.
- ///
- public static readonly string ModelStateKey = "ModelState";
-
- ///
- /// Provides a key for the ExceptionMessage.
- ///
- public static readonly string ExceptionMessageKey = "ExceptionMessage";
-
- ///
- /// Provides a key for the ExceptionType.
- ///
- public static readonly string ExceptionTypeKey = "ExceptionType";
-
- ///
- /// Provides a key for the StackTrace.
- ///
- public static readonly string StackTraceKey = "StackTrace";
-
- ///
- /// Provides a key for the InnerException.
- ///
- public static readonly string InnerExceptionKey = "InnerException";
-
- ///
- /// Provides a key for the MessageLanguage.
- ///
- public static readonly string MessageLanguageKey = "MessageLanguage";
-
- ///
- /// Provides a key for the ErrorCode.
- ///
- public static readonly string ErrorCodeKey = "ErrorCode";
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageExtensions.cs
deleted file mode 100644
index 1879f81e1d..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageExtensions.cs
+++ /dev/null
@@ -1,521 +0,0 @@
-// 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.Net.Http.Formatting;
-using System.Net.Http.Headers;
-using System.Web.Http;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.WebApiCompatShim;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Options;
-using ShimResources = Microsoft.AspNetCore.Mvc.WebApiCompatShim.Resources;
-
-namespace System.Net.Http
-{
- ///
- /// Provides extension methods for the class.
- ///
- public static class HttpRequestMessageExtensions
- {
- ///
- /// Helper method that performs content negotiation and creates a
- /// representing an error with an instance of wrapping an
- /// with message . If no formatter is found, this method
- /// returns a response with status 406 NotAcceptable.
- ///
- ///
- /// This method requires that has been associated with an instance of
- /// .
- ///
- /// The request.
- /// The status code of the created response.
- /// The error message.
- ///
- /// An error response with error message and status code
- /// .
- ///
- public static HttpResponseMessage CreateErrorResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- string message)
- {
- if (request == null)
- {
- throw new ArgumentNullException(nameof(request));
- }
-
- if (message == null)
- {
- throw new ArgumentNullException(nameof(message));
- }
-
- return request.CreateErrorResponse(statusCode, new HttpError(message));
- }
-
- ///
- /// Helper method that performs content negotiation and creates a
- /// representing an error with an instance of wrapping an
- /// with error message for exception
- /// . If no formatter is found, this method returns a response with status 406
- /// NotAcceptable.
- ///
- ///
- /// This method requires that has been associated with an instance of
- /// .
- ///
- /// The request.
- /// The status code of the created response.
- /// The error message.
- /// The exception.
- /// An error response for with error message
- /// and status code .
- public static HttpResponseMessage CreateErrorResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- string message,
- Exception exception)
- {
- if (request == null)
- {
- throw new ArgumentNullException(nameof(request));
- }
-
- if (message == null)
- {
- throw new ArgumentNullException(nameof(message));
- }
-
- if (exception == null)
- {
- throw new ArgumentNullException(nameof(exception));
- }
-
- var error = new HttpError(exception, includeErrorDetail: false) { Message = message };
- return request.CreateErrorResponse(statusCode, error);
- }
-
- ///
- /// Helper method that performs content negotiation and creates a
- /// representing an error with an instance of wrapping an
- /// for exception . If no formatter is found, this method
- /// returns a response with status 406 NotAcceptable.
- ///
- ///
- /// This method requires that has been associated with an instance of
- /// .
- ///
- /// The request.
- /// The status code of the created response.
- /// The exception.
- ///
- /// An error response for with status code .
- ///
- public static HttpResponseMessage CreateErrorResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- Exception exception)
- {
- if (request == null)
- {
- throw new ArgumentNullException(nameof(request));
- }
-
- if (exception == null)
- {
- throw new ArgumentNullException(nameof(exception));
- }
-
- return request.CreateErrorResponse(statusCode, new HttpError(exception, includeErrorDetail: false));
- }
-
- ///
- /// Helper method that performs content negotiation and creates a
- /// representing an error with an instance of wrapping an
- /// for model state . If no formatter is found, this
- /// method returns a response with status 406 NotAcceptable.
- ///
- ///
- /// This method requires that has been associated with an instance of
- /// .
- ///
- /// The request.
- /// The status code of the created response.
- /// The model state.
- ///
- /// An error response for with status code .
- ///
- public static HttpResponseMessage CreateErrorResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- ModelStateDictionary modelState)
- {
- if (request == null)
- {
- throw new ArgumentNullException(nameof(request));
- }
-
- if (modelState == null)
- {
- throw new ArgumentNullException(nameof(modelState));
- }
-
- return request.CreateErrorResponse(statusCode, new HttpError(modelState, includeErrorDetail: false));
- }
-
- ///
- /// Helper method that performs content negotiation and creates a
- /// representing an error with an instance of wrapping
- /// as the content. If no formatter is found, this method returns a response with status 406 NotAcceptable.
- ///
- ///
- /// This method requires that has been associated with an instance of
- /// .
- ///
- /// The request.
- /// The status code of the created response.
- /// The error to wrap.
- ///
- /// An error response wrapping with status code .
- ///
- public static HttpResponseMessage CreateErrorResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- HttpError error)
- {
- if (request == null)
- {
- throw new ArgumentNullException(nameof(request));
- }
-
- if (error == null)
- {
- throw new ArgumentNullException(nameof(error));
- }
-
- return request.CreateResponse(statusCode, error);
- }
-
- ///
- /// Helper method that performs content negotiation and creates a with an
- /// instance of as the content and
- /// as the status code if a formatter can be found. If no formatter is found, this method returns a response
- /// with status 406 NotAcceptable.
- ///
- ///
- /// This method requires that has been associated with an instance of
- /// .
- ///
- /// The type of the value.
- /// The request.
- /// The value to wrap. Can be null.
- ///
- /// A response wrapping with status code.
- ///
- public static HttpResponseMessage CreateResponse(this HttpRequestMessage request, T value)
- {
- if (request == null)
- {
- throw new ArgumentNullException(nameof(request));
- }
-
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- return request.CreateResponse(HttpStatusCode.OK, value, formatters: null);
- }
-
- ///
- /// Helper method that performs content negotiation and creates a with an
- /// instance of as the content if a formatter can be found. If no formatter is
- /// found, this method returns a response with status 406 NotAcceptable.
- /// configuration.
- ///
- ///
- /// This method requires that has been associated with an instance of
- /// .
- ///
- /// The type of the value.
- /// The request.
- /// The status code of the created response.
- /// The value to wrap. Can be null.
- /// A response wrapping with .
- public static HttpResponseMessage CreateResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- T value)
- {
- return request.CreateResponse(statusCode, value, formatters: null);
- }
-
- ///
- /// Helper method that performs content negotiation and creates a with an
- /// instance of as the content if a formatter can be found. If no formatter is
- /// found, this method returns a response with status 406 NotAcceptable.
- ///
- ///
- /// This method will get the instance associated with .
- ///
- /// The type of the value.
- /// The request.
- /// The status code of the created response.
- /// The value to wrap. Can be null.
- /// The set of objects from which to choose.
- /// A response wrapping with .
- public static HttpResponseMessage CreateResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- T value,
- IEnumerable formatters)
- {
- if (request == null)
- {
- throw new ArgumentNullException(nameof(request));
- }
-
- var context = GetHttpContext(request);
-
- if (formatters == null)
- {
- // Get the default formatters from options
- var options = context.RequestServices.GetRequiredService>();
- formatters = options.Value.Formatters;
- }
-
- var contentNegotiator = context.RequestServices.GetRequiredService();
-
- var result = contentNegotiator.Negotiate(typeof(T), request, formatters);
- if (result?.Formatter == null)
- {
- // Return a 406 when we're actually performing conneg and it fails to find a formatter.
- return new HttpResponseMessage(HttpStatusCode.NotAcceptable)
- {
- RequestMessage = request
- };
- }
- else
- {
- return request.CreateResponse(statusCode, value, result.Formatter, result.MediaType);
- }
- }
-
- ///
- /// Helper method that creates a with an
- /// instance containing the provided . The given is used
- /// to find an instance of .
- ///
- /// The type of the value.
- /// The request.
- /// The status code of the created response.
- /// The value to wrap. Can be null.
- ///
- /// The media type used to look up an instance of .
- ///
- /// A response wrapping with .
- public static HttpResponseMessage CreateResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- T value,
- string mediaType)
- {
- return request.CreateResponse(statusCode, value, new MediaTypeHeaderValue(mediaType));
- }
-
- ///
- /// Helper method that creates a with an
- /// instance containing the provided . The given is used
- /// to find an instance of .
- ///
- /// The type of the value.
- /// The request.
- /// The status code of the created response.
- /// The value to wrap. Can be null.
- ///
- /// The media type used to look up an instance of .
- ///
- /// A response wrapping with .
- public static HttpResponseMessage CreateResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- T value,
- MediaTypeHeaderValue mediaType)
- {
- if (request == null)
- {
- throw new ArgumentNullException(nameof(request));
- }
-
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- if (mediaType == null)
- {
- throw new ArgumentNullException(nameof(mediaType));
- }
-
- var context = GetHttpContext(request);
-
- // Get the default formatters from options
- var options = context.RequestServices.GetRequiredService>();
- var formatters = options.Value.Formatters;
-
- var formatter = formatters.FindWriter(typeof(T), mediaType);
- if (formatter == null)
- {
- var message = ShimResources.FormatHttpRequestMessage_CouldNotFindMatchingFormatter(
- mediaType.ToString(),
- value.GetType());
- throw new InvalidOperationException(message);
- }
-
- return request.CreateResponse(statusCode, value, formatter, mediaType);
- }
-
- ///
- /// Helper method that creates a with an
- /// instance containing the provided and the given .
- ///
- /// The type of the value.
- /// The request.
- /// The status code of the created response.
- /// The value to wrap. Can be null.
- /// The formatter to use.
- /// A response wrapping with .
- public static HttpResponseMessage CreateResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- T value,
- MediaTypeFormatter formatter)
- {
- if (request == null)
- {
- throw new ArgumentNullException(nameof(request));
- }
-
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- if (formatter == null)
- {
- throw new ArgumentNullException(nameof(formatter));
- }
-
- return request.CreateResponse(statusCode, value, formatter, (MediaTypeHeaderValue)null);
- }
-
- ///
- /// Helper method that creates a with an
- /// instance containing the provided and the given .
- ///
- /// The type of the value.
- /// The request.
- /// The status code of the created response.
- /// The value to wrap. Can be null.
- /// The formatter to use.
- ///
- /// The media type override to set on the response's content. Can be null.
- ///
- /// A response wrapping with .
- public static HttpResponseMessage CreateResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- T value,
- MediaTypeFormatter formatter,
- string mediaType)
- {
- if (request == null)
- {
- throw new ArgumentNullException(nameof(request));
- }
-
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- if (formatter == null)
- {
- throw new ArgumentNullException(nameof(formatter));
- }
-
- var mediaTypeHeader = mediaType != null ? new MediaTypeHeaderValue(mediaType) : null;
- return request.CreateResponse(statusCode, value, formatter, mediaTypeHeader);
- }
-
- ///
- /// Helper method that creates a with an
- /// instance containing the provided and the given .
- ///
- /// The type of the value.
- /// The request.
- /// The status code of the created response.
- /// The value to wrap. Can be null.
- /// The formatter to use.
- ///
- /// The media type override to set on the response's content. Can be null.
- ///
- /// A response wrapping with .
- public static HttpResponseMessage CreateResponse(
- this HttpRequestMessage request,
- HttpStatusCode statusCode,
- T value,
- MediaTypeFormatter formatter,
- MediaTypeHeaderValue mediaType)
- {
- if (request == null)
- {
- throw new ArgumentNullException(nameof(request));
- }
-
- if (formatter == null)
- {
- throw new ArgumentNullException(nameof(formatter));
- }
-
- var response = new HttpResponseMessage(statusCode)
- {
- RequestMessage = request,
- };
-
- response.Content = new ObjectContent(value, formatter, mediaType);
-
- return response;
- }
-
- private static HttpContext GetHttpContext(HttpRequestMessage request)
- {
- var context = request.GetProperty(nameof(HttpContext));
- if (context == null)
- {
- var message = ShimResources.FormatHttpRequestMessage_MustHaveHttpContext(
- nameof(HttpRequestMessage),
- "HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage");
- throw new InvalidOperationException(message);
- }
-
- return context;
- }
-
- private static T GetProperty(this HttpRequestMessage request, string key)
- {
- object value;
- request.Properties.TryGetValue(key, out value);
-
- if (value is T)
- {
- return (T)value;
- }
- else
- {
- return default(T);
- }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageFeature.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageFeature.cs
deleted file mode 100644
index 9937d4d2c3..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageFeature.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-// 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.Net.Http;
-using Microsoft.AspNetCore.Http;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- public class HttpRequestMessageFeature : IHttpRequestMessageFeature
- {
- private readonly HttpContext _httpContext;
- private HttpRequestMessage _httpRequestMessage;
-
- public HttpRequestMessageFeature(HttpContext httpContext)
- {
- if (httpContext == null)
- {
- throw new ArgumentNullException(nameof(httpContext));
- }
-
- _httpContext = httpContext;
- }
-
- public HttpRequestMessage HttpRequestMessage
- {
- get
- {
- if (_httpRequestMessage == null)
- {
- _httpRequestMessage = CreateHttpRequestMessage(_httpContext);
- }
-
- return _httpRequestMessage;
- }
-
- set
- {
- _httpRequestMessage = value;
- }
- }
-
- private static HttpRequestMessage CreateHttpRequestMessage(HttpContext httpContext)
- {
- var httpRequest = httpContext.Request;
- var uriString =
- httpRequest.Scheme + "://" +
- httpRequest.Host +
- httpRequest.PathBase +
- httpRequest.Path +
- httpRequest.QueryString;
-
- var message = new HttpRequestMessage(new HttpMethod(httpRequest.Method), uriString);
-
- // This allows us to pass the message through APIs defined in legacy code and then
- // operate on the HttpContext inside.
- message.Properties[nameof(HttpContext)] = httpContext;
-
- message.Content = new StreamContent(httpRequest.Body);
-
- foreach (var header in httpRequest.Headers)
- {
- // Every header should be able to fit into one of the two header collections.
- // Try message.Headers first since that accepts more of them.
- if (!message.Headers.TryAddWithoutValidation(header.Key, (IEnumerable)header.Value))
- {
- var added = message.Content.Headers.TryAddWithoutValidation(header.Key, (IEnumerable)header.Value);
- Debug.Assert(added);
- }
- }
-
- return message;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageHttpContextExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageHttpContextExtensions.cs
deleted file mode 100644
index 36636bb49a..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageHttpContextExtensions.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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.Net.Http;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Http.Features;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- public static class HttpRequestMessageHttpContextExtensions
- {
- public static HttpRequestMessage GetHttpRequestMessage(this HttpContext httpContext)
- {
- var feature = httpContext.Features.Get();
- if (feature == null)
- {
- feature = new HttpRequestMessageFeature(httpContext);
- httpContext.Features.Set(feature);
- }
-
- return feature.HttpRequestMessage;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageModelBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageModelBinder.cs
deleted file mode 100644
index 29fd9aa437..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageModelBinder.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.Net.Http;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- ///
- /// implementation to bind models of type .
- ///
- public class HttpRequestMessageModelBinder : IModelBinder
- {
- ///
- public Task BindModelAsync(ModelBindingContext bindingContext)
- {
- var model = bindingContext.HttpContext.GetHttpRequestMessage();
- bindingContext.ValidationState.Add(model, new ValidationStateEntry() { SuppressValidation = true });
- bindingContext.Result = ModelBindingResult.Success(model);
-
- return Task.CompletedTask;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageModelBinderProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageModelBinderProvider.cs
deleted file mode 100644
index bb06a4d243..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageModelBinderProvider.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.Net.Http;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- ///
- /// implementation to bind models of type .
- ///
- public class HttpRequestMessageModelBinderProvider : IModelBinderProvider
- {
- ///
- public IModelBinder GetBinder(ModelBinderProviderContext context)
- {
- if (context.Metadata.ModelType == typeof(HttpRequestMessage))
- {
- return new HttpRequestMessageModelBinder();
- }
-
- return null;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/IHttpRequestMessageFeature.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/IHttpRequestMessageFeature.cs
deleted file mode 100644
index ecad550a9e..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/IHttpRequestMessageFeature.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// 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.Net.Http;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- public interface IHttpRequestMessageFeature
- {
- HttpRequestMessage HttpRequestMessage { get; set; }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpResponseException.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpResponseException.cs
deleted file mode 100644
index 866642f6c5..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpResponseException.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.Net;
-using System.Net.Http;
-using ShimResources = Microsoft.AspNetCore.Mvc.WebApiCompatShim.Resources;
-
-namespace System.Web.Http
-{
- public class HttpResponseException : Exception
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The status code of the response.
- public HttpResponseException(HttpStatusCode statusCode)
- : this(new HttpResponseMessage(statusCode))
- {
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The response message.
- public HttpResponseException(HttpResponseMessage response)
- : base(ShimResources.HttpResponseExceptionMessage)
- {
- if (response == null)
- {
- throw new ArgumentNullException(nameof(response));
- }
-
- Response = response;
- }
-
- ///
- /// Gets the to return to the client.
- ///
- public HttpResponseMessage Response { get; private set; }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpResponseExceptionActionFilter.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpResponseExceptionActionFilter.cs
deleted file mode 100644
index d214ee63b0..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpResponseExceptionActionFilter.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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.Net.Http;
-using System.Web.Http;
-using Microsoft.AspNetCore.Mvc.Filters;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- ///
- /// An action filter that sets to an
- /// if the exception type is .
- /// This filter runs immediately after the action.
- ///
- public class HttpResponseExceptionActionFilter : IActionFilter, IOrderedFilter
- {
- ///
- // Return a high number by default so that it runs closest to the action.
- public int Order { get; set; } = int.MaxValue - 10;
-
- ///
- public void OnActionExecuting(ActionExecutingContext context)
- {
- }
-
- ///
- public void OnActionExecuted(ActionExecutedContext context)
- {
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- var httpResponseException = context.Exception as HttpResponseException;
- if (httpResponseException != null)
- {
- var request = context.HttpContext.GetHttpRequestMessage();
- var response = httpResponseException.Response;
-
- if (response != null && response.RequestMessage == null)
- {
- response.RequestMessage = request;
- }
-
- var objectResult = new ObjectResult(response)
- {
- DeclaredType = typeof(HttpResponseMessage)
- };
-
- context.Result = objectResult;
-
- // Its marked as handled as in webapi because an HttpResponseException
- // was considered as a 'success' response.
- context.ExceptionHandled = true;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/InternalServerErrorResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/InternalServerErrorResult.cs
deleted file mode 100644
index 840f439645..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/InternalServerErrorResult.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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.Http;
-using Microsoft.AspNetCore.Mvc;
-
-namespace System.Web.Http
-{
- ///
- /// An action result that returns an empty response.
- ///
- public class InternalServerErrorResult : StatusCodeResult
- {
- ///
- /// Initializes a new instance of the class.
- ///
- public InternalServerErrorResult()
- : base(StatusCodes.Status500InternalServerError)
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/InvalidModelStateResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/InvalidModelStateResult.cs
deleted file mode 100644
index 7bd992b650..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/InvalidModelStateResult.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-
-namespace System.Web.Http
-{
- ///
- /// An action result that returns a response and performs
- /// content negotiation on an based on a .
- ///
- public class InvalidModelStateResult : ObjectResult
- {
- /// Initializes a new instance of the class.
- /// The model state to include in the error.
- ///
- /// if the error should include exception messages; otherwise, .
- ///
- public InvalidModelStateResult(ModelStateDictionary modelState, bool includeErrorDetail)
- : base(new HttpError(modelState, includeErrorDetail))
- {
- if (modelState == null)
- {
- throw new ArgumentNullException(nameof(modelState));
- }
-
- ModelState = modelState;
- IncludeErrorDetail = includeErrorDetail;
- }
-
- ///
- /// Gets the model state to include in the error.
- ///
- public ModelStateDictionary ModelState { get; private set; }
-
- ///
- /// Gets a value indicating whether the error should include exception messages.
- ///
- public bool IncludeErrorDetail { get; private set; }
-
- ///
- public override Task ExecuteResultAsync(ActionContext context)
- {
- context.HttpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
- return base.ExecuteResultAsync(context);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Microsoft.AspNetCore.Mvc.WebApiCompatShim.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Microsoft.AspNetCore.Mvc.WebApiCompatShim.csproj
deleted file mode 100644
index 72cb71f8c2..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Microsoft.AspNetCore.Mvc.WebApiCompatShim.csproj
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- Provides compatibility in ASP.NET Core MVC with ASP.NET Web API 2 to simplify migration of existing Web API implementations.
-Commonly used types:
-System.Web.Http.ApiController
- netstandard2.0
- $(NoWarn);CS1591
- true
- aspnetcore;aspnetcoremvc;aspnetwebapi
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/NegotiatedContentResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/NegotiatedContentResult.cs
deleted file mode 100644
index d828be7387..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/NegotiatedContentResult.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.Net;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-
-namespace System.Web.Http
-{
- ///
- /// An action result that performs content negotiation.
- ///
- /// The type of content in the entity body.
- public class NegotiatedContentResult : ObjectResult
- {
- ///
- /// Initializes a new instance of the class with the values provided.
- ///
- /// The HTTP status code for the response message.
- /// The content value to negotiate and format in the entity body.
- public NegotiatedContentResult(HttpStatusCode statusCode, T content)
- : base(content)
- {
- StatusCode = (int)statusCode;
- Content = content;
- }
-
- ///
- /// Gets the content value to negotiate and format in the entity body.
- ///
- public T Content { get; private set; }
-
- ///
- public override Task ExecuteResultAsync(ActionContext context)
- {
- context.HttpContext.Response.StatusCode = (int)StatusCode;
- return base.ExecuteResultAsync(context);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/OverloadActionConstraint.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/OverloadActionConstraint.cs
deleted file mode 100644
index 2ae5b527d0..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/OverloadActionConstraint.cs
+++ /dev/null
@@ -1,193 +0,0 @@
-// 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.ComponentModel;
-using System.Linq;
-using System.Net.Http.Formatting;
-using System.Reflection;
-using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.ActionConstraints;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Routing;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- ///
- /// An limiting candidate actions to those for which the request satisfies all
- /// non-optional parameters.
- ///
- public class OverloadActionConstraint : IActionConstraint
- {
- ///
- public int Order => int.MaxValue;
-
- ///
- public bool Accept(ActionConstraintContext context)
- {
- var candidates = context.Candidates.Select(c => new
- {
- Action = c,
- Parameters = GetOverloadableParameters(c),
- });
-
- // Combined route value keys and query string keys. These are the values available for overload selection.
- var requestKeys = GetCombinedKeys(context.RouteContext);
-
- // Group candidates by the highest number of keys, and then process them until we find an action
- // with all parameters satisfied.
- foreach (var group in candidates.GroupBy(c => c.Parameters?.Count ?? 0).OrderByDescending(g => g.Key))
- {
- var foundMatch = false;
- foreach (var candidate in group)
- {
- var allFound = true;
- if (candidate.Parameters != null)
- {
- foreach (var parameter in candidate.Parameters)
- {
- if (!requestKeys.Contains(parameter.Prefix))
- {
- if (candidate.Action.Action == context.CurrentCandidate.Action)
- {
- return false;
- }
-
- allFound = false;
- break;
- }
- }
- }
-
- if (allFound)
- {
- foundMatch = true;
- }
- }
-
- if (foundMatch)
- {
- return group.Any(c => c.Action.Action == context.CurrentCandidate.Action);
- }
- }
-
- return false;
- }
-
- private List GetOverloadableParameters(ActionSelectorCandidate candidate)
- {
- if (candidate.Action.Parameters == null)
- {
- return null;
- }
-
- var isOverloaded = false;
- foreach (var constraint in candidate.Constraints)
- {
- if (constraint is OverloadActionConstraint)
- {
- isOverloaded = true;
- }
- }
-
- if (!isOverloaded)
- {
- return null;
- }
-
- var parameters = new List();
- candidate.Action.Properties.TryGetValue("OptionalParameters", out var optionalParametersObject);
- var optionalParameters = (HashSet)optionalParametersObject;
- foreach (var parameter in candidate.Action.Parameters)
- {
- // We only consider parameters that are marked as bound from the URL.
- var source = parameter.BindingInfo?.BindingSource;
- if (source == null)
- {
- continue;
- }
-
- if ((source.CanAcceptDataFrom(BindingSource.Path) ||
- source.CanAcceptDataFrom(BindingSource.Query)) &&
- CanConvertFromString(parameter.ParameterType))
- {
- if (optionalParameters != null)
- {
- var isOptional = optionalParameters.Contains(parameter.Name);
- if (isOptional)
- {
- // Optional parameters are ignored in overloading. If a parameter doesn't specify that it's
- // required then treat it as optional (MVC default). WebAPI parameters will all by-default
- // specify themselves as required unless they have a default value.
- continue;
- }
- }
-
- var prefix = parameter.BindingInfo?.BinderModelName ?? parameter.Name;
-
- parameters.Add(new OverloadedParameter()
- {
- ParameterDescriptor = parameter,
- Prefix = prefix,
- });
- }
- }
-
- return parameters;
- }
-
- private static ISet GetCombinedKeys(RouteContext routeContext)
- {
- var keys = new HashSet(routeContext.RouteData.Values.Keys, StringComparer.OrdinalIgnoreCase);
- keys.Remove("controller");
- keys.Remove("action");
-
- var queryString = routeContext.HttpContext.Request.QueryString.ToUriComponent();
-
- if (queryString.Length > 0)
- {
- // We need to chop off the leading '?'
- var queryData = new FormDataCollection(queryString.Substring(1));
-
- var queryNameValuePairs = queryData.GetJQueryNameValuePairs();
-
- if (queryNameValuePairs != null)
- {
- foreach (var queryNameValuePair in queryNameValuePairs)
- {
- keys.Add(queryNameValuePair.Key);
- }
- }
- }
-
- return keys;
- }
-
- private static bool CanConvertFromString(Type destinationType)
- {
- destinationType = Nullable.GetUnderlyingType(destinationType) ?? destinationType;
- return IsSimpleType(destinationType) ||
- TypeDescriptor.GetConverter(destinationType).CanConvertFrom(typeof(string));
- }
-
- private static bool IsSimpleType(Type type)
- {
- return type.GetTypeInfo().IsPrimitive ||
- type.Equals(typeof(decimal)) ||
- type.Equals(typeof(string)) ||
- type.Equals(typeof(DateTime)) ||
- type.Equals(typeof(Guid)) ||
- type.Equals(typeof(DateTimeOffset)) ||
- type.Equals(typeof(TimeSpan)) ||
- type.Equals(typeof(Uri));
- }
-
- private class OverloadedParameter
- {
- public ParameterDescriptor ParameterDescriptor { get; set; }
-
- public string Prefix { get; set; }
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ParameterBinding/FromUriAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ParameterBinding/FromUriAttribute.cs
deleted file mode 100644
index 0002337087..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ParameterBinding/FromUriAttribute.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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.ModelBinding;
-using WebApiShimResources = Microsoft.AspNetCore.Mvc.WebApiCompatShim.Resources;
-
-namespace System.Web.Http
-{
- ///
- /// An attribute that specifies that the value can be bound from the query string or route data.
- ///
- [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
- public class FromUriAttribute :
- Attribute,
- IOptionalBinderMetadata,
- IBindingSourceMetadata,
- IModelNameProvider
- {
- private static readonly BindingSource FromUriSource = CompositeBindingSource.Create(
- new BindingSource[] { BindingSource.Path, BindingSource.Query },
- WebApiShimResources.BindingSource_URL);
-
- ///
- public BindingSource BindingSource { get { return FromUriSource; } }
-
- ///
- public bool IsOptional { get; set; }
-
- ///
- public string Name { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ParameterBinding/IOptionalBinderMetadata.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ParameterBinding/IOptionalBinderMetadata.cs
deleted file mode 100644
index 367fd52614..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ParameterBinding/IOptionalBinderMetadata.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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.ModelBinding
-{
- ///
- ///
- /// An type that designates an optional parameter for the purposes
- /// of ASP.NET Web API action overloading. Optional parameters do not participate in overloading, and
- /// do not have to have a value for the action to be selected.
- ///
- ///
- /// This has no impact when used without ASP.NET Web API action overloading.
- ///
- ///
- public interface IOptionalBinderMetadata
- {
- ///
- /// Gets a value indicating whether the parameter participates in ASP.NET Web API action overloading. If
- /// true, the parameter does not participate in overloading. Otherwise, it does.
- ///
- bool IsOptional { get; }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Properties/AssemblyInfo.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Properties/AssemblyInfo.cs
deleted file mode 100644
index a97fe6be81..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-// 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.Runtime.CompilerServices;
-
-[assembly: TypeForwardedTo(typeof(System.Net.Http.Formatting.ContentNegotiationResult))]
-[assembly: TypeForwardedTo(typeof(System.Net.Http.Formatting.DefaultContentNegotiator))]
-[assembly: TypeForwardedTo(typeof(System.Net.Http.Formatting.FormDataCollection ))]
-[assembly: TypeForwardedTo(typeof(System.Net.Http.Formatting.IContentNegotiator))]
-[assembly: TypeForwardedTo(typeof(System.Net.Http.Formatting.MediaTypeFormatterMatch))]
-[assembly: TypeForwardedTo(typeof(System.Net.Http.Formatting.MediaTypeFormatterMatchRanking))]
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Properties/Resources.Designer.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Properties/Resources.Designer.cs
deleted file mode 100644
index 508a740cb9..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-//
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- using System.Globalization;
- using System.Reflection;
- using System.Resources;
-
- internal static class Resources
- {
- private static readonly ResourceManager _resourceManager
- = new ResourceManager("Microsoft.AspNetCore.Mvc.WebApiCompatShim.Resources", typeof(Resources).GetTypeInfo().Assembly);
-
- ///
- /// The request is invalid.
- ///
- internal static string HttpError_BadRequest
- {
- get => GetString("HttpError_BadRequest");
- }
-
- ///
- /// The request is invalid.
- ///
- internal static string FormatHttpError_BadRequest()
- => GetString("HttpError_BadRequest");
-
- ///
- /// An error has occurred.
- ///
- internal static string HttpError_GenericError
- {
- get => GetString("HttpError_GenericError");
- }
-
- ///
- /// An error has occurred.
- ///
- internal static string FormatHttpError_GenericError()
- => GetString("HttpError_GenericError");
-
- ///
- /// The model state is valid.
- ///
- internal static string HttpError_ValidModelState
- {
- get => GetString("HttpError_ValidModelState");
- }
-
- ///
- /// The model state is valid.
- ///
- internal static string FormatHttpError_ValidModelState()
- => GetString("HttpError_ValidModelState");
-
- ///
- /// Could not find a formatter matching the media type '{0}' that can write an instance of '{1}'.
- ///
- internal static string HttpRequestMessage_CouldNotFindMatchingFormatter
- {
- get => GetString("HttpRequestMessage_CouldNotFindMatchingFormatter");
- }
-
- ///
- /// Could not find a formatter matching the media type '{0}' that can write an instance of '{1}'.
- ///
- internal static string FormatHttpRequestMessage_CouldNotFindMatchingFormatter(object p0, object p1)
- => string.Format(CultureInfo.CurrentCulture, GetString("HttpRequestMessage_CouldNotFindMatchingFormatter"), p0, p1);
-
- ///
- /// The {0} instance is not properly initialized. Use {1} to create an {0} for the current request.
- ///
- internal static string HttpRequestMessage_MustHaveHttpContext
- {
- get => GetString("HttpRequestMessage_MustHaveHttpContext");
- }
-
- ///
- /// The {0} instance is not properly initialized. Use {1} to create an {0} for the current request.
- ///
- internal static string FormatHttpRequestMessage_MustHaveHttpContext(object p0, object p1)
- => string.Format(CultureInfo.CurrentCulture, GetString("HttpRequestMessage_MustHaveHttpContext"), p0, p1);
-
- ///
- /// The {0} only supports writing objects of type {1}.
- ///
- internal static string HttpResponseMessageFormatter_UnsupportedType
- {
- get => GetString("HttpResponseMessageFormatter_UnsupportedType");
- }
-
- ///
- /// The {0} only supports writing objects of type {1}.
- ///
- internal static string FormatHttpResponseMessageFormatter_UnsupportedType(object p0, object p1)
- => string.Format(CultureInfo.CurrentCulture, GetString("HttpResponseMessageFormatter_UnsupportedType"), p0, p1);
-
- ///
- /// The key is invalid JQuery syntax because it is missing a closing bracket.
- ///
- internal static string JQuerySyntaxMissingClosingBracket
- {
- get => GetString("JQuerySyntaxMissingClosingBracket");
- }
-
- ///
- /// The key is invalid JQuery syntax because it is missing a closing bracket.
- ///
- internal static string FormatJQuerySyntaxMissingClosingBracket()
- => GetString("JQuerySyntaxMissingClosingBracket");
-
- ///
- /// The number of keys in a NameValueCollection has exceeded the limit of '{0}'. You can adjust it by modifying the MaxHttpCollectionKeys property on the '{1}' class.
- ///
- internal static string MaxHttpCollectionKeyLimitReached
- {
- get => GetString("MaxHttpCollectionKeyLimitReached");
- }
-
- ///
- /// The number of keys in a NameValueCollection has exceeded the limit of '{0}'. You can adjust it by modifying the MaxHttpCollectionKeys property on the '{1}' class.
- ///
- internal static string FormatMaxHttpCollectionKeyLimitReached(object p0, object p1)
- => string.Format(CultureInfo.CurrentCulture, GetString("MaxHttpCollectionKeyLimitReached"), p0, p1);
-
- ///
- /// Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.
- ///
- internal static string HttpResponseExceptionMessage
- {
- get => GetString("HttpResponseExceptionMessage");
- }
-
- ///
- /// Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.
- ///
- internal static string FormatHttpResponseExceptionMessage()
- => GetString("HttpResponseExceptionMessage");
-
- ///
- /// Failed to generate a URL using route '{0}'.
- ///
- internal static string CreatedAtRoute_RouteFailed
- {
- get => GetString("CreatedAtRoute_RouteFailed");
- }
-
- ///
- /// Failed to generate a URL using route '{0}'.
- ///
- internal static string FormatCreatedAtRoute_RouteFailed(object p0)
- => string.Format(CultureInfo.CurrentCulture, GetString("CreatedAtRoute_RouteFailed"), p0);
-
- ///
- /// URL
- ///
- internal static string BindingSource_URL
- {
- get => GetString("BindingSource_URL");
- }
-
- ///
- /// URL
- ///
- internal static string FormatBindingSource_URL()
- => GetString("BindingSource_URL");
-
- private static string GetString(string name, params string[] formatterNames)
- {
- var value = _resourceManager.GetString(name);
-
- System.Diagnostics.Debug.Assert(value != null);
-
- if (formatterNames != null)
- {
- for (var i = 0; i < formatterNames.Length; i++)
- {
- value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
- }
- }
-
- return value;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Resources.resx b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Resources.resx
deleted file mode 100644
index f4448a3035..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Resources.resx
+++ /dev/null
@@ -1,153 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- The request is invalid.
-
-
- An error has occurred.
-
-
- The model state is valid.
-
-
- Could not find a formatter matching the media type '{0}' that can write an instance of '{1}'.
-
-
- The {0} instance is not properly initialized. Use {1} to create an {0} for the current request.
-
-
- The {0} only supports writing objects of type {1}.
-
-
- The key is invalid JQuery syntax because it is missing a closing bracket.
-
-
- The number of keys in a NameValueCollection has exceeded the limit of '{0}'. You can adjust it by modifying the MaxHttpCollectionKeys property on the '{1}' class.
-
-
- Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.
-
-
- Failed to generate a URL using route '{0}'.
-
-
- URL
-
-
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ResponseMessageResult.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ResponseMessageResult.cs
deleted file mode 100644
index c771faa632..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ResponseMessageResult.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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.Net.Http;
-using Microsoft.AspNetCore.Mvc;
-
-namespace System.Web.Http
-{
- ///
- /// An action result that returns a specified response message.
- ///
- public class ResponseMessageResult : ObjectResult
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The response message.
- public ResponseMessageResult(HttpResponseMessage response)
- : base(response)
- {
- if (response == null)
- {
- throw new ArgumentNullException(nameof(response));
- }
-
- Response = response;
- }
-
- ///
- /// Gets the response message.
- ///
- public HttpResponseMessage Response { get; private set; }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Routing/WebApiCompatShimRouteBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Routing/WebApiCompatShimRouteBuilderExtensions.cs
deleted file mode 100644
index f16f2f5c61..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Routing/WebApiCompatShimRouteBuilderExtensions.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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 Microsoft.AspNetCore.Mvc.WebApiCompatShim;
-using Microsoft.AspNetCore.Routing;
-using Microsoft.AspNetCore.Routing.Constraints;
-
-namespace Microsoft.AspNetCore.Builder
-{
- public static class WebApiCompatShimRouteBuilderExtensions
- {
- public static IRouteBuilder MapWebApiRoute(
- this IRouteBuilder routeCollectionBuilder,
- string name,
- string template)
- {
- return MapWebApiRoute(routeCollectionBuilder, name, template, defaults: null);
- }
-
- public static IRouteBuilder MapWebApiRoute(
- this IRouteBuilder routeCollectionBuilder,
- string name,
- string template,
- object defaults)
- {
- return MapWebApiRoute(routeCollectionBuilder, name, template, defaults, constraints: null);
- }
-
- public static IRouteBuilder MapWebApiRoute(
- this IRouteBuilder routeCollectionBuilder,
- string name,
- string template,
- object defaults,
- object constraints)
- {
- return MapWebApiRoute(routeCollectionBuilder, name, template, defaults, constraints, dataTokens: null);
- }
-
- public static IRouteBuilder MapWebApiRoute(
- this IRouteBuilder routeCollectionBuilder,
- string name,
- string template,
- object defaults,
- object constraints,
- object dataTokens)
- {
- var mutableDefaults = ObjectToDictionary(defaults);
- mutableDefaults.Add("area", WebApiCompatShimOptionsSetup.DefaultAreaName);
-
- var mutableConstraints = ObjectToDictionary(constraints);
- mutableConstraints.Add("area", new RequiredRouteConstraint());
-
- return routeCollectionBuilder.MapRoute(name, template, mutableDefaults, mutableConstraints, dataTokens);
- }
-
- private static IDictionary ObjectToDictionary(object value)
- {
- var dictionary = value as IDictionary;
- if (dictionary != null)
- {
- return new RouteValueDictionary(dictionary);
- }
- else
- {
- return new RouteValueDictionary(value);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/WebApiCompatShimMvcBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/WebApiCompatShimMvcBuilderExtensions.cs
deleted file mode 100644
index 1fa6a5fd02..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/WebApiCompatShimMvcBuilderExtensions.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.Net.Http.Formatting;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.WebApiCompatShim;
-using Microsoft.Extensions.DependencyInjection.Extensions;
-using Microsoft.Extensions.Options;
-
-namespace Microsoft.Extensions.DependencyInjection
-{
- public static class WebApiCompatShimMvcBuilderExtensions
- {
- public static IMvcBuilder AddWebApiConventions(this IMvcBuilder builder)
- {
- builder.Services.TryAddEnumerable(
- ServiceDescriptor.Transient, WebApiCompatShimOptionsSetup>());
- builder.Services.TryAddEnumerable(
- ServiceDescriptor.Transient, WebApiCompatShimOptionsSetup>());
-
- builder.Services.TryAddSingleton();
-
- return builder;
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/WebApiCompatShimOptions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/WebApiCompatShimOptions.cs
deleted file mode 100644
index c18b8a2be5..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/WebApiCompatShimOptions.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.Linq;
-using System.Net.Http.Formatting;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- public class WebApiCompatShimOptions
- {
- public WebApiCompatShimOptions()
- {
- // Start with an empty collection, our options setup will add the default formatters.
- Formatters = new MediaTypeFormatterCollection(Enumerable.Empty());
- }
-
- public MediaTypeFormatterCollection Formatters { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/WebApiCompatShimOptionsSetup.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/WebApiCompatShimOptionsSetup.cs
deleted file mode 100644
index 1cd98c2ad7..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/WebApiCompatShimOptionsSetup.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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.Net.Http;
-using System.Net.Http.Formatting;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Options;
-
-namespace Microsoft.AspNetCore.Mvc.WebApiCompatShim
-{
- public class WebApiCompatShimOptionsSetup
- : IConfigureOptions, IConfigureOptions
- {
- public static readonly string DefaultAreaName = "api";
-
- public string Name { get; set; }
-
- public void Configure(MvcOptions options)
- {
- // Add webapi behaviors to controllers with the appropriate attributes
- options.Conventions.Add(new WebApiActionConventionsApplicationModelConvention());
- options.Conventions.Add(new WebApiParameterConventionsApplicationModelConvention());
- options.Conventions.Add(new WebApiOverloadingApplicationModelConvention());
- options.Conventions.Add(new WebApiRoutesApplicationModelConvention(area: DefaultAreaName));
-
- // Add an action filter for handling the HttpResponseException.
- options.Filters.Add(new HttpResponseExceptionActionFilter());
-
- // Add a model binder to be able to bind HttpRequestMessage
- options.ModelBinderProviders.Insert(0, new HttpRequestMessageModelBinderProvider());
-
- // Add a formatter to write out an HttpResponseMessage to the response
- options.OutputFormatters.Insert(0, new HttpResponseMessageOutputFormatter());
-
- options.ModelMetadataDetailsProviders.Add(new SuppressChildValidationMetadataProvider(typeof(HttpRequestMessage)));
- options.ModelMetadataDetailsProviders.Add(new SuppressChildValidationMetadataProvider(typeof(HttpResponseMessage)));
- }
-
- public void Configure(WebApiCompatShimOptions options)
- {
- // Add the default formatters
- options.Formatters.AddRange(new MediaTypeFormatterCollection());
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/baseline.netcore.json b/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/baseline.netcore.json
deleted file mode 100644
index cd830febca..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/baseline.netcore.json
+++ /dev/null
@@ -1,3166 +0,0 @@
-{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.WebApiCompatShim, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
- "Types": [
- {
- "Name": "System.Net.Http.HttpRequestMessageExtensions",
- "Visibility": "Public",
- "Kind": "Class",
- "Abstract": true,
- "Static": true,
- "Sealed": true,
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "CreateErrorResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "message",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "CreateErrorResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "message",
- "Type": "System.String"
- },
- {
- "Name": "exception",
- "Type": "System.Exception"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "CreateErrorResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "exception",
- "Type": "System.Exception"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "CreateErrorResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "modelState",
- "Type": "Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "CreateErrorResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "error",
- "Type": "System.Web.Http.HttpError"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "CreateResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "value",
- "Type": "T0"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "CreateResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "value",
- "Type": "T0"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "CreateResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "value",
- "Type": "T0"
- },
- {
- "Name": "formatters",
- "Type": "System.Collections.Generic.IEnumerable"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "CreateResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "value",
- "Type": "T0"
- },
- {
- "Name": "mediaType",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "CreateResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "value",
- "Type": "T0"
- },
- {
- "Name": "mediaType",
- "Type": "System.Net.Http.Headers.MediaTypeHeaderValue"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "CreateResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "value",
- "Type": "T0"
- },
- {
- "Name": "formatter",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatter"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "CreateResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "value",
- "Type": "T0"
- },
- {
- "Name": "formatter",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatter"
- },
- {
- "Name": "mediaType",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "CreateResponse",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "value",
- "Type": "T0"
- },
- {
- "Name": "formatter",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatter"
- },
- {
- "Name": "mediaType",
- "Type": "System.Net.Http.Headers.MediaTypeHeaderValue"
- }
- ],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Web.Http.ApiController",
- "Visibility": "Public",
- "Kind": "Class",
- "Abstract": true,
- "ImplementedInterfaces": [
- "System.IDisposable"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_ActionContext",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Mvc.ActionContext",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_ControllerContext",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Mvc.ControllerContext",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_ControllerContext",
- "Parameters": [
- {
- "Name": "value",
- "Type": "Microsoft.AspNetCore.Mvc.ControllerContext"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_Context",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Http.HttpContext",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_MetadataProvider",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_MetadataProvider",
- "Parameters": [
- {
- "Name": "value",
- "Type": "Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_ObjectValidator",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IObjectModelValidator",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_ObjectValidator",
- "Parameters": [
- {
- "Name": "value",
- "Type": "Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IObjectModelValidator"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_ModelState",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_Request",
- "Parameters": [],
- "ReturnType": "System.Net.Http.HttpRequestMessage",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_Request",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.Net.Http.HttpRequestMessage"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_Url",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Mvc.IUrlHelper",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_Url",
- "Parameters": [
- {
- "Name": "value",
- "Type": "Microsoft.AspNetCore.Mvc.IUrlHelper"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_User",
- "Parameters": [],
- "ReturnType": "System.Security.Principal.IPrincipal",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "BadRequest",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Mvc.BadRequestResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "BadRequest",
- "Parameters": [
- {
- "Name": "message",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Web.Http.BadRequestErrorMessageResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "BadRequest",
- "Parameters": [
- {
- "Name": "modelState",
- "Type": "Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"
- }
- ],
- "ReturnType": "System.Web.Http.InvalidModelStateResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Conflict",
- "Parameters": [],
- "ReturnType": "System.Web.Http.ConflictResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Content",
- "Parameters": [
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "value",
- "Type": "T0"
- }
- ],
- "ReturnType": "System.Web.Http.NegotiatedContentResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "Created",
- "Parameters": [
- {
- "Name": "location",
- "Type": "System.String"
- },
- {
- "Name": "content",
- "Type": "System.Object"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.CreatedResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Created",
- "Parameters": [
- {
- "Name": "uri",
- "Type": "System.Uri"
- },
- {
- "Name": "content",
- "Type": "System.Object"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.CreatedResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "CreatedAtRoute",
- "Parameters": [
- {
- "Name": "routeName",
- "Type": "System.String"
- },
- {
- "Name": "routeValues",
- "Type": "System.Object"
- },
- {
- "Name": "content",
- "Type": "System.Object"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.CreatedAtRouteResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "InternalServerError",
- "Parameters": [],
- "ReturnType": "System.Web.Http.InternalServerErrorResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "InternalServerError",
- "Parameters": [
- {
- "Name": "exception",
- "Type": "System.Exception"
- }
- ],
- "ReturnType": "System.Web.Http.ExceptionResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Json",
- "Parameters": [
- {
- "Name": "content",
- "Type": "T0"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.JsonResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "Json",
- "Parameters": [
- {
- "Name": "content",
- "Type": "T0"
- },
- {
- "Name": "serializerSettings",
- "Type": "Newtonsoft.Json.JsonSerializerSettings"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.JsonResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "Json",
- "Parameters": [
- {
- "Name": "content",
- "Type": "T0"
- },
- {
- "Name": "serializerSettings",
- "Type": "Newtonsoft.Json.JsonSerializerSettings"
- },
- {
- "Name": "encoding",
- "Type": "System.Text.Encoding"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.JsonResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "NotFound",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Mvc.NotFoundResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Ok",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Mvc.OkResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Ok",
- "Parameters": [
- {
- "Name": "content",
- "Type": "T0"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.OkObjectResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "Redirect",
- "Parameters": [
- {
- "Name": "location",
- "Type": "System.String"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.RedirectResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Redirect",
- "Parameters": [
- {
- "Name": "location",
- "Type": "System.Uri"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.RedirectResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "RedirectToRoute",
- "Parameters": [
- {
- "Name": "routeName",
- "Type": "System.String"
- },
- {
- "Name": "routeValues",
- "Type": "System.Object"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.RedirectToRouteResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "ResponseMessage",
- "Parameters": [
- {
- "Name": "response",
- "Type": "System.Net.Http.HttpResponseMessage"
- }
- ],
- "ReturnType": "System.Web.Http.ResponseMessageResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "StatusCode",
- "Parameters": [
- {
- "Name": "status",
- "Type": "System.Net.HttpStatusCode"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.StatusCodeResult",
- "Virtual": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Dispose",
- "Parameters": [],
- "ReturnType": "System.Void",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "System.IDisposable",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Validate",
- "Parameters": [
- {
- "Name": "entity",
- "Type": "T0"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "TEntity",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "Validate",
- "Parameters": [
- {
- "Name": "entity",
- "Type": "T0"
- },
- {
- "Name": "keyPrefix",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "TEntity",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Method",
- "Name": "Dispose",
- "Parameters": [
- {
- "Name": "disposing",
- "Type": "System.Boolean"
- }
- ],
- "ReturnType": "System.Void",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Protected",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Web.Http.BadRequestErrorMessageResult",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "Microsoft.AspNetCore.Mvc.ObjectResult",
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "ExecuteResultAsync",
- "Parameters": [
- {
- "Name": "context",
- "Type": "Microsoft.AspNetCore.Mvc.ActionContext"
- }
- ],
- "ReturnType": "System.Threading.Tasks.Task",
- "Virtual": true,
- "Override": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.IActionResult",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_Message",
- "Parameters": [],
- "ReturnType": "System.String",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "message",
- "Type": "System.String"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Web.Http.ConflictResult",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "Microsoft.AspNetCore.Mvc.StatusCodeResult",
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Web.Http.ExceptionResult",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "Microsoft.AspNetCore.Mvc.ObjectResult",
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "ExecuteResultAsync",
- "Parameters": [
- {
- "Name": "context",
- "Type": "Microsoft.AspNetCore.Mvc.ActionContext"
- }
- ],
- "ReturnType": "System.Threading.Tasks.Task",
- "Virtual": true,
- "Override": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.IActionResult",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_Exception",
- "Parameters": [],
- "ReturnType": "System.Exception",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_IncludeErrorDetail",
- "Parameters": [],
- "ReturnType": "System.Boolean",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "exception",
- "Type": "System.Exception"
- },
- {
- "Name": "includeErrorDetail",
- "Type": "System.Boolean"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Web.Http.HttpError",
- "Visibility": "Public",
- "Kind": "Class",
- "Sealed": true,
- "BaseType": "System.Collections.Generic.Dictionary",
- "ImplementedInterfaces": [
- "System.Xml.Serialization.IXmlSerializable"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_Message",
- "Parameters": [],
- "ReturnType": "System.String",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_Message",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_ModelState",
- "Parameters": [],
- "ReturnType": "System.Web.Http.HttpError",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_MessageDetail",
- "Parameters": [],
- "ReturnType": "System.String",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_MessageDetail",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_ExceptionMessage",
- "Parameters": [],
- "ReturnType": "System.String",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_ExceptionMessage",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_ExceptionType",
- "Parameters": [],
- "ReturnType": "System.String",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_ExceptionType",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_StackTrace",
- "Parameters": [],
- "ReturnType": "System.String",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_StackTrace",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_InnerException",
- "Parameters": [],
- "ReturnType": "System.Web.Http.HttpError",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "GetPropertyValue",
- "Parameters": [
- {
- "Name": "key",
- "Type": "System.String"
- }
- ],
- "ReturnType": "T0",
- "Visibility": "Public",
- "GenericParameter": [
- {
- "ParameterName": "TValue",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "message",
- "Type": "System.String"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "exception",
- "Type": "System.Exception"
- },
- {
- "Name": "includeErrorDetail",
- "Type": "System.Boolean"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "modelState",
- "Type": "Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"
- },
- {
- "Name": "includeErrorDetail",
- "Type": "System.Boolean"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Web.Http.HttpErrorKeys",
- "Visibility": "Public",
- "Kind": "Class",
- "Abstract": true,
- "Static": true,
- "Sealed": true,
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Field",
- "Name": "MessageKey",
- "Parameters": [],
- "ReturnType": "System.String",
- "Static": true,
- "ReadOnly": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Field",
- "Name": "MessageDetailKey",
- "Parameters": [],
- "ReturnType": "System.String",
- "Static": true,
- "ReadOnly": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Field",
- "Name": "ModelStateKey",
- "Parameters": [],
- "ReturnType": "System.String",
- "Static": true,
- "ReadOnly": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Field",
- "Name": "ExceptionMessageKey",
- "Parameters": [],
- "ReturnType": "System.String",
- "Static": true,
- "ReadOnly": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Field",
- "Name": "ExceptionTypeKey",
- "Parameters": [],
- "ReturnType": "System.String",
- "Static": true,
- "ReadOnly": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Field",
- "Name": "StackTraceKey",
- "Parameters": [],
- "ReturnType": "System.String",
- "Static": true,
- "ReadOnly": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Field",
- "Name": "InnerExceptionKey",
- "Parameters": [],
- "ReturnType": "System.String",
- "Static": true,
- "ReadOnly": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Field",
- "Name": "MessageLanguageKey",
- "Parameters": [],
- "ReturnType": "System.String",
- "Static": true,
- "ReadOnly": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Field",
- "Name": "ErrorCodeKey",
- "Parameters": [],
- "ReturnType": "System.String",
- "Static": true,
- "ReadOnly": true,
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Web.Http.HttpResponseException",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "System.Exception",
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_Response",
- "Parameters": [],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "response",
- "Type": "System.Net.Http.HttpResponseMessage"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Web.Http.InternalServerErrorResult",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "Microsoft.AspNetCore.Mvc.StatusCodeResult",
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Web.Http.InvalidModelStateResult",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "Microsoft.AspNetCore.Mvc.ObjectResult",
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "ExecuteResultAsync",
- "Parameters": [
- {
- "Name": "context",
- "Type": "Microsoft.AspNetCore.Mvc.ActionContext"
- }
- ],
- "ReturnType": "System.Threading.Tasks.Task",
- "Virtual": true,
- "Override": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.IActionResult",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_ModelState",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_IncludeErrorDetail",
- "Parameters": [],
- "ReturnType": "System.Boolean",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "modelState",
- "Type": "Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"
- },
- {
- "Name": "includeErrorDetail",
- "Type": "System.Boolean"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Web.Http.NegotiatedContentResult",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "Microsoft.AspNetCore.Mvc.ObjectResult",
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "ExecuteResultAsync",
- "Parameters": [
- {
- "Name": "context",
- "Type": "Microsoft.AspNetCore.Mvc.ActionContext"
- }
- ],
- "ReturnType": "System.Threading.Tasks.Task",
- "Virtual": true,
- "Override": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.IActionResult",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_Content",
- "Parameters": [],
- "ReturnType": "T0",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "statusCode",
- "Type": "System.Net.HttpStatusCode"
- },
- {
- "Name": "content",
- "Type": "T0"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": [
- {
- "ParameterName": "T",
- "ParameterPosition": 0,
- "BaseTypeOrInterfaces": []
- }
- ]
- },
- {
- "Name": "System.Web.Http.FromUriAttribute",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "System.Attribute",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.ModelBinding.IOptionalBinderMetadata",
- "Microsoft.AspNetCore.Mvc.ModelBinding.IBindingSourceMetadata",
- "Microsoft.AspNetCore.Mvc.ModelBinding.IModelNameProvider"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_BindingSource",
- "Parameters": [],
- "ReturnType": "Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.ModelBinding.IBindingSourceMetadata",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_IsOptional",
- "Parameters": [],
- "ReturnType": "System.Boolean",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.ModelBinding.IOptionalBinderMetadata",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_IsOptional",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.Boolean"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_Name",
- "Parameters": [],
- "ReturnType": "System.String",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.ModelBinding.IModelNameProvider",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_Name",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Web.Http.ResponseMessageResult",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "Microsoft.AspNetCore.Mvc.ObjectResult",
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_Response",
- "Parameters": [],
- "ReturnType": "System.Net.Http.HttpResponseMessage",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "response",
- "Type": "System.Net.Http.HttpResponseMessage"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Builder.WebApiCompatShimRouteBuilderExtensions",
- "Visibility": "Public",
- "Kind": "Class",
- "Abstract": true,
- "Static": true,
- "Sealed": true,
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "MapWebApiRoute",
- "Parameters": [
- {
- "Name": "routeCollectionBuilder",
- "Type": "Microsoft.AspNetCore.Routing.IRouteBuilder"
- },
- {
- "Name": "name",
- "Type": "System.String"
- },
- {
- "Name": "template",
- "Type": "System.String"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Routing.IRouteBuilder",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "MapWebApiRoute",
- "Parameters": [
- {
- "Name": "routeCollectionBuilder",
- "Type": "Microsoft.AspNetCore.Routing.IRouteBuilder"
- },
- {
- "Name": "name",
- "Type": "System.String"
- },
- {
- "Name": "template",
- "Type": "System.String"
- },
- {
- "Name": "defaults",
- "Type": "System.Object"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Routing.IRouteBuilder",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "MapWebApiRoute",
- "Parameters": [
- {
- "Name": "routeCollectionBuilder",
- "Type": "Microsoft.AspNetCore.Routing.IRouteBuilder"
- },
- {
- "Name": "name",
- "Type": "System.String"
- },
- {
- "Name": "template",
- "Type": "System.String"
- },
- {
- "Name": "defaults",
- "Type": "System.Object"
- },
- {
- "Name": "constraints",
- "Type": "System.Object"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Routing.IRouteBuilder",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "MapWebApiRoute",
- "Parameters": [
- {
- "Name": "routeCollectionBuilder",
- "Type": "Microsoft.AspNetCore.Routing.IRouteBuilder"
- },
- {
- "Name": "name",
- "Type": "System.String"
- },
- {
- "Name": "template",
- "Type": "System.String"
- },
- {
- "Name": "defaults",
- "Type": "System.Object"
- },
- {
- "Name": "constraints",
- "Type": "System.Object"
- },
- {
- "Name": "dataTokens",
- "Type": "System.Object"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Routing.IRouteBuilder",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.ModelBinding.IOptionalBinderMetadata",
- "Visibility": "Public",
- "Kind": "Interface",
- "Abstract": true,
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_IsOptional",
- "Parameters": [],
- "ReturnType": "System.Boolean",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IUseWebApiActionConventions",
- "Visibility": "Public",
- "Kind": "Interface",
- "Abstract": true,
- "ImplementedInterfaces": [],
- "Members": [],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IUseWebApiOverloading",
- "Visibility": "Public",
- "Kind": "Interface",
- "Abstract": true,
- "ImplementedInterfaces": [],
- "Members": [],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IUseWebApiParameterConventions",
- "Visibility": "Public",
- "Kind": "Interface",
- "Abstract": true,
- "ImplementedInterfaces": [],
- "Members": [],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IUseWebApiRoutes",
- "Visibility": "Public",
- "Kind": "Interface",
- "Abstract": true,
- "ImplementedInterfaces": [],
- "Members": [],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.UseWebApiActionConventionsAttribute",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "System.Attribute",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IUseWebApiActionConventions"
- ],
- "Members": [
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.UseWebApiOverloadingAttribute",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "System.Attribute",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IUseWebApiOverloading"
- ],
- "Members": [
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.UseWebApiParameterConventionsAttribute",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "System.Attribute",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IUseWebApiParameterConventions"
- ],
- "Members": [
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.UseWebApiRoutesAttribute",
- "Visibility": "Public",
- "Kind": "Class",
- "BaseType": "System.Attribute",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IUseWebApiRoutes"
- ],
- "Members": [
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.WebApiActionConventionsApplicationModelConvention",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.ApplicationModels.IControllerModelConvention"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "Apply",
- "Parameters": [
- {
- "Name": "controller",
- "Type": "Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerModel"
- }
- ],
- "ReturnType": "System.Void",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.ApplicationModels.IControllerModelConvention",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.WebApiOverloadingApplicationModelConvention",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.ApplicationModels.IActionModelConvention"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "Apply",
- "Parameters": [
- {
- "Name": "action",
- "Type": "Microsoft.AspNetCore.Mvc.ApplicationModels.ActionModel"
- }
- ],
- "ReturnType": "System.Void",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.ApplicationModels.IActionModelConvention",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.WebApiParameterConventionsApplicationModelConvention",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.ApplicationModels.IActionModelConvention"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "Apply",
- "Parameters": [
- {
- "Name": "action",
- "Type": "Microsoft.AspNetCore.Mvc.ApplicationModels.ActionModel"
- }
- ],
- "ReturnType": "System.Void",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.ApplicationModels.IActionModelConvention",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.WebApiRoutesApplicationModelConvention",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.ApplicationModels.IControllerModelConvention"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "Apply",
- "Parameters": [
- {
- "Name": "controller",
- "Type": "Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerModel"
- }
- ],
- "ReturnType": "System.Void",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.ApplicationModels.IControllerModelConvention",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "area",
- "Type": "System.String"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.HttpResponseMessageOutputFormatter",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.Formatters.IOutputFormatter"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "CanWriteResult",
- "Parameters": [
- {
- "Name": "context",
- "Type": "Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterCanWriteContext"
- }
- ],
- "ReturnType": "System.Boolean",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.Formatters.IOutputFormatter",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "WriteAsync",
- "Parameters": [
- {
- "Name": "context",
- "Type": "Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterWriteContext"
- }
- ],
- "ReturnType": "System.Threading.Tasks.Task",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.Formatters.IOutputFormatter",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.FormDataCollectionExtensions",
- "Visibility": "Public",
- "Kind": "Class",
- "Abstract": true,
- "Static": true,
- "Sealed": true,
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "NormalizeJQueryToMvc",
- "Parameters": [
- {
- "Name": "key",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.String",
- "Static": true,
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "GetJQueryNameValuePairs",
- "Parameters": [
- {
- "Name": "formData",
- "Type": "System.Net.Http.Formatting.FormDataCollection"
- }
- ],
- "ReturnType": "System.Collections.Generic.IEnumerable>",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.HttpRequestMessageFeature",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IHttpRequestMessageFeature"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_HttpRequestMessage",
- "Parameters": [],
- "ReturnType": "System.Net.Http.HttpRequestMessage",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IHttpRequestMessageFeature",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_HttpRequestMessage",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.Net.Http.HttpRequestMessage"
- }
- ],
- "ReturnType": "System.Void",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IHttpRequestMessageFeature",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "httpContext",
- "Type": "Microsoft.AspNetCore.Http.HttpContext"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.HttpRequestMessageHttpContextExtensions",
- "Visibility": "Public",
- "Kind": "Class",
- "Abstract": true,
- "Static": true,
- "Sealed": true,
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "GetHttpRequestMessage",
- "Parameters": [
- {
- "Name": "httpContext",
- "Type": "Microsoft.AspNetCore.Http.HttpContext"
- }
- ],
- "ReturnType": "System.Net.Http.HttpRequestMessage",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.HttpRequestMessageModelBinder",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "BindModelAsync",
- "Parameters": [
- {
- "Name": "bindingContext",
- "Type": "Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext"
- }
- ],
- "ReturnType": "System.Threading.Tasks.Task",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.HttpRequestMessageModelBinderProvider",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderProvider"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "GetBinder",
- "Parameters": [
- {
- "Name": "context",
- "Type": "Microsoft.AspNetCore.Mvc.ModelBinding.ModelBinderProviderContext"
- }
- ],
- "ReturnType": "Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderProvider",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.IHttpRequestMessageFeature",
- "Visibility": "Public",
- "Kind": "Interface",
- "Abstract": true,
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_HttpRequestMessage",
- "Parameters": [],
- "ReturnType": "System.Net.Http.HttpRequestMessage",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_HttpRequestMessage",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.Net.Http.HttpRequestMessage"
- }
- ],
- "ReturnType": "System.Void",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.HttpResponseExceptionActionFilter",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.Filters.IActionFilter",
- "Microsoft.AspNetCore.Mvc.Filters.IOrderedFilter"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_Order",
- "Parameters": [],
- "ReturnType": "System.Int32",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.Filters.IOrderedFilter",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_Order",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.Int32"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "OnActionExecuting",
- "Parameters": [
- {
- "Name": "context",
- "Type": "Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext"
- }
- ],
- "ReturnType": "System.Void",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.Filters.IActionFilter",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "OnActionExecuted",
- "Parameters": [
- {
- "Name": "context",
- "Type": "Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext"
- }
- ],
- "ReturnType": "System.Void",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.Filters.IActionFilter",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.OverloadActionConstraint",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_Order",
- "Parameters": [],
- "ReturnType": "System.Int32",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Accept",
- "Parameters": [
- {
- "Name": "context",
- "Type": "Microsoft.AspNetCore.Mvc.ActionConstraints.ActionConstraintContext"
- }
- ],
- "ReturnType": "System.Boolean",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.WebApiCompatShimOptions",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_Formatters",
- "Parameters": [],
- "ReturnType": "System.Net.Http.Formatting.MediaTypeFormatterCollection",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_Formatters",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatterCollection"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.WebApiCompatShimOptionsSetup",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "Microsoft.Extensions.Options.IConfigureOptions",
- "Microsoft.Extensions.Options.IConfigureOptions"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_Name",
- "Parameters": [],
- "ReturnType": "System.String",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_Name",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Configure",
- "Parameters": [
- {
- "Name": "options",
- "Type": "Microsoft.AspNetCore.Mvc.MvcOptions"
- }
- ],
- "ReturnType": "System.Void",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.Extensions.Options.IConfigureOptions",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Configure",
- "Parameters": [
- {
- "Name": "options",
- "Type": "Microsoft.AspNetCore.Mvc.WebApiCompatShim.WebApiCompatShimOptions"
- }
- ],
- "ReturnType": "System.Void",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "Microsoft.Extensions.Options.IConfigureOptions",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Field",
- "Name": "DefaultAreaName",
- "Parameters": [],
- "ReturnType": "System.String",
- "Static": true,
- "ReadOnly": true,
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "Microsoft.Extensions.DependencyInjection.WebApiCompatShimMvcBuilderExtensions",
- "Visibility": "Public",
- "Kind": "Class",
- "Abstract": true,
- "Static": true,
- "Sealed": true,
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "AddWebApiConventions",
- "Parameters": [
- {
- "Name": "builder",
- "Type": "Microsoft.Extensions.DependencyInjection.IMvcBuilder"
- }
- ],
- "ReturnType": "Microsoft.Extensions.DependencyInjection.IMvcBuilder",
- "Static": true,
- "Extension": true,
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Net.Http.Formatting.ContentNegotiationResult",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_Formatter",
- "Parameters": [],
- "ReturnType": "System.Net.Http.Formatting.MediaTypeFormatter",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_Formatter",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatter"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_MediaType",
- "Parameters": [],
- "ReturnType": "System.Net.Http.Headers.MediaTypeHeaderValue",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "set_MediaType",
- "Parameters": [
- {
- "Name": "value",
- "Type": "System.Net.Http.Headers.MediaTypeHeaderValue"
- }
- ],
- "ReturnType": "System.Void",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "formatter",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatter"
- },
- {
- "Name": "mediaType",
- "Type": "System.Net.Http.Headers.MediaTypeHeaderValue"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Net.Http.Formatting.DefaultContentNegotiator",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "System.Net.Http.Formatting.IContentNegotiator"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_ExcludeMatchOnTypeOnly",
- "Parameters": [],
- "ReturnType": "System.Boolean",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Negotiate",
- "Parameters": [
- {
- "Name": "type",
- "Type": "System.Type"
- },
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "formatters",
- "Type": "System.Collections.Generic.IEnumerable"
- }
- ],
- "ReturnType": "System.Net.Http.Formatting.ContentNegotiationResult",
- "Virtual": true,
- "ImplementedInterface": "System.Net.Http.Formatting.IContentNegotiator",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "ComputeFormatterMatches",
- "Parameters": [
- {
- "Name": "type",
- "Type": "System.Type"
- },
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "formatters",
- "Type": "System.Collections.Generic.IEnumerable"
- }
- ],
- "ReturnType": "System.Collections.ObjectModel.Collection",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "SelectResponseMediaTypeFormatter",
- "Parameters": [
- {
- "Name": "matches",
- "Type": "System.Collections.Generic.ICollection"
- }
- ],
- "ReturnType": "System.Net.Http.Formatting.MediaTypeFormatterMatch",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "SelectResponseCharacterEncoding",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "formatter",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatter"
- }
- ],
- "ReturnType": "System.Text.Encoding",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "MatchMediaTypeMapping",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "formatter",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatter"
- }
- ],
- "ReturnType": "System.Net.Http.Formatting.MediaTypeFormatterMatch",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "MatchAcceptHeader",
- "Parameters": [
- {
- "Name": "sortedAcceptValues",
- "Type": "System.Collections.Generic.IEnumerable"
- },
- {
- "Name": "formatter",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatter"
- }
- ],
- "ReturnType": "System.Net.Http.Formatting.MediaTypeFormatterMatch",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "MatchRequestMediaType",
- "Parameters": [
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "formatter",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatter"
- }
- ],
- "ReturnType": "System.Net.Http.Formatting.MediaTypeFormatterMatch",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "ShouldMatchOnType",
- "Parameters": [
- {
- "Name": "sortedAcceptValues",
- "Type": "System.Collections.Generic.IEnumerable"
- }
- ],
- "ReturnType": "System.Boolean",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "MatchType",
- "Parameters": [
- {
- "Name": "type",
- "Type": "System.Type"
- },
- {
- "Name": "formatter",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatter"
- }
- ],
- "ReturnType": "System.Net.Http.Formatting.MediaTypeFormatterMatch",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "SortMediaTypeWithQualityHeaderValuesByQFactor",
- "Parameters": [
- {
- "Name": "headerValues",
- "Type": "System.Collections.Generic.ICollection"
- }
- ],
- "ReturnType": "System.Collections.Generic.IEnumerable",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "SortStringWithQualityHeaderValuesByQFactor",
- "Parameters": [
- {
- "Name": "headerValues",
- "Type": "System.Collections.Generic.ICollection"
- }
- ],
- "ReturnType": "System.Collections.Generic.IEnumerable",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "UpdateBestMatch",
- "Parameters": [
- {
- "Name": "current",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatterMatch"
- },
- {
- "Name": "potentialReplacement",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatterMatch"
- }
- ],
- "ReturnType": "System.Net.Http.Formatting.MediaTypeFormatterMatch",
- "Virtual": true,
- "Visibility": "Protected",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [],
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "excludeMatchOnTypeOnly",
- "Type": "System.Boolean"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Net.Http.Formatting.FormDataCollection",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [
- "System.Collections.Generic.IEnumerable>"
- ],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_Item",
- "Parameters": [
- {
- "Name": "name",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.String",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "ReadAsNameValueCollection",
- "Parameters": [],
- "ReturnType": "System.Collections.Specialized.NameValueCollection",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "Get",
- "Parameters": [
- {
- "Name": "key",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.String",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "GetValues",
- "Parameters": [
- {
- "Name": "key",
- "Type": "System.String"
- }
- ],
- "ReturnType": "System.String[]",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "GetEnumerator",
- "Parameters": [],
- "ReturnType": "System.Collections.Generic.IEnumerator>",
- "Sealed": true,
- "Virtual": true,
- "ImplementedInterface": "System.Collections.Generic.IEnumerable>",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "pairs",
- "Type": "System.Collections.Generic.IEnumerable>"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "uri",
- "Type": "System.Uri"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "query",
- "Type": "System.String"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Net.Http.Formatting.IContentNegotiator",
- "Visibility": "Public",
- "Kind": "Interface",
- "Abstract": true,
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "Negotiate",
- "Parameters": [
- {
- "Name": "type",
- "Type": "System.Type"
- },
- {
- "Name": "request",
- "Type": "System.Net.Http.HttpRequestMessage"
- },
- {
- "Name": "formatters",
- "Type": "System.Collections.Generic.IEnumerable"
- }
- ],
- "ReturnType": "System.Net.Http.Formatting.ContentNegotiationResult",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Net.Http.Formatting.MediaTypeFormatterMatch",
- "Visibility": "Public",
- "Kind": "Class",
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Method",
- "Name": "get_Formatter",
- "Parameters": [],
- "ReturnType": "System.Net.Http.Formatting.MediaTypeFormatter",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_MediaType",
- "Parameters": [],
- "ReturnType": "System.Net.Http.Headers.MediaTypeHeaderValue",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_Quality",
- "Parameters": [],
- "ReturnType": "System.Double",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Method",
- "Name": "get_Ranking",
- "Parameters": [],
- "ReturnType": "System.Net.Http.Formatting.MediaTypeFormatterMatchRanking",
- "Visibility": "Public",
- "GenericParameter": []
- },
- {
- "Kind": "Constructor",
- "Name": ".ctor",
- "Parameters": [
- {
- "Name": "formatter",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatter"
- },
- {
- "Name": "mediaType",
- "Type": "System.Net.Http.Headers.MediaTypeHeaderValue"
- },
- {
- "Name": "quality",
- "Type": "System.Nullable"
- },
- {
- "Name": "ranking",
- "Type": "System.Net.Http.Formatting.MediaTypeFormatterMatchRanking"
- }
- ],
- "Visibility": "Public",
- "GenericParameter": []
- }
- ],
- "GenericParameters": []
- },
- {
- "Name": "System.Net.Http.Formatting.MediaTypeFormatterMatchRanking",
- "Visibility": "Public",
- "Kind": "Enumeration",
- "Sealed": true,
- "ImplementedInterfaces": [],
- "Members": [
- {
- "Kind": "Field",
- "Name": "None",
- "Parameters": [],
- "GenericParameter": [],
- "Literal": "0"
- },
- {
- "Kind": "Field",
- "Name": "MatchOnCanWriteType",
- "Parameters": [],
- "GenericParameter": [],
- "Literal": "1"
- },
- {
- "Kind": "Field",
- "Name": "MatchOnRequestAcceptHeaderLiteral",
- "Parameters": [],
- "GenericParameter": [],
- "Literal": "2"
- },
- {
- "Kind": "Field",
- "Name": "MatchOnRequestAcceptHeaderSubtypeMediaRange",
- "Parameters": [],
- "GenericParameter": [],
- "Literal": "3"
- },
- {
- "Kind": "Field",
- "Name": "MatchOnRequestAcceptHeaderAllMediaRange",
- "Parameters": [],
- "GenericParameter": [],
- "Literal": "4"
- },
- {
- "Kind": "Field",
- "Name": "MatchOnRequestWithMediaTypeMapping",
- "Parameters": [],
- "GenericParameter": [],
- "Literal": "5"
- },
- {
- "Kind": "Field",
- "Name": "MatchOnRequestMediaType",
- "Parameters": [],
- "GenericParameter": [],
- "Literal": "6"
- }
- ],
- "GenericParameters": []
- }
- ]
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc/Microsoft.AspNetCore.Mvc.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc/Microsoft.AspNetCore.Mvc.csproj
index 9b21543c20..7d6d67619d 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc/Microsoft.AspNetCore.Mvc.csproj
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc/Microsoft.AspNetCore.Mvc.csproj
@@ -2,7 +2,7 @@
ASP.NET Core MVC is a web framework that gives you a powerful, patterns-based way to build dynamic websites and web APIs. ASP.NET Core MVC enables a clean separation of concerns and gives you full control over markup.
- netstandard2.0
+ netcoreapp3.0
$(NoWarn);CS1591
true
aspnetcore;aspnetcoremvc
@@ -19,13 +19,6 @@
-
-
- None
-
-
- None
-
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc/MvcServiceCollectionExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc/MvcServiceCollectionExtensions.cs
index 037bcdd2d3..03a73516d2 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc/MvcServiceCollectionExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc/MvcServiceCollectionExtensions.cs
@@ -8,7 +8,6 @@ using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Razor.TagHelpers;
using Microsoft.AspNetCore.Mvc.TagHelpers;
diff --git a/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/DownloadFile.cs b/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/DownloadFile.cs
index 177f405ea1..293300d6a8 100644
--- a/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/DownloadFile.cs
+++ b/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/DownloadFile.cs
@@ -177,6 +177,8 @@ namespace Microsoft.Extensions.ApiDescription.Tasks
using (var outStream = File.Create(destinationPath))
{
await responseStream.CopyToAsync(outStream);
+
+ await outStream.FlushAsync();
}
}
}
diff --git a/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/Microsoft.Extensions.ApiDescription.Design.csproj b/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/Microsoft.Extensions.ApiDescription.Design.csproj
index 7809b19970..1a648b1f93 100644
--- a/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/Microsoft.Extensions.ApiDescription.Design.csproj
+++ b/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/Microsoft.Extensions.ApiDescription.Design.csproj
@@ -15,8 +15,12 @@
$(MSBuildProjectName).nuspec
$(MSBuildProjectName)
Build Tasks;MSBuild;Swagger;Open API;code generation; Web API client
+ $(ExperimentalPackageVersion)
$(AssemblyName)
netstandard2.0;net461
+ false
+ $(ExperimentalVersionPrefix)
+ $(ExperimentalVersionSuffix)
diff --git a/src/Mvc/src/dotnet-getdocument/Commands/InvokeCommand.cs b/src/Mvc/src/dotnet-getdocument/Commands/InvokeCommand.cs
index 4d24919c08..359b173235 100644
--- a/src/Mvc/src/dotnet-getdocument/Commands/InvokeCommand.cs
+++ b/src/Mvc/src/dotnet-getdocument/Commands/InvokeCommand.cs
@@ -186,8 +186,22 @@ namespace Microsoft.Extensions.ApiDescription.Tool.Commands
{
if (cleanupExecutable && !string.IsNullOrEmpty(executable))
{
- File.Delete(executable);
- File.Delete(executable + ".config");
+ // Ignore errors about in-use files. Should still be marked for delete after process cleanup.
+ try
+ {
+ File.Delete(executable);
+ }
+ catch (UnauthorizedAccessException)
+ {
+ }
+
+ try
+ {
+ File.Delete(executable + ".config");
+ }
+ catch (UnauthorizedAccessException)
+ {
+ }
}
}
}
diff --git a/src/Mvc/src/dotnet-getdocument/Exe.cs b/src/Mvc/src/dotnet-getdocument/Exe.cs
index 08fc4217ba..bc17eee130 100644
--- a/src/Mvc/src/dotnet-getdocument/Exe.cs
+++ b/src/Mvc/src/dotnet-getdocument/Exe.cs
@@ -1,6 +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 System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
@@ -31,20 +32,32 @@ namespace Microsoft.Extensions.ApiDescription.Tool
startInfo.WorkingDirectory = workingDirectory;
}
- var process = Process.Start(startInfo);
-
- if (interceptOutput)
+ using (var process = Process.Start(startInfo))
{
- string line;
- while ((line = process.StandardOutput.ReadLine()) != null)
+ if (interceptOutput)
{
- Reporter.WriteVerbose(line);
+ string line;
+ while ((line = process.StandardOutput.ReadLine()) != null)
+ {
+ Reporter.WriteVerbose(line);
+ }
}
+
+ // Follow precedent set in Razor integration tests and ensure process events and output are complete.
+ // https://github.com/aspnet/Razor/blob/d719920fdcc7d1db3a6f74cd5404d66fa098f057/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/MSBuildProcessManager.cs#L91-L102
+ // Timeout is double how long the inside man waits for the IDocumentProcessor to wrap up.
+ if (!process.WaitForExit((int)(TimeSpan.FromMinutes(2).TotalMilliseconds)))
+ {
+ process.Kill();
+
+ // Should be unreachable in almost every case.
+ throw new TimeoutException($"Process {executable} timed out after 2 minutes.");
+ }
+
+ process.WaitForExit();
+
+ return process.ExitCode;
}
-
- process.WaitForExit();
-
- return process.ExitCode;
}
private static string ToArguments(IReadOnlyList args)
diff --git a/src/Mvc/src/dotnet-getdocument/Project.cs b/src/Mvc/src/dotnet-getdocument/Project.cs
index dc4a06ea36..db9734e532 100644
--- a/src/Mvc/src/dotnet-getdocument/Project.cs
+++ b/src/Mvc/src/dotnet-getdocument/Project.cs
@@ -89,6 +89,8 @@ namespace Microsoft.Extensions.ApiDescription.Tool
// NB: Copy always in case it changes
Reporter.WriteVerbose(Resources.FormatWritingFile(targetsPath));
input.CopyTo(output);
+
+ output.Flush();
}
}
@@ -102,6 +104,7 @@ namespace Microsoft.Extensions.ApiDescription.Tool
"/target:WriteServiceProjectReferenceMetadata",
"/verbosity:quiet",
"/nologo",
+ "/nodeReuse:false",
$"/property:ServiceProjectReferenceMetadataPath={metadataPath}",
projectFile,
};
@@ -134,8 +137,22 @@ namespace Microsoft.Extensions.ApiDescription.Tool
}
finally
{
- File.Delete(metadataPath);
- File.Delete(targetsPath);
+ // Ignore errors about in-use files. Should still be marked for delete after process cleanup.
+ try
+ {
+ File.Delete(metadataPath);
+ }
+ catch (UnauthorizedAccessException)
+ {
+ }
+
+ try
+ {
+ File.Delete(targetsPath);
+ }
+ catch (UnauthorizedAccessException)
+ {
+ }
}
var project = new Project
diff --git a/src/Mvc/src/dotnet-getdocument/dotnet-getdocument.csproj b/src/Mvc/src/dotnet-getdocument/dotnet-getdocument.csproj
index ebda3eb047..9a8581a761 100644
--- a/src/Mvc/src/dotnet-getdocument/dotnet-getdocument.csproj
+++ b/src/Mvc/src/dotnet-getdocument/dotnet-getdocument.csproj
@@ -7,6 +7,10 @@
Exe
Microsoft.Extensions.ApiDescription.Tool
netcoreapp2.1
+ false
+ false
+ $(ExperimentalVersionPrefix)
+ $(ExperimentalVersionSuffix)
diff --git a/src/Mvc/test/Directory.Build.props b/src/Mvc/test/Directory.Build.props
index ff13641a43..9a543914cb 100644
--- a/src/Mvc/test/Directory.Build.props
+++ b/src/Mvc/test/Directory.Build.props
@@ -1,13 +1,6 @@
-
- netcoreapp2.2
- $(DeveloperBuildTestTfms)
-
- $(StandardTestTfms);net461
-
-
false
$(MSBuildThisFileDirectory)MvcTests.ruleset
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj
index a02016bd2e..1ed6005bfe 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj
@@ -1,7 +1,7 @@
- $(StandardTestTfms)
+ netcoreapp3.0
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/ModelBinding/ModelStateDictionaryTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/ModelBinding/ModelStateDictionaryTest.cs
index 75a01945d2..f9a8f0bc2e 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/ModelBinding/ModelStateDictionaryTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/ModelBinding/ModelStateDictionaryTest.cs
@@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Formatters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.Extensions.Options;
using Xunit;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/ApiResponseTypeProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/ApiResponseTypeProviderTest.cs
index d990cdd2ff..8f3029a647 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/ApiResponseTypeProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/ApiResponseTypeProviderTest.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Formatters;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Xunit;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/DefaultApiDescriptionProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/DefaultApiDescriptionProviderTest.cs
index 81f17cb58b..d69609e3a4 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/DefaultApiDescriptionProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/DefaultApiDescriptionProviderTest.cs
@@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Formatters;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Microsoft.AspNetCore.Mvc.Routing;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj b/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj
index b1ca115faa..3a2ae57aaf 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj
@@ -1,7 +1,7 @@
- $(StandardTestTfms)
+ netcoreapp3.0
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/AcceptedAtActionResultTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/AcceptedAtActionResultTests.cs
index 242405e9ba..721b58ca9b 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/AcceptedAtActionResultTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/AcceptedAtActionResultTests.cs
@@ -2,14 +2,12 @@
// 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.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Testing;
@@ -17,7 +15,6 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Moq;
-using Newtonsoft.Json;
using Xunit;
namespace Microsoft.AspNetCore.Mvc
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/AcceptedResultTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/AcceptedResultTests.cs
index 8c32191534..07ca76072e 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/AcceptedResultTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/AcceptedResultTests.cs
@@ -2,20 +2,16 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using System.Buffers;
-using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Moq;
-using Newtonsoft.Json;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.Core.Test
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionConstraintCacheTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ActionConstraints/ActionConstraintCacheTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionConstraintCacheTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ActionConstraints/ActionConstraintCacheTest.cs
index c4374a5bbb..5b9fd44387 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionConstraintCacheTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ActionConstraints/ActionConstraintCacheTest.cs
@@ -5,13 +5,12 @@ using System;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ActionConstraints
{
public class ActionConstraintCacheTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/HttpMethodActionConstraintTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ActionConstraints/HttpMethodActionConstraintTest.cs
similarity index 97%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/HttpMethodActionConstraintTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ActionConstraints/HttpMethodActionConstraintTest.cs
index bb6354fe4c..cbb34315e9 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/HttpMethodActionConstraintTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ActionConstraints/HttpMethodActionConstraintTest.cs
@@ -4,12 +4,11 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Primitives;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ActionConstraints
{
public class HttpMethodActionConstraintTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ActionModelTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ActionModelTest.cs
index 8a43002db1..6e2b6fec71 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ActionModelTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ActionModelTest.cs
@@ -4,9 +4,11 @@
using System;
using System.Collections.Generic;
using System.Reflection;
+using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
+using Microsoft.AspNetCore.Routing;
+using Moq;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
@@ -75,6 +77,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
(typeof(TestController).GetTypeInfo(),
new List());
action.Filters.Add(new MyFilterAttribute());
+ action.RouteParameterTransformer = Mock.Of();
action.RouteValues.Add("key", "value");
action.Properties.Add(new KeyValuePair("test key", "test value"));
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ApiBehaviorApplicationModelProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ApiBehaviorApplicationModelProviderTest.cs
index 12c4984cf5..6abbe2b59c 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ApiBehaviorApplicationModelProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ApiBehaviorApplicationModelProviderTest.cs
@@ -5,7 +5,6 @@ using System;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AuthorizationApplicationModelProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/AuthorizationApplicationModelProviderTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AuthorizationApplicationModelProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/AuthorizationApplicationModelProviderTest.cs
index 866f13e461..0e1f46a760 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AuthorizationApplicationModelProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/AuthorizationApplicationModelProviderTest.cs
@@ -7,14 +7,13 @@ using System.Reflection;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization.Infrastructure;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Options;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public class AuthorizationApplicationModelProviderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ConsumesConstraintForFormFileParameterConventionTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ConsumesConstraintForFormFileParameterConventionTest.cs
index 9f7d07402a..660086f1b7 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ConsumesConstraintForFormFileParameterConventionTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ConsumesConstraintForFormFileParameterConventionTest.cs
@@ -4,7 +4,6 @@
using System;
using System.Reflection;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Options;
using Xunit;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionDescriptorBuilderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ControllerActionDescriptorBuilderTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionDescriptorBuilderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ControllerActionDescriptorBuilderTest.cs
index 17e5325d91..b4405ef2ac 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionDescriptorBuilderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ControllerActionDescriptorBuilderTest.cs
@@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public class ControllerActionDescriptorBuilderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionDescriptorProviderTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ControllerActionDescriptorProviderTests.cs
similarity index 91%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionDescriptorProviderTests.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ControllerActionDescriptorProviderTests.cs
index e35f55a9d9..7540ed8a8b 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionDescriptorProviderTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ControllerActionDescriptorProviderTests.cs
@@ -8,8 +8,6 @@ using System.Reflection;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
-using Microsoft.AspNetCore.Mvc.ApiExplorer;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
@@ -20,7 +18,7 @@ using Microsoft.Extensions.Options;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public class ControllerActionDescriptorProviderTests
{
@@ -403,102 +401,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
c.Value == "OnlyPost");
}
- [Fact]
- public void BuildModel_IncludesGlobalFilters()
- {
- // Arrange
- var filter = new MyFilterAttribute(1);
- var provider = GetProvider(typeof(PersonController).GetTypeInfo(), new IFilterMetadata[]
- {
- filter,
- });
-
- // Act
- var model = provider.BuildModel();
-
- // Assert
- var filters = model.Filters;
- Assert.Same(filter, Assert.Single(filters));
- }
-
- [Fact]
- public void BuildModel_CreatesControllerModels_ForAllControllers()
- {
- // Arrange
- var provider = GetProvider(
- typeof(ConventionallyRoutedController).GetTypeInfo(),
- typeof(AttributeRoutedController).GetTypeInfo(),
- typeof(EmptyController).GetTypeInfo(),
- typeof(NonActionAttributeController).GetTypeInfo());
-
- // Act
- var model = provider.BuildModel();
-
- // Assert
- Assert.NotNull(model);
- Assert.Equal(4, model.Controllers.Count);
-
- var conventional = Assert.Single(model.Controllers,
- c => c.ControllerName == "ConventionallyRouted");
- Assert.Empty(conventional.Selectors.Where(sm => sm.AttributeRouteModel != null));
- Assert.Single(conventional.Actions);
-
- var attributeRouted = Assert.Single(model.Controllers,
- c => c.ControllerName == "AttributeRouted");
- Assert.Single(attributeRouted.Actions);
- Assert.Single(attributeRouted.Selectors.Where(sm => sm.AttributeRouteModel != null));
-
- var empty = Assert.Single(model.Controllers,
- c => c.ControllerName == "Empty");
- Assert.Empty(empty.Actions);
-
- var nonAction = Assert.Single(model.Controllers,
- c => c.ControllerName == "NonActionAttribute");
- Assert.Empty(nonAction.Actions);
- }
-
- [Fact]
- public void BuildModel_CreatesControllerActionDescriptors_ForValidActions()
- {
- // Arrange
- var provider = GetProvider(
- typeof(PersonController).GetTypeInfo());
-
- // Act
- var model = provider.BuildModel();
-
- // Assert
- var controller = Assert.Single(model.Controllers);
-
- Assert.Equal(2, controller.Actions.Count);
-
- var getPerson = Assert.Single(controller.Actions, a => a.ActionName == "GetPerson");
- Assert.Empty(getPerson.Selectors[0].ActionConstraints.OfType());
-
- var showPeople = Assert.Single(controller.Actions, a => a.ActionName == "ShowPeople");
- Assert.Empty(showPeople.Selectors[0].ActionConstraints.OfType());
- }
-
- [Fact]
- public void AttributeRouting_TokenReplacement_IsAfterReflectedModel()
- {
- // Arrange
- var provider = GetProvider(typeof(TokenReplacementController).GetTypeInfo());
-
- // Act
- var model = provider.BuildModel();
-
- // Assert
- var controller = Assert.Single(model.Controllers);
-
- var selectorModel = Assert.Single(controller.Selectors.Where(sm => sm.AttributeRouteModel != null));
- Assert.Equal("api/Token/[key]/[controller]", selectorModel.AttributeRouteModel.Template);
-
- var action = Assert.Single(controller.Actions);
- var actionSelectorModel = Assert.Single(action.Selectors.Where(sm => sm.AttributeRouteModel != null));
- Assert.Equal("stub/[action]", actionSelectorModel.AttributeRouteModel.Template);
- }
-
[Fact]
public void AttributeRouting_TokenReplacement_InActionDescriptor()
{
@@ -793,13 +695,14 @@ namespace Microsoft.AspNetCore.Mvc.Internal
// Arrange
var controllerTypeInfo = typeof(UserController).GetTypeInfo();
var manager = GetApplicationManager(new[] { controllerTypeInfo });
+
var options = Options.Create(new MvcOptions());
- options.Value.Conventions.Add(new TestRoutingConvention());
+
var modelProvider = new DefaultApplicationModelProvider(options, new EmptyModelMetadataProvider());
var provider = new ControllerActionDescriptorProvider(
manager,
- new[] { modelProvider },
- options);
+ new ApplicationModelFactory(new[] { modelProvider }, options));
+
var assemblyName = controllerTypeInfo.Assembly.GetName().Name;
var expectedMessage =
"The following errors occurred with attribute routing information:"
@@ -815,7 +718,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
"HTTP Verbs: ''"
+ Environment.NewLine
+ $"Action: '{controllerTypeInfo.FullName}.GetUser ({assemblyName})' " +
- "- Route Template: 'Microsoft/AspNetCore/Mvc/Internal/User/GetUser/{id?}' - " +
+ "- Route Template: '!!!' - " +
"HTTP Verbs: ''" + Environment.NewLine +
Environment.NewLine +
"Use 'AcceptVerbsAttribute' to create a single route that allows multiple HTTP verbs and defines a " +
@@ -1290,38 +1193,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
Assert.Equal(4, sequence);
}
- [Fact]
- public void BuildModel_SplitsConstraintsBasedOnRoute()
- {
- // Arrange
- var provider = GetProvider(typeof(MultipleRouteProviderOnActionController).GetTypeInfo());
-
- // Act
- var model = provider.BuildModel();
-
- // Assert
- var controllerModel = Assert.Single(model.Controllers);
- var actionModel = Assert.Single(controllerModel.Actions);
- Assert.Equal(3, actionModel.Attributes.Count);
- Assert.Equal(2, actionModel.Attributes.OfType().Count());
- Assert.Single(actionModel.Attributes.OfType());
- Assert.Equal(2, actionModel.Selectors.Count);
-
- var selectorModel = Assert.Single(
- actionModel.Selectors.Where(sm => sm.AttributeRouteModel?.Template == "R1"));
-
- Assert.Equal(2, selectorModel.ActionConstraints.Count);
- Assert.Single(selectorModel.ActionConstraints.OfType());
- Assert.Single(selectorModel.ActionConstraints.OfType());
-
- selectorModel = Assert.Single(
- actionModel.Selectors.Where(sm => sm.AttributeRouteModel?.Template == "R2"));
-
- Assert.Equal(2, selectorModel.ActionConstraints.Count);
- Assert.Single(selectorModel.ActionConstraints.OfType());
- Assert.Single(selectorModel.ActionConstraints.OfType());
- }
-
[Fact]
public void GetDescriptors_SplitsConstraintsBasedOnRoute()
{
@@ -1487,8 +1358,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var provider = new ControllerActionDescriptorProvider(
manager,
- new[] { modelProvider },
- options);
+ new ApplicationModelFactory(new[] { modelProvider }, options));
return provider;
}
@@ -1503,8 +1373,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var provider = new ControllerActionDescriptorProvider(
manager,
- new[] { modelProvider },
- options);
+ new ApplicationModelFactory(new[] { modelProvider }, options));
return provider;
}
@@ -1522,8 +1391,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var provider = new ControllerActionDescriptorProvider(
manager,
- new[] { modelProvider },
- options);
+ new ApplicationModelFactory(new[] { modelProvider }, options));
return provider;
}
@@ -2097,31 +1965,23 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
- private class TestRoutingConvention : IApplicationModelConvention
+ private class MixedRoutingConventionAttribute : Attribute, IActionModelConvention
{
- public void Apply(ApplicationModel application)
+ public void Apply(ActionModel action)
{
- foreach (var controller in application.Controllers)
+ action.Selectors.Add(new SelectorModel()
{
- var hasAttributeRouteModels = controller.Selectors
- .Any(selector => selector.AttributeRouteModel != null);
- if (!hasAttributeRouteModels)
+ AttributeRouteModel = new AttributeRouteModel()
{
- var template = controller.ControllerType.Namespace.Replace('.', '/')
- + "/[controller]/[action]/{id?}";
- var attributeRouteModel = new AttributeRouteModel()
- {
- Template = template
- };
-
- controller.Selectors.Add(new SelectorModel { AttributeRouteModel = attributeRouteModel });
+ Template = "/!!!",
}
- }
+ });
}
}
private class UserController : ControllerBase
{
+ [MixedRoutingConvention]
public string GetUser(int id)
{
return string.Format("User {0} retrieved successfully", id);
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ControllerModelTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ControllerModelTest.cs
index dc19724cd6..bd16a8ccd3 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ControllerModelTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/ControllerModelTest.cs
@@ -6,8 +6,6 @@ using System.Collections.Generic;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Xunit;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultApplicationModelProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/DefaultApplicationModelProviderTest.cs
similarity index 94%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultApplicationModelProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/DefaultApplicationModelProviderTest.cs
index 98e358cabc..4e303d91b1 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultApplicationModelProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/DefaultApplicationModelProviderTest.cs
@@ -7,7 +7,7 @@ using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
+using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
@@ -15,25 +15,50 @@ using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Options;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public class DefaultApplicationModelProviderTest
{
private readonly TestApplicationModelProvider Provider = new TestApplicationModelProvider();
[Fact]
- public void CreateControllerModel_DerivedFromControllerClass_HasFilter()
+ public void OnProvidersExecuting_AddsGlobalFilters()
+ {
+ // Arrange
+ var options = new MvcOptions()
+ {
+ Filters =
+ {
+ new MyFilterAttribute(),
+ },
+ };
+
+ var builder = new TestApplicationModelProvider(options, TestModelMetadataProvider.CreateDefaultProvider());
+ var context = new ApplicationModelProviderContext(Array.Empty());
+
+ // Act
+ builder.OnProvidersExecuting(context);
+
+ // Assert
+ Assert.Equal(options.Filters.ToArray(), context.Result.Filters);
+ }
+
+ [Fact]
+ public void OnProvidersExecuting_IncludesAllControllers()
{
// Arrange
var builder = new TestApplicationModelProvider();
- var typeInfo = typeof(StoreController).GetTypeInfo();
+
+ var context = new ApplicationModelProviderContext(new[] { typeof(ModelBinderController).GetTypeInfo(), typeof(ConventionallyRoutedController).GetTypeInfo() });
// Act
- var model = builder.CreateControllerModel(typeInfo);
+ builder.OnProvidersExecuting(context);
// Assert
- var filter = Assert.Single(model.Filters);
- Assert.IsType(filter);
+ Assert.Collection(
+ context.Result.Controllers.OrderBy(c => c.ControllerType.Name),
+ c => Assert.Equal(typeof(ConventionallyRoutedController).GetTypeInfo(), c.ControllerType),
+ c => Assert.Equal(typeof(ModelBinderController).GetTypeInfo(), c.ControllerType));
}
[Fact]
@@ -313,6 +338,21 @@ namespace Microsoft.AspNetCore.Mvc.Internal
});
}
+ [Fact]
+ public void CreateControllerModel_DerivedFromControllerClass_HasFilter()
+ {
+ // Arrange
+ var builder = new TestApplicationModelProvider();
+ var typeInfo = typeof(StoreController).GetTypeInfo();
+
+ // Act
+ var model = builder.CreateControllerModel(typeInfo);
+
+ // Assert
+ var filter = Assert.Single(model.Filters);
+ Assert.IsType(filter);
+ }
+
// This class has a filter attribute, but doesn't implement any filter interfaces,
// so ControllerFilter is not present.
[Fact]
@@ -1098,6 +1138,38 @@ namespace Microsoft.AspNetCore.Mvc.Internal
Assert.Equal(new string[] { "GET" }, methodConstraint.HttpMethods);
}
+ [Fact]
+ public void CreateActionModel_SplitsConstraintsBasedOnRoute()
+ {
+ // Arrange
+ var builder = new TestApplicationModelProvider();
+ var typeInfo = typeof(MultipleRouteProviderOnActionController).GetTypeInfo();
+ var methodInfo = typeInfo.GetMethod(nameof(MultipleRouteProviderOnActionController.Edit));
+
+ // Act
+ var actionModel = builder.CreateActionModel(typeInfo, methodInfo);
+
+ // Assert
+ Assert.Equal(3, actionModel.Attributes.Count);
+ Assert.Equal(2, actionModel.Attributes.OfType().Count());
+ Assert.Single(actionModel.Attributes.OfType());
+ Assert.Equal(2, actionModel.Selectors.Count);
+
+ var selectorModel = Assert.Single(
+ actionModel.Selectors.Where(sm => sm.AttributeRouteModel?.Template == "R1"));
+
+ Assert.Equal(2, selectorModel.ActionConstraints.Count);
+ Assert.Single(selectorModel.ActionConstraints.OfType());
+ Assert.Single(selectorModel.ActionConstraints.OfType());
+
+ selectorModel = Assert.Single(
+ actionModel.Selectors.Where(sm => sm.AttributeRouteModel?.Template == "R2"));
+
+ Assert.Equal(2, selectorModel.ActionConstraints.Count);
+ Assert.Single(selectorModel.ActionConstraints.OfType());
+ Assert.Single(selectorModel.ActionConstraints.OfType());
+ }
+
[Fact]
public void CreateActionModel_InheritedAttributeRoutes()
{
@@ -1719,6 +1791,34 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
+ private class RouteAndConstraintAttribute : Attribute, IActionConstraintMetadata, IRouteTemplateProvider
+ {
+ public RouteAndConstraintAttribute(string template)
+ {
+ Template = template;
+ }
+
+ public string Name { get; set; }
+
+ public int? Order { get; set; }
+
+ public string Template { get; private set; }
+ }
+
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
+ private class ConstraintAttribute : Attribute, IActionConstraintMetadata
+ {
+ }
+
+ private class MultipleRouteProviderOnActionController
+ {
+ [Constraint]
+ [RouteAndConstraint("R1")]
+ [RouteAndConstraint("R2")]
+ public void Edit() { }
+ }
+
private class TestApplicationModelProvider : DefaultApplicationModelProvider
{
public TestApplicationModelProvider()
@@ -1734,31 +1834,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
: base(Options.Create(options), modelMetadataProvider)
{
}
-
- public new ControllerModel CreateControllerModel(TypeInfo typeInfo)
- {
- return base.CreateControllerModel(typeInfo);
- }
-
- public new ActionModel CreateActionModel(TypeInfo typeInfo, MethodInfo methodInfo)
- {
- return base.CreateActionModel(typeInfo, methodInfo);
- }
-
- public new PropertyModel CreatePropertyModel(PropertyInfo propertyInfo)
- {
- return base.CreatePropertyModel(propertyInfo);
- }
-
- public new bool IsAction(TypeInfo typeInfo, MethodInfo methodInfo)
- {
- return base.IsAction(typeInfo, methodInfo);
- }
-
- public new ParameterModel CreateParameterModel(ParameterInfo parameterInfo)
- {
- return base.CreateParameterModel(parameterInfo);
- }
}
}
}
\ No newline at end of file
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/InferParameterBindingInfoConventionTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/InferParameterBindingInfoConventionTest.cs
index 8b82f3d6ad..0f6527f363 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/InferParameterBindingInfoConventionTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/InferParameterBindingInfoConventionTest.cs
@@ -9,7 +9,6 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/RouteTokenTransformerConventionTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/RouteTokenTransformerConventionTest.cs
index 52214026ef..1aa426bcd2 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/RouteTokenTransformerConventionTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModels/RouteTokenTransformerConventionTest.cs
@@ -3,11 +3,10 @@
using System;
using System.Reflection;
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Routing;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Test.ApplicationModels
+namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public class RouteTokenTransformerConventionTest
{
@@ -28,8 +27,7 @@ namespace Microsoft.AspNetCore.Mvc.Test.ApplicationModels
convention.Apply(model);
// Assert
- Assert.True(model.Properties.TryGetValue(typeof(IOutboundParameterTransformer), out var routeTokenTransformer));
- Assert.Equal(transformer, routeTokenTransformer);
+ Assert.Same(transformer, model.RouteParameterTransformer);
}
[Fact]
@@ -49,7 +47,7 @@ namespace Microsoft.AspNetCore.Mvc.Test.ApplicationModels
convention.Apply(model);
// Assert
- Assert.False(model.Properties.TryGetValue(typeof(IOutboundParameterTransformer), out _));
+ Assert.Null(model.RouteParameterTransformer);
}
private MethodInfo GetMethodInfo()
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/ApplicationAssembliesProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/ApplicationAssembliesProviderTest.cs
index c3f864b4d7..b7c040d42e 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/ApplicationAssembliesProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/ApplicationAssembliesProviderTest.cs
@@ -35,8 +35,8 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
// Arrange
var runtimeLibraries = new[]
{
- GetRuntimeLibrary("MyApp", "Microsoft.AspNetCore.All"),
- GetRuntimeLibrary("Microsoft.AspNetCore.All", "Microsoft.NETCore.App"),
+ GetRuntimeLibrary("MyApp", "Microsoft.AspNetCore.App"),
+ GetRuntimeLibrary("Microsoft.AspNetCore.App", "Microsoft.NETCore.App"),
GetRuntimeLibrary("Microsoft.NETCore.App"),
GetRuntimeLibrary("ClassLibrary"),
};
@@ -257,22 +257,22 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
public void GetCandidateLibraries_ReturnsRuntimeLibraries_IfCompileLibraryDependencyToMvcIsPresent()
{
// Arrange
- // When an app is running against Microsoft.AspNetCore.All shared runtime or if the DependencyContext is queried
+ // When an app is running against Microsoft.AspNetCore.App shared runtime or if the DependencyContext is queried
// from an app that's running on Microsoft.NETCore.App (e.g. in a unit testing scenario), the
// runtime library does not state that the app references Mvc whereas the compile library does. This test validates
// that we correctly recognize this scenario.
- var expected = GetRuntimeLibrary("MyApp", "Microsoft.AspNetCore.All");
+ var expected = GetRuntimeLibrary("MyApp", "Microsoft.AspNetCore.App");
var runtimeLibraries = new[]
{
expected,
- GetRuntimeLibrary("Microsoft.AspNetCore.All", "Microsoft.NETCore.App"),
+ GetRuntimeLibrary("Microsoft.AspNetCore.App", "Microsoft.NETCore.App"),
GetRuntimeLibrary("Microsoft.NETCore.App"),
};
var compileLibraries = new[]
{
- GetCompileLibrary("MyApp", "Microsoft.AspNetCore.All"),
- GetCompileLibrary("Microsoft.AspNetCore.All", "Microsoft.AspNetCore.Mvc", "Microsoft.NETCore.App"),
+ GetCompileLibrary("MyApp", "Microsoft.AspNetCore.App"),
+ GetCompileLibrary("Microsoft.AspNetCore.App", "Microsoft.AspNetCore.Mvc", "Microsoft.NETCore.App"),
GetCompileLibrary("Microsoft.AspNetCore.Mvc"),
GetCompileLibrary("Microsoft.NETCore.App"),
};
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Authorization/AuthorizeFilterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Authorization/AuthorizeFilterTest.cs
index fdde1514de..bff47d0533 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Authorization/AuthorizeFilterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Authorization/AuthorizeFilterTest.cs
@@ -236,6 +236,9 @@ namespace Microsoft.AspNetCore.Mvc.Authorization
GetPolicyCalls++;
return Task.FromResult(policyName == "true" ? _true : _false);
}
+
+ public Task GetRequiredPolicyAsync()
+ => Task.FromResult(null);
}
[Fact]
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Builder/MvcApplicationBuilderExtensionsTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Builder/MvcApplicationBuilderExtensionsTest.cs
index 3bd2cfa1f6..11e786561b 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Builder/MvcApplicationBuilderExtensionsTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Builder/MvcApplicationBuilderExtensionsTest.cs
@@ -7,9 +7,10 @@ using System.Diagnostics;
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder.Internal;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
using Moq;
using Xunit;
@@ -42,7 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Builder
{
// Arrange
var services = new ServiceCollection();
- services.AddSingleton(new DiagnosticListener("Microsoft.AspNetCore"));
+ services.AddSingleton(new DiagnosticListener("Microsoft.AspNetCore"));
services.AddLogging();
services.AddMvcCore(o => o.EnableEndpointRouting = false);
var serviceProvider = services.BuildServiceProvider();
@@ -56,12 +57,10 @@ namespace Microsoft.AspNetCore.Mvc.Core.Builder
template: "{controller=Home}/{action=Index}/{id?}");
});
- var mvcEndpointDataSource = appBuilder.ApplicationServices
- .GetRequiredService>()
- .OfType()
- .First();
+ var routeOptions = appBuilder.ApplicationServices
+ .GetRequiredService>();
- Assert.Empty(mvcEndpointDataSource.ConventionalEndpointInfos);
+ Assert.Empty(routeOptions.Value.EndpointDataSources);
}
[Fact]
@@ -69,7 +68,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Builder
{
// Arrange
var services = new ServiceCollection();
- services.AddSingleton(new DiagnosticListener("Microsoft.AspNetCore"));
+ services.AddSingleton(new DiagnosticListener("Microsoft.AspNetCore"));
services.AddLogging();
services.AddMvcCore(o => o.EnableEndpointRouting = true);
var serviceProvider = services.BuildServiceProvider();
@@ -83,10 +82,10 @@ namespace Microsoft.AspNetCore.Mvc.Core.Builder
template: "{controller=Home}/{action=Index}/{id?}");
});
- var mvcEndpointDataSource = appBuilder.ApplicationServices
- .GetRequiredService>()
- .OfType()
- .First();
+ var routeOptions = appBuilder.ApplicationServices
+ .GetRequiredService>();
+
+ var mvcEndpointDataSource = (MvcEndpointDataSource)Assert.Single(routeOptions.Value.EndpointDataSources, ds => ds is MvcEndpointDataSource);
var endpointInfo = Assert.Single(mvcEndpointDataSource.ConventionalEndpointInfos);
Assert.Equal("default", endpointInfo.Name);
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ConsumesAttributeTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ConsumesAttributeTests.cs
index 1ecf35fb8e..64b97cd1f8 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ConsumesAttributeTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ConsumesAttributeTests.cs
@@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Formatters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Routing;
using Microsoft.Net.Http.Headers;
@@ -429,7 +428,7 @@ namespace Microsoft.AspNetCore.Mvc
return httpContext;
}
- public interface ITestActionConsumeConstraint : IConsumesActionConstraint, IResourceFilter
+ internal interface ITestActionConsumeConstraint : IConsumesActionConstraint, IResourceFilter
{
}
}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ContentResultTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ContentResultTest.cs
index 6fd9433aa0..a9b044cb2c 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ContentResultTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ContentResultTest.cs
@@ -8,7 +8,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ControllerBaseTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ControllerBaseTest.cs
index 659260734a..89a38e587a 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ControllerBaseTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ControllerBaseTest.cs
@@ -10,9 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
using Microsoft.AspNetCore.Mvc.Formatters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Routing;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/ControllerActivatorProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/ControllerActivatorProviderTest.cs
index 0f224078b2..e6af45f3b7 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/ControllerActivatorProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/ControllerActivatorProviderTest.cs
@@ -4,7 +4,7 @@
using System;
using System.Reflection;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Xunit;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerBinderDelegateProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/ControllerBinderDelegateProviderTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerBinderDelegateProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/ControllerBinderDelegateProviderTest.cs
index a666abd913..e01d0d5880 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerBinderDelegateProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/ControllerBinderDelegateProviderTest.cs
@@ -24,7 +24,7 @@ using Microsoft.Extensions.Options;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Controllers
{
public class ControllerBinderDelegateProviderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/ControllerFactoryProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/ControllerFactoryProviderTest.cs
index 00f4492239..d8a7ed6c7f 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/ControllerFactoryProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/ControllerFactoryProviderTest.cs
@@ -4,7 +4,6 @@
using System;
using System.Linq;
using System.Reflection;
-using Microsoft.AspNetCore.Mvc.Internal;
using Moq;
using Xunit;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/DefaultControllerActivatorTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/DefaultControllerActivatorTest.cs
index 2e72325feb..01bbb8af06 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/DefaultControllerActivatorTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/DefaultControllerActivatorTest.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Reflection;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Routing;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/DefaultControllerFactoryTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/DefaultControllerFactoryTest.cs
index 3a705e334e..ec2770bb93 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/DefaultControllerFactoryTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Controllers/DefaultControllerFactoryTest.cs
@@ -4,7 +4,7 @@
using System;
using System.Reflection;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Moq;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedAtActionResultTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedAtActionResultTests.cs
index 5c21c139fc..a461f42d85 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedAtActionResultTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedAtActionResultTests.cs
@@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Testing;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedAtRouteResultTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedAtRouteResultTests.cs
index 9f19dc1794..9e7cf1df9f 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedAtRouteResultTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedAtRouteResultTests.cs
@@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedResultTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedResultTests.cs
index 84de33aed6..daa982e53f 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedResultTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/CreatedResultTests.cs
@@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ApiBehaviorOptionsSetupTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/ApiBehaviorOptionsSetupTest.cs
similarity index 90%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ApiBehaviorOptionsSetupTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/ApiBehaviorOptionsSetupTest.cs
index 4ae53cd4d7..4255b344ea 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ApiBehaviorOptionsSetupTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/ApiBehaviorOptionsSetupTest.cs
@@ -5,12 +5,12 @@ using System;
using System.Diagnostics;
using System.Linq;
using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Options;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.Extensions.DependencyInjection
{
public class ApiBehaviorOptionsSetupTest
{
@@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
// Arrange
var optionsSetup = new ApiBehaviorOptionsSetup(
NullLoggerFactory.Instance,
- Options.Create(new MvcCompatibilityOptions()));
+ Options.Options.Create(new MvcCompatibilityOptions()));
var options = new ApiBehaviorOptions();
// Act
@@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var expected = new[] { 400, 401, 403, 404, 406, 409, 415, 422, };
var optionsSetup = new ApiBehaviorOptionsSetup(
NullLoggerFactory.Instance,
- Options.Create(new MvcCompatibilityOptions()));
+ Options.Options.Create(new MvcCompatibilityOptions()));
var options = new ApiBehaviorOptions();
// Act
@@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
// Arrange
var optionsSetup = new ApiBehaviorOptionsSetup(
NullLoggerFactory.Instance,
- Options.Create(new MvcCompatibilityOptions { CompatibilityVersion = CompatibilityVersion.Latest }));
+ Options.Options.Create(new MvcCompatibilityOptions { CompatibilityVersion = CompatibilityVersion.Latest }));
var options = new ApiBehaviorOptions();
// Act
@@ -70,7 +70,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
// Arrange
var optionsSetup = new ApiBehaviorOptionsSetup(
NullLoggerFactory.Instance,
- Options.Create(new MvcCompatibilityOptions { CompatibilityVersion = CompatibilityVersion.Version_2_1 }));
+ Options.Options.Create(new MvcCompatibilityOptions { CompatibilityVersion = CompatibilityVersion.Version_2_1 }));
var options = new ApiBehaviorOptions();
// Act
@@ -87,7 +87,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
// Arrange
var optionsSetup = new ApiBehaviorOptionsSetup(
NullLoggerFactory.Instance,
- Options.Create(new MvcCompatibilityOptions { CompatibilityVersion = CompatibilityVersion.Latest }));
+ Options.Options.Create(new MvcCompatibilityOptions { CompatibilityVersion = CompatibilityVersion.Latest }));
var options = new ApiBehaviorOptions();
Func expected = _ => null;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/ApplicationModelConventionExtensionsTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/ApplicationModelConventionExtensionsTest.cs
index 51811324e8..5ef954003c 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/ApplicationModelConventionExtensionsTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/ApplicationModelConventionExtensionsTest.cs
@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
-using Microsoft.AspNetCore.Mvc.Internal;
using Xunit;
namespace Microsoft.Extensions.DependencyInjection
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcBuilderExtensionsTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcBuilderExtensionsTest.cs
index 9ef4358c3f..6d7fd73b51 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcBuilderExtensionsTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcBuilderExtensionsTest.cs
@@ -1,12 +1,10 @@
// 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 System.Reflection;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.MvcServiceCollectionExtensionsTestControllers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcCoreBuilderExtensionsTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcCoreBuilderExtensionsTest.cs
index 2311cb3987..1f37d86316 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcCoreBuilderExtensionsTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcCoreBuilderExtensionsTest.cs
@@ -4,7 +4,6 @@
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Moq;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcCoreServiceCollectionExtensionsTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcCoreServiceCollectionExtensionsTest.cs
index e4e56bebd2..e89e151509 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcCoreServiceCollectionExtensionsTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcCoreServiceCollectionExtensionsTest.cs
@@ -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.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
@@ -315,13 +314,6 @@ namespace Microsoft.AspNetCore.Mvc
typeof(ApiBehaviorApplicationModelProvider),
}
},
- {
- typeof(EndpointDataSource),
- new Type[]
- {
- typeof(MvcEndpointDataSource),
- }
- },
{
typeof(IStartupFilter),
new Type[]
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DisableRequestSizeLimitFilterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/DisableRequestSizeLimitFilterTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DisableRequestSizeLimitFilterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/DisableRequestSizeLimitFilterTest.cs
index 6e8907f1a5..0ea66617f8 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DisableRequestSizeLimitFilterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/DisableRequestSizeLimitFilterTest.cs
@@ -4,13 +4,12 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
public class DisableRequestSizeLimitFilterTest
{
@@ -147,4 +146,3 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
-
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/FilterFactoryTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/FilterFactoryTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/FilterFactoryTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/FilterFactoryTest.cs
index d382bd386e..366a59cb5b 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/FilterFactoryTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/FilterFactoryTest.cs
@@ -4,11 +4,10 @@
using System;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
public class FilterFactoryTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/FilterProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/FilterProviderTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/FilterProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/FilterProviderTest.cs
index 5d9876a3c4..8639542ab7 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/FilterProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/FilterProviderTest.cs
@@ -6,12 +6,11 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
public class DefaultFilterProviderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterAttributeTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterAttributeTest.cs
index bcfec63de6..801bcb3a8b 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterAttributeTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterAttributeTest.cs
@@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Builder.Internal;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
public class MiddlewareFilterAttributeTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MiddlewareFilterBuilderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterBuilderTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MiddlewareFilterBuilderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterBuilderTest.cs
index c9c30d2f85..2802d65512 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MiddlewareFilterBuilderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterBuilderTest.cs
@@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
public class MiddlewareFilterBuilderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MiddlewareFilterConfigurationProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterConfigurationProviderTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MiddlewareFilterConfigurationProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterConfigurationProviderTest.cs
index 694606d8ce..fb55e04bcd 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MiddlewareFilterConfigurationProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterConfigurationProviderTest.cs
@@ -9,7 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
public class MiddlewareFilterConfigurationProviderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MiddlewareFilterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MiddlewareFilterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterTest.cs
index 5edff31ab3..8d72ce9a36 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MiddlewareFilterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterTest.cs
@@ -13,7 +13,6 @@ using Microsoft.AspNetCore.Builder.Internal;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Controllers;
-using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Routing;
@@ -25,7 +24,7 @@ using Microsoft.Extensions.Options;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
public class MiddlewareFilterTest
{
@@ -277,14 +276,14 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var actionContext = new ActionContext(httpContext, new RouteData(), actionDescriptor);
- var diagnosticSource = new DiagnosticListener("Microsoft.AspNetCore");
- diagnosticSource.SubscribeWithAdapter(new TestDiagnosticListener());
+ var diagnosticListener = new DiagnosticListener("Microsoft.AspNetCore");
+ diagnosticListener.SubscribeWithAdapter(new TestDiagnosticListener());
var invoker = new TestControllerActionInvoker(
filters,
new MockControllerFactory(controller ?? this),
new NullLoggerFactory().CreateLogger(),
- diagnosticSource,
+ diagnosticListener,
new ActionResultTypeMapper(),
actionContext,
new List(),
@@ -389,14 +388,14 @@ namespace Microsoft.AspNetCore.Mvc.Internal
IFilterMetadata[] filters,
MockControllerFactory controllerFactory,
ILogger logger,
- DiagnosticSource diagnosticSource,
+ DiagnosticListener diagnosticListener,
IActionResultTypeMapper mapper,
ActionContext actionContext,
IReadOnlyList valueProviderFactories,
int maxAllowedErrorsInModelState)
: base(
logger,
- diagnosticSource,
+ diagnosticListener,
mapper,
CreateControllerContext(actionContext, valueProviderFactories, maxAllowedErrorsInModelState),
CreateCacheEntry((ControllerActionDescriptor)actionContext.ActionDescriptor, controllerFactory),
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/RequestFormLimitsFilterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/RequestFormLimitsFilterTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/RequestFormLimitsFilterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/RequestFormLimitsFilterTest.cs
index 7b1234092b..9d7b467f67 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/RequestFormLimitsFilterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/RequestFormLimitsFilterTest.cs
@@ -4,14 +4,13 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
public class RequestFormLimitsFilterTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/RequestSizeLimitFilterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/RequestSizeLimitFilterTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/RequestSizeLimitFilterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/RequestSizeLimitFilterTest.cs
index 80be3c2e9a..3d3ec36ed5 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/RequestSizeLimitFilterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/RequestSizeLimitFilterTest.cs
@@ -4,13 +4,12 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
public class RequestSizeLimitFilterTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ResponseCacheFilterExecutorTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/ResponseCacheFilterExecutorTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ResponseCacheFilterExecutorTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/ResponseCacheFilterExecutorTest.cs
index 93969159db..2ed860f0a8 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ResponseCacheFilterExecutorTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/ResponseCacheFilterExecutorTest.cs
@@ -5,14 +5,12 @@ using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.ResponseCaching;
using Microsoft.AspNetCore.Routing;
using Microsoft.Net.Http.Headers;
-using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Filters
{
public class ResponseCacheFilterExecutorTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AcceptHeaderParserTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/AcceptHeaderParserTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AcceptHeaderParserTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/AcceptHeaderParserTest.cs
index 9953e32ec2..9c2bd05c5c 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AcceptHeaderParserTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/AcceptHeaderParserTest.cs
@@ -1,13 +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 System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Primitives;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
public class AcceptHeaderParserTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ResponseContentTypeHelperTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/ResponseContentTypeHelperTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ResponseContentTypeHelperTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/ResponseContentTypeHelperTest.cs
index d7898089b8..6895f55288 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ResponseContentTypeHelperTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/ResponseContentTypeHelperTest.cs
@@ -5,7 +5,7 @@ using System.Text;
using Microsoft.Net.Http.Headers;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
public class ResponseContentTypeHelperTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/HttpNotFoundObjectResultTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/HttpNotFoundObjectResultTest.cs
index 6168694207..9bd11f8ab0 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/HttpNotFoundObjectResultTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/HttpNotFoundObjectResultTest.cs
@@ -8,7 +8,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/HttpOkObjectResultTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/HttpOkObjectResultTest.cs
index db4d71f11f..a6e6a4f99c 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/HttpOkObjectResultTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/HttpOkObjectResultTest.cs
@@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionMethodExecutorTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionMethodExecutorTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionMethodExecutorTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionMethodExecutorTest.cs
index 8e3f8c37e0..aa40fb873a 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionMethodExecutorTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionMethodExecutorTest.cs
@@ -4,12 +4,10 @@
using System;
using System.Reflection;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Internal;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Core.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class ActionMethodExecutorTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionResultTypeMapperTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionResultTypeMapperTest.cs
similarity index 95%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionResultTypeMapperTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionResultTypeMapperTest.cs
index 3b4d3a0f4d..a21b509be2 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionResultTypeMapperTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionResultTypeMapperTest.cs
@@ -1,11 +1,10 @@
// 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.Infrastructure;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class ActionResultTypeMapperTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionSelectorTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionSelectorTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionSelectorTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionSelectorTest.cs
index 214c6eebb7..8c508cb3a6 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionSelectorTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionSelectorTest.cs
@@ -8,9 +8,9 @@ using System.Reflection;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
+using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
@@ -1009,8 +1009,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
var provider = new ControllerActionDescriptorProvider(
manager,
- new[] { modelProvider },
- options);
+ new ApplicationModelFactory(new[] { modelProvider }, options));
return provider;
}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionInvokerCacheTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ControllerActionInvokerCacheTest.cs
similarity index 97%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionInvokerCacheTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ControllerActionInvokerCacheTest.cs
index 247206469f..3b914cc092 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionInvokerCacheTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ControllerActionInvokerCacheTest.cs
@@ -7,17 +7,15 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Routing;
-using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class ControllerActionInvokerCacheTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionInvokerTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ControllerActionInvokerTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionInvokerTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ControllerActionInvokerTest.cs
index 74090a932c..03e70b7f9e 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionInvokerTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ControllerActionInvokerTest.cs
@@ -14,7 +14,6 @@ using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Formatters;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Testing;
@@ -22,12 +21,11 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Logging.Testing;
using Microsoft.Extensions.Options;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class ControllerActionInvokerTest : CommonResourceInvokerTest
{
@@ -1454,7 +1452,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
#endregion
- protected override ResourceInvoker CreateInvoker(
+ protected override IActionInvoker CreateInvoker(
IFilterMetadata[] filters,
Exception exception = null,
IActionResult result = null,
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/NonDisposableStreamTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/NonDisposableStreamTest.cs
similarity index 95%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/NonDisposableStreamTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/NonDisposableStreamTest.cs
index 0eb5d7014f..942119d8d1 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/NonDisposableStreamTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/NonDisposableStreamTest.cs
@@ -3,9 +3,10 @@
using System.IO;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class NonDisposableStreamTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ParameterDefaultValuesTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ParameterDefaultValuesTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ParameterDefaultValuesTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ParameterDefaultValuesTest.cs
index 0b9b2f7880..befe46a23f 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ParameterDefaultValuesTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ParameterDefaultValuesTest.cs
@@ -5,7 +5,7 @@ using System;
using System.ComponentModel;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class ParameterDefaultValuesTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj
index f030903427..dbb3c40b3c 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj
@@ -1,7 +1,7 @@
- $(StandardTestTfms)
+ netcoreapp3.0
true
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/ArrayModelBinderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/ArrayModelBinderTest.cs
index d3efdd8775..2e5143fd7f 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/ArrayModelBinderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/ArrayModelBinderTest.cs
@@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.Extensions.Logging.Abstractions;
using Xunit;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/BinderTypeModelBinderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/BinderTypeModelBinderTest.cs
index 2dee3bbf02..5f9110b769 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/BinderTypeModelBinderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/BinderTypeModelBinderTest.cs
@@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
using Moq;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/CollectionModelBinderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/CollectionModelBinderTest.cs
index bc9cdf1981..341947bf35 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/CollectionModelBinderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/CollectionModelBinderTest.cs
@@ -8,8 +8,6 @@ using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Logging.Abstractions;
using Xunit;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/ComplexTypeModelBinderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/ComplexTypeModelBinderTest.cs
index 32314d7306..b5f38b9322 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/ComplexTypeModelBinderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/ComplexTypeModelBinderTest.cs
@@ -10,7 +10,6 @@ using System.Reflection;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/DictionaryModelBinderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/DictionaryModelBinderTest.cs
index db059c0090..98f50a11bf 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/DictionaryModelBinderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/DictionaryModelBinderTest.cs
@@ -8,7 +8,6 @@ using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Primitives;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/HeaderModelBinderTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/HeaderModelBinderTests.cs
index 2b750fd67f..4b4c019ea6 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/HeaderModelBinderTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Binders/HeaderModelBinderTests.cs
@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/CompositeValueProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/CompositeValueProviderTest.cs
index 0da5681ef6..66d87b5f06 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/CompositeValueProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/CompositeValueProviderTest.cs
@@ -5,7 +5,8 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Http.Internal;
using Microsoft.Extensions.Primitives;
using Moq;
using Xunit;
@@ -39,9 +40,8 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
Dictionary values,
CultureInfo culture)
{
- var emptyValueProvider =
- new JQueryFormValueProvider(bindingSource, new Dictionary(), culture);
- var valueProvider = new JQueryFormValueProvider(bindingSource, values, culture);
+ var emptyValueProvider = new QueryStringValueProvider(bindingSource, new QueryCollection(), culture);
+ var valueProvider = new FormValueProvider(bindingSource, new FormCollection(values), culture);
return new CompositeValueProvider() { emptyValueProvider, valueProvider };
}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ElementalValueProviderTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ElementalValueProviderTests.cs
similarity index 92%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ElementalValueProviderTests.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ElementalValueProviderTests.cs
index 9b069dae76..c2c6418273 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ElementalValueProviderTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ElementalValueProviderTests.cs
@@ -1,13 +1,10 @@
// 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.Globalization;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
public class ElementalValueProviderTest
{
@@ -16,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
[InlineData("MyProperty.SubProperty", "MyProperty")]
[InlineData("MyProperty[0]", "MyProperty")]
public void ContainsPrefix_ReturnsTrue_IfElementNameStartsWithPrefix(
- string elementName,
+ string elementName,
string prefix)
{
// Arrange
@@ -38,7 +35,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
[InlineData("MyPropertyTest", "MyProperty")]
[InlineData("Random", "MyProperty")]
public void ContainsPrefix_ReturnsFalse_IfElementCannotSpecifyValuesForPrefix(
- string elementName,
+ string elementName,
string prefix)
{
// Arrange
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/EnumerableValueProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/EnumerableValueProviderTest.cs
index 19c3d37407..6d586a80d9 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/EnumerableValueProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/EnumerableValueProviderTest.cs
@@ -235,6 +235,23 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
Assert.Equal(ValueProviderResult.None, result);
}
+ [Fact]
+ public virtual void GetValue_EmptyKey()
+ {
+ // Arrange
+ var store = new Dictionary(BackingStore)
+ {
+ { string.Empty, "some-value" },
+ };
+ var valueProvider = GetEnumerableValueProvider(BindingSource.Query, store, culture: null);
+
+ // Act
+ var result = valueProvider.GetValue(string.Empty);
+
+ // Assert
+ Assert.Equal(ValueProviderResult.None, result);
+ }
+
[Fact]
public virtual void FilterInclude()
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderTest.cs
index 608180ac3b..4676530e5f 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderTest.cs
@@ -31,5 +31,22 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
// Assert
Assert.Null(result);
}
+
+ [Fact]
+ public override void GetValue_EmptyKey()
+ {
+ // Arrange
+ var store = new Dictionary(BackingStore)
+ {
+ { string.Empty, "some-value" },
+ };
+ var valueProvider = GetEnumerableValueProvider(BindingSource.Query, store, culture: null);
+
+ // Act
+ var result = valueProvider.GetValue(string.Empty);
+
+ // Assert
+ Assert.Equal("some-value", (string)result);
+ }
}
}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/JQueryQueryStringValueProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/JQueryQueryStringValueProviderTest.cs
index 830ceac1ab..8d9b795769 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/JQueryQueryStringValueProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/JQueryQueryStringValueProviderTest.cs
@@ -34,5 +34,22 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
// Assert
Assert.Null(result);
}
+
+ [Fact]
+ public override void GetValue_EmptyKey()
+ {
+ // Arrange
+ var store = new Dictionary(BackingStore)
+ {
+ { string.Empty, "some-value" },
+ };
+ var valueProvider = GetEnumerableValueProvider(BindingSource.Query, store, culture: null);
+
+ // Act
+ var result = valueProvider.GetValue(string.Empty);
+
+ // Assert
+ Assert.Equal("some-value", (string)result);
+ }
}
}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultBindingMetadataProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/DefaultBindingMetadataProviderTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultBindingMetadataProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/DefaultBindingMetadataProviderTest.cs
index 7464e6203a..727cd31705 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultBindingMetadataProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/DefaultBindingMetadataProviderTest.cs
@@ -3,12 +3,10 @@
using System;
using System.Reflection;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
{
public class DefaultModelMetadataBindingDetailsProviderTest
{
@@ -700,7 +698,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
.GetMethod(nameof(ParameterInfos.Method))
.GetParameters()[0];
}
-
+
private class CustomAttribute : Attribute
{
public string Identifier { get; set; }
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/DefaultModelMetadataTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/DefaultModelMetadataTest.cs
index 3352890707..cace016898 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/DefaultModelMetadataTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/DefaultModelMetadataTest.cs
@@ -8,7 +8,6 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Xml;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Moq;
using Xunit;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/DefaultValidationMetadataProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/DefaultValidationMetadataProviderTest.cs
index d7299a1a3b..4c1c73544f 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/DefaultValidationMetadataProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/DefaultValidationMetadataProviderTest.cs
@@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Xunit;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/EmptyCompositeMetadataDetailsProvider.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/EmptyCompositeMetadataDetailsProvider.cs
index 394a55c6fa..84ac75ffc0 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/EmptyCompositeMetadataDetailsProvider.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/EmptyCompositeMetadataDetailsProvider.cs
@@ -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.Internal;
-
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
{
- public class EmptyCompositeMetadataDetailsProvider : DefaultCompositeMetadataDetailsProvider
+ internal class EmptyCompositeMetadataDetailsProvider : DefaultCompositeMetadataDetailsProvider
{
public EmptyCompositeMetadataDetailsProvider()
: base(new IMetadataDetailsProvider[0])
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBinderFactoryTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBinderFactoryTest.cs
index 58a2d9a841..e069f67601 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBinderFactoryTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBinderFactoryTest.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.Extensions.DependencyInjection;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBindingHelperTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBindingHelperTest.cs
index eab8c6a860..6f858059ff 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBindingHelperTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBindingHelperTest.cs
@@ -10,10 +10,7 @@ using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ParameterBinderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ParameterBinderTest.cs
index 9464e6def7..0307a9c306 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ParameterBinderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ParameterBinderTest.cs
@@ -12,8 +12,6 @@ using Microsoft.AspNetCore.JsonPatch;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Testing;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/PrefixContainerTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/PrefixContainerTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/PrefixContainerTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/PrefixContainerTest.cs
index 91d925bdab..78ce08be61 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/PrefixContainerTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/PrefixContainerTest.cs
@@ -5,7 +5,7 @@ using System;
using System.Linq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
public class PrefixContainerTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ReferenceEqualityComparerTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ReferenceEqualityComparerTest.cs
similarity index 97%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ReferenceEqualityComparerTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ReferenceEqualityComparerTest.cs
index 956e34ad4c..6343865578 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ReferenceEqualityComparerTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ReferenceEqualityComparerTest.cs
@@ -4,7 +4,7 @@
using System;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
public class ReferenceEqualityComparerTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/RouteValueProviderTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/RouteValueProviderTests.cs
index a013595eac..631a6a4f94 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/RouteValueProviderTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/RouteValueProviderTests.cs
@@ -73,9 +73,8 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
{ "test-key", new DateTimeOffset(2018, 10, 31, 7, 37, 38, TimeSpan.FromHours(-7)) },
});
var provider = new RouteValueProvider(BindingSource.Query, values, new CultureInfo("de-CH"));
-
- // de-CH culture is slightly different on Windows versus other platforms.
- var expected = TestPlatformHelper.IsWindows ? "31.10.2018 07:37:38 -07:00" : "31.10.18 07:37:38 -07:00";
+ // The formatting was changed in netcoreapp3.0 to be consistent across platforms.
+ var expected = "31.10.2018 07:37:38 -07:00";
// Act
var result = provider.GetValue("test-key");
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/StubModelBinder.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/StubModelBinder.cs
index 790780b0e9..b0d19eaa56 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/StubModelBinder.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/StubModelBinder.cs
@@ -4,7 +4,6 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ClientValidatorCacheTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ClientValidatorCacheTest.cs
similarity index 95%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ClientValidatorCacheTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ClientValidatorCacheTest.cs
index 642eb82ea0..bb9c6f5c0c 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ClientValidatorCacheTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ClientValidatorCacheTest.cs
@@ -4,12 +4,9 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
public class ClientValidatorCacheTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultCollectionValidationStrategyTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultCollectionValidationStrategyTest.cs
similarity index 96%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultCollectionValidationStrategyTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultCollectionValidationStrategyTest.cs
index 30f964b93d..ee0eb39de6 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultCollectionValidationStrategyTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultCollectionValidationStrategyTest.cs
@@ -5,11 +5,9 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
public class DefaultCollectionValidationStrategyTest
{
@@ -28,7 +26,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
// Assert
Assert.Collection(
BufferEntries(enumerator).OrderBy(e => e.Key),
- e =>
+ e =>
{
Assert.Equal("prefix[0]", e.Key);
Assert.Equal(2, e.Model);
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultComplexObjectValidationStrategyTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultComplexObjectValidationStrategyTest.cs
similarity index 97%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultComplexObjectValidationStrategyTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultComplexObjectValidationStrategyTest.cs
index 9ed691d26d..ed4cb6ad42 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultComplexObjectValidationStrategyTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultComplexObjectValidationStrategyTest.cs
@@ -4,11 +4,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
public class DefaultComplexObjectValidationStrategyTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultModelValidatorProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultModelValidatorProviderTest.cs
index bc8e9d4aa4..f23d6f4bea 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultModelValidatorProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultModelValidatorProviderTest.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
+using Microsoft.AspNetCore.Mvc.DataAnnotations;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultObjectValidatorTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultObjectValidatorTests.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultObjectValidatorTests.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultObjectValidatorTests.cs
index 83cf64890a..bbf040d4ea 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultObjectValidatorTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/DefaultObjectValidatorTests.cs
@@ -10,16 +10,14 @@ using System.Reflection;
using System.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
public class DefaultObjectValidatorTests
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ExplicitIndexCollectionValidationStrategyTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ExplicitIndexCollectionValidationStrategyTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ExplicitIndexCollectionValidationStrategyTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ExplicitIndexCollectionValidationStrategyTest.cs
index cf1fecf8f3..8d09ea153a 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ExplicitIndexCollectionValidationStrategyTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ExplicitIndexCollectionValidationStrategyTest.cs
@@ -5,12 +5,10 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
public class ExplicitIndexCollectionValidationStrategyTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ShortFormDictionaryValidationStrategyTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ShortFormDictionaryValidationStrategyTest.cs
similarity index 97%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ShortFormDictionaryValidationStrategyTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ShortFormDictionaryValidationStrategyTest.cs
index 9ef857f0a1..c002652857 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ShortFormDictionaryValidationStrategyTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ShortFormDictionaryValidationStrategyTest.cs
@@ -3,11 +3,9 @@
using System.Collections.Generic;
using System.Linq;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
public class ShortFormDictionaryValidationStrategyTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Internal/ValidationStackTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ValidationStackTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Internal/ValidationStackTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ValidationStackTest.cs
index b68337cea8..64c4201855 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Internal/ValidationStackTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ValidationStackTest.cs
@@ -4,7 +4,7 @@
using System.Collections.Generic;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.ModelBinding.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
public class ValidationStackTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ValidatorCacheTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ValidatorCacheTest.cs
similarity index 95%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ValidatorCacheTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ValidatorCacheTest.cs
index 57bf369b9b..cabd56b0d0 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ValidatorCacheTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ValidatorCacheTest.cs
@@ -4,12 +4,9 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
public class ValidatorCacheTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MvcCoreLoggerExtensionsTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/MvcCoreLoggerExtensionsTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MvcCoreLoggerExtensionsTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/MvcCoreLoggerExtensionsTest.cs
index 2b56c00572..ae6987a4c4 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MvcCoreLoggerExtensionsTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/MvcCoreLoggerExtensionsTest.cs
@@ -6,7 +6,7 @@ using Microsoft.Extensions.Logging.Testing;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc
{
public class MvcCoreLoggerExtensionsTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ProducesAttributeTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ProducesAttributeTests.cs
index 4c3e9ae7a3..758b965f04 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ProducesAttributeTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ProducesAttributeTests.cs
@@ -7,13 +7,13 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Formatters.Internal;
+using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Primitives;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Test
+namespace Microsoft.AspNetCore.Mvc
{
public class ProducesAttributeTests
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToActionResultTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToActionResultTest.cs
index 28a5976c9b..40e70c447a 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToActionResultTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToActionResultTest.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
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.Testing;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToRouteResultTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToRouteResultTest.cs
index 6b0de7b699..f747a2ba53 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToRouteResultTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToRouteResultTest.cs
@@ -7,7 +7,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
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.Testing;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ResponseCacheAttributeTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ResponseCacheAttributeTest.cs
index c8d3921444..242af7b3eb 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ResponseCacheAttributeTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/ResponseCacheAttributeTest.cs
@@ -7,7 +7,6 @@ using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.ResponseCaching;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Logging;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRouteTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRouteTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRouteTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRouteTest.cs
index a11448fe7e..bb069a6c78 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRouteTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRouteTest.cs
@@ -8,7 +8,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Template;
using Microsoft.AspNetCore.Routing.Tree;
@@ -19,7 +18,7 @@ using Microsoft.Extensions.ObjectPool;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
public class AttributeRouteTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRoutingTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRoutingTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRoutingTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRoutingTest.cs
index 4c475cadad..692d63743a 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRoutingTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRoutingTest.cs
@@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
@@ -19,7 +18,7 @@ using Microsoft.Extensions.Options;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
public class AttributeRoutingTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/EndpointRoutingUrlHelperTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/EndpointRoutingUrlHelperTest.cs
index facb4e07e1..d6931df173 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/EndpointRoutingUrlHelperTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/EndpointRoutingUrlHelperTest.cs
@@ -142,12 +142,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
string template)
{
var endpoints = GetDefaultEndpoints();
- endpoints.Add(new RouteEndpoint(
- httpContext => Task.CompletedTask,
- RoutePatternFactory.Parse(template),
- 0,
- EndpointMetadataCollection.Empty,
- null));
+ endpoints.Add(CreateEndpoint(template, routeName: routeName));
return CreateUrlHelper(endpoints, appRoot, host, protocol);
}
@@ -181,7 +176,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
string template,
object defaults)
{
- var endpoint = GetEndpoint(routeName, template, new RouteValueDictionary(defaults));
+ var endpoint = CreateEndpoint(template, new RouteValueDictionary(defaults), routeName: routeName);
var services = CreateServices(new[] { endpoint });
var httpContext = CreateHttpContext(services, appRoot: "", host: null, protocol: null);
var actionContext = CreateActionContext(httpContext);
@@ -262,13 +257,6 @@ namespace Microsoft.AspNetCore.Mvc.Routing
requiredValues: new { controller = "home", action = "contact" },
order: 8,
routeName: "namedroute"));
- endpoints.Add(
- CreateEndpoint(
- "any/url",
- defaults: new { },
- requiredValues: new { },
- order: 9,
- routeName: "MyRouteName"));
endpoints.Add(
CreateEndpoint(
"api/orders/{id}",
@@ -315,15 +303,5 @@ namespace Microsoft.AspNetCore.Mvc.Routing
services.TryAddSingleton();
return services.BuildServiceProvider();
}
-
- private RouteEndpoint GetEndpoint(string name, string template, RouteValueDictionary defaults)
- {
- return new RouteEndpoint(
- c => Task.CompletedTask,
- RoutePatternFactory.Parse(template, defaults, parameterPolicies: null),
- 0,
- EndpointMetadataCollection.Empty,
- null);
- }
}
}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/KnownRouteValueConstraintTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/KnownRouteValueConstraintTests.cs
index 103b4ad14b..92bd76ae02 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/KnownRouteValueConstraintTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/KnownRouteValueConstraintTests.cs
@@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MvcEndpointDataSourceTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/MvcEndpointDataSourceTests.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MvcEndpointDataSourceTests.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/MvcEndpointDataSourceTests.cs
index a3e0ebe5c3..3fcbcc9d1b 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MvcEndpointDataSourceTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/MvcEndpointDataSourceTests.cs
@@ -12,16 +12,13 @@ using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
-using Microsoft.AspNetCore.Routing.Matching;
using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
public class MvcEndpointDataSourceTests
{
@@ -760,7 +757,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var dataSource = CreateMvcEndpointDataSource(actionDescriptorCollection);
dataSource.ConventionalEndpointInfos.Add(
CreateEndpointInfo(
- string.Empty,
+ string.Empty,
"{controller=Home}/{action=Index}/{subscription=general}",
defaults: new RouteValueDictionary(new { subarea = "test", })));
@@ -1279,7 +1276,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var routeValuesAddress = matcherEndpoint.Metadata.GetMetadata();
Assert.Equal("TESTACTION", routeValuesAddress.RequiredValues["action"]);
-
+
},
(ep) =>
{
@@ -1359,6 +1356,12 @@ namespace Microsoft.AspNetCore.Mvc.Internal
mvcEndpointInvokerFactory ?? new MvcEndpointInvokerFactory(new ActionInvokerFactory(Array.Empty())),
serviceProvider.GetRequiredService());
+ var defaultEndpointConventionBuilder = new DefaultEndpointConventionBuilder();
+ dataSource.AttributeRoutingConventionResolvers.Add((actionDescriptor) =>
+ {
+ return defaultEndpointConventionBuilder;
+ });
+
return dataSource;
}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/MvcRouteHandlerTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/MvcRouteHandlerTests.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/MvcRouteHandlerTests.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/MvcRouteHandlerTests.cs
index 0efa991841..b13958aa0a 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/MvcRouteHandlerTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/MvcRouteHandlerTests.cs
@@ -6,7 +6,7 @@ using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
@@ -14,7 +14,7 @@ using Microsoft.Extensions.Logging.Testing;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Infrastructure
+namespace Microsoft.AspNetCore.Mvc.Routing
{
public class MvcRouteHandlerTests
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/RoutePatternWriterTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/RoutePatternWriterTests.cs
similarity index 92%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/RoutePatternWriterTests.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/RoutePatternWriterTests.cs
index c403213b72..b7c1a9213b 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/RoutePatternWriterTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/RoutePatternWriterTests.cs
@@ -2,11 +2,10 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Text;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing.Patterns;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Core.Test.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
public class RoutePatternWriterTests
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ViewEnginePathTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/ViewEnginePathTest.cs
similarity index 97%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ViewEnginePathTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/ViewEnginePathTest.cs
index e76e274b82..cb95480328 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ViewEnginePathTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/ViewEnginePathTest.cs
@@ -3,7 +3,7 @@
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Internal
+namespace Microsoft.AspNetCore.Mvc.Routing
{
public class ViewEnginePathTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/CommonResourceInvokerTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/CommonResourceInvokerTest.cs
index ed4e80c7ff..ae73ee2621 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/CommonResourceInvokerTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/CommonResourceInvokerTest.cs
@@ -4,8 +4,8 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Testing;
using Moq;
@@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc
// Intentionally choosing an uncommon exception type.
protected static readonly Exception Exception = new DivideByZeroException();
- protected ResourceInvoker CreateInvoker(
+ protected IActionInvoker CreateInvoker(
IFilterMetadata filter,
Exception exception = null,
IActionResult result = null,
@@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Mvc
return CreateInvoker(new IFilterMetadata[] { filter }, exception, result, valueProviderFactories);
}
- protected abstract ResourceInvoker CreateInvoker(
+ protected abstract IActionInvoker CreateInvoker(
IFilterMetadata[] filters,
Exception exception = null,
IActionResult result = null,
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/Microsoft.AspNetCore.Mvc.Core.TestCommon.csproj b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/Microsoft.AspNetCore.Mvc.Core.TestCommon.csproj
index 053be86a52..0e56ea905e 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/Microsoft.AspNetCore.Mvc.Core.TestCommon.csproj
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/Microsoft.AspNetCore.Mvc.Core.TestCommon.csproj
@@ -1,7 +1,7 @@
- $(StandardTestTfms)
+ netcoreapp3.0
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/SimpleValueProviderFactory.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/SimpleValueProviderFactory.cs
index d6a1ac1d27..efe8933bfb 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/SimpleValueProviderFactory.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/SimpleValueProviderFactory.cs
@@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Internal;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestClientModelValidatorProvider.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestClientModelValidatorProvider.cs
index b466463027..366a791f1c 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestClientModelValidatorProvider.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestClientModelValidatorProvider.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelBinderFactory.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelBinderFactory.cs
index 87ed105988..c54bf69118 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelBinderFactory.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelBinderFactory.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelMetadataProvider.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelMetadataProvider.cs
index 684875d565..d72bc80148 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelMetadataProvider.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelMetadataProvider.cs
@@ -5,8 +5,6 @@ using System;
using System.Collections.Generic;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Localization;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/Internal/CorsApplicationModelProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/CorsApplicationModelProviderTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/Internal/CorsApplicationModelProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/CorsApplicationModelProviderTest.cs
index 4543e2e8cd..6018faa7da 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/Internal/CorsApplicationModelProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/CorsApplicationModelProviderTest.cs
@@ -7,9 +7,9 @@ using System.Reflection;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Cors.Infrastructure;
+using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Logging;
@@ -17,7 +17,7 @@ using Microsoft.Extensions.Options;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Cors.Internal
+namespace Microsoft.AspNetCore.Mvc.Cors
{
public class CorsApplicationModelProviderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/Internal/CorsHttpMethodActionConstraintTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/CorsHttpMethodActionConstraintTest.cs
similarity index 97%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/Internal/CorsHttpMethodActionConstraintTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/CorsHttpMethodActionConstraintTest.cs
index b8ba11f04f..83a0407e91 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/Internal/CorsHttpMethodActionConstraintTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/CorsHttpMethodActionConstraintTest.cs
@@ -5,12 +5,11 @@ using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Primitives;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Cors.Internal
+namespace Microsoft.AspNetCore.Mvc.Cors
{
public class CorsHttpMethodActionConstraintTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/DisableCorsAuthorizationFilterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/DisableCorsAuthorizationFilterTest.cs
index 5584abad3b..3e4045a8df 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/DisableCorsAuthorizationFilterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/DisableCorsAuthorizationFilterTest.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Cors.Infrastructure;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.Cors.Internal;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
using Xunit;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj
index 59269389e9..5ec87d03b4 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj
@@ -1,7 +1,7 @@
- $(StandardTestTfms)
+ netcoreapp3.0
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/CompareAttributeAdapterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/CompareAttributeAdapterTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/CompareAttributeAdapterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/CompareAttributeAdapterTest.cs
index ab3c4d0b5d..5750769245 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/CompareAttributeAdapterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/CompareAttributeAdapterTest.cs
@@ -11,7 +11,7 @@ using Microsoft.Extensions.Localization;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class CompareAttributeAdapterTest
{
@@ -254,4 +254,4 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
public string OtherProperty { get; set; }
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsClientModelValidatorProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsClientModelValidatorProviderTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsClientModelValidatorProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsClientModelValidatorProviderTest.cs
index a5b00aba19..b59bc73e32 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsClientModelValidatorProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsClientModelValidatorProviderTest.cs
@@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Options;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class DataAnnotationsClientModelValidatorProviderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsMetadataProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsMetadataProviderTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsMetadataProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsMetadataProviderTest.cs
index 0f18010965..1938bae7d0 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsMetadataProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsMetadataProviderTest.cs
@@ -15,7 +15,7 @@ using Microsoft.Extensions.Options;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public enum TestEnum
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsModelValidatorProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsModelValidatorProviderTest.cs
index 4889e7c4da..a444011ccf 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsModelValidatorProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsModelValidatorProviderTest.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.Options;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsModelValidatorTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsModelValidatorTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsModelValidatorTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsModelValidatorTest.cs
index b67c769f57..db454e90e8 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsModelValidatorTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataAnnotationsModelValidatorTest.cs
@@ -12,7 +12,7 @@ using Microsoft.Extensions.Localization;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class DataAnnotationsModelValidatorTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataMemberRequiredBindingMetadataProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataMemberRequiredBindingMetadataProviderTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataMemberRequiredBindingMetadataProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataMemberRequiredBindingMetadataProviderTest.cs
index 499808aa94..728e559131 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataMemberRequiredBindingMetadataProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataMemberRequiredBindingMetadataProviderTest.cs
@@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class DataMemberRequiredBindingMetadataProviderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataTypeClientModelValidatorProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataTypeClientModelValidatorProviderTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataTypeClientModelValidatorProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataTypeClientModelValidatorProviderTest.cs
index 6d606bb739..2eb4483b9e 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataTypeClientModelValidatorProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DataTypeClientModelValidatorProviderTest.cs
@@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class DataTypeClientModelValidatorProviderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DefaultModelClientValidatorProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DefaultModelClientValidatorProviderTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DefaultModelClientValidatorProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DefaultModelClientValidatorProviderTest.cs
index 5ca1d5b1f5..a6550a6719 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DefaultModelClientValidatorProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/DefaultModelClientValidatorProviderTest.cs
@@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
// Integration tests for the default configuration of ModelMetadata and Validation providers
public class DefaultModelClientValidatorProviderTest
@@ -273,4 +273,4 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
public string Name { get; set; }
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/FileExtensionsAttributeAdapterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/FileExtensionsAttributeAdapterTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/FileExtensionsAttributeAdapterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/FileExtensionsAttributeAdapterTest.cs
index 0bf66c965c..a30cd6cf10 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/FileExtensionsAttributeAdapterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/FileExtensionsAttributeAdapterTest.cs
@@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
+using Microsoft.AspNetCore.Mvc.DataAnnotations;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.Localization;
using Moq;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MaxLengthAttributeAdapterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/MaxLengthAttributeAdapterTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MaxLengthAttributeAdapterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/MaxLengthAttributeAdapterTest.cs
index b20d0a4518..03498dee57 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MaxLengthAttributeAdapterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/MaxLengthAttributeAdapterTest.cs
@@ -10,7 +10,7 @@ using Microsoft.Extensions.Localization;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class MaxLengthAttributeAdapterTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj
index 14f4f05b2f..8c9aa34447 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj
@@ -1,7 +1,7 @@
- $(StandardTestTfms)
+ netcoreapp3.0
@@ -9,5 +9,4 @@
-
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MinLengthAttributeAdapterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/MinLengthAttributeAdapterTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MinLengthAttributeAdapterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/MinLengthAttributeAdapterTest.cs
index a559e00e3c..3aaba29f55 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MinLengthAttributeAdapterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/MinLengthAttributeAdapterTest.cs
@@ -10,7 +10,7 @@ using Microsoft.Extensions.Localization;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class MinLengthAttributeAdapterTest
{
@@ -133,4 +133,4 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
kvp => { Assert.Equal("data-val-minlength-min", kvp.Key); Assert.Equal("original", kvp.Value); });
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ModelMetadataProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ModelMetadataProviderTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ModelMetadataProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ModelMetadataProviderTest.cs
index 4002e30c99..f4c1edbd99 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ModelMetadataProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ModelMetadataProviderTest.cs
@@ -6,14 +6,13 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
-using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.Options;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
// Integration tests for the default provider configuration.
public class ModelMetadataProviderTest
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ModelValidationResultComparer.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ModelValidationResultComparer.cs
similarity index 95%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ModelValidationResultComparer.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ModelValidationResultComparer.cs
index aafd2d3e60..12e5f1459a 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ModelValidationResultComparer.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ModelValidationResultComparer.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class ModelValidationResultComparer : IEqualityComparer
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MvcDataAnnotationsMvcOptionsSetup.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/MvcDataAnnotationsMvcOptionsSetup.cs
similarity index 91%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MvcDataAnnotationsMvcOptionsSetup.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/MvcDataAnnotationsMvcOptionsSetup.cs
index 78887bb309..312f7d9aeb 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MvcDataAnnotationsMvcOptionsSetup.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/MvcDataAnnotationsMvcOptionsSetup.cs
@@ -3,13 +3,13 @@
using System.Reflection;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
+using Microsoft.AspNetCore.Mvc.DataAnnotations;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Test.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Test
{
public class MvcDataAnnotationsMvcOptionsSetupTests
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/NumericClientModelValidatorTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/NumericClientModelValidatorTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/NumericClientModelValidatorTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/NumericClientModelValidatorTest.cs
index 581ccbf672..c9c9f32795 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/NumericClientModelValidatorTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/NumericClientModelValidatorTest.cs
@@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Testing;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class NumericClientModelValidatorTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RangeAttributeAdapterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/RangeAttributeAdapterTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RangeAttributeAdapterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/RangeAttributeAdapterTest.cs
index 626e915d0c..eb307bce1a 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RangeAttributeAdapterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/RangeAttributeAdapterTest.cs
@@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
+using Microsoft.AspNetCore.Mvc.DataAnnotations;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.Localization;
using Moq;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RequiredAttributeAdapterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/RequiredAttributeAdapterTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RequiredAttributeAdapterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/RequiredAttributeAdapterTest.cs
index 3ea14c9586..dca1b4ca65 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RequiredAttributeAdapterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/RequiredAttributeAdapterTest.cs
@@ -10,7 +10,7 @@ using Microsoft.Extensions.Localization;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class RequiredAttributeAdapterTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/StringLengthAttributeAdapterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/StringLengthAttributeAdapterTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/StringLengthAttributeAdapterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/StringLengthAttributeAdapterTest.cs
index fdf8bf9186..7a0a59c8f2 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/StringLengthAttributeAdapterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/StringLengthAttributeAdapterTest.cs
@@ -10,7 +10,7 @@ using Microsoft.Extensions.Localization;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class StringLengthAttributeAdapterTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/TestModelNameProvider.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/TestModelNameProvider.cs
similarity index 84%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/TestModelNameProvider.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/TestModelNameProvider.cs
index 3e93fbb7b4..7dc128d016 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/TestModelNameProvider.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/TestModelNameProvider.cs
@@ -3,10 +3,10 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class TestModelNameProvider : IModelNameProvider
{
public string Name { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/TestResources.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/TestResources.cs
similarity index 100%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/TestResources.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/TestResources.cs
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ValidatableObjectAdapterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ValidatableObjectAdapterTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ValidatableObjectAdapterTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ValidatableObjectAdapterTest.cs
index 56a127ea25..45d5336592 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ValidatableObjectAdapterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ValidatableObjectAdapterTest.cs
@@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class ValidatableObjectAdapterTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ValidationAttributeAdapterOfTAttributeTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ValidationAttributeAdapterOfTAttributeTest.cs
similarity index 97%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ValidationAttributeAdapterOfTAttributeTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ValidationAttributeAdapterOfTAttributeTest.cs
index 3febb5f4e5..37382f1dce 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ValidationAttributeAdapterOfTAttributeTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ValidationAttributeAdapterOfTAttributeTest.cs
@@ -10,7 +10,7 @@ using Microsoft.Extensions.Localization;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class ValidationAttributeAdapterOfTAttributeTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ValidationAttributeAdapterProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ValidationAttributeAdapterProviderTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ValidationAttributeAdapterProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ValidationAttributeAdapterProviderTest.cs
index beb2ffda18..ef6027c5a1 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ValidationAttributeAdapterProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/ValidationAttributeAdapterProviderTest.cs
@@ -5,7 +5,7 @@ using System;
using System.ComponentModel.DataAnnotations;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
+namespace Microsoft.AspNetCore.Mvc.DataAnnotations
{
public class ValidationAttributeAdapterProviderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonInputFormatterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonInputFormatterTest.cs
index 30868308ad..801faf62ff 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonInputFormatterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonInputFormatterTest.cs
@@ -44,7 +44,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
httpContext.Features.Set(new TestResponseFeature());
httpContext.Request.Body = new NonSeekableReadStream(contentBytes);
httpContext.Request.ContentType = "application/json";
-
+
var formatterContext = CreateInputFormatterContext(typeof(User), httpContext);
// Act
@@ -531,7 +531,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
// missing password property here
var contentBytes = Encoding.UTF8.GetBytes("{ \"UserName\" : \"John\"}");
var httpContext = GetHttpContext(contentBytes, "application/json;charset=utf-8");
-
+
var formatterContext = CreateInputFormatterContext(typeof(UserLogin), httpContext);
// Act
@@ -571,7 +571,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
[InlineData("{\"a\":{\"b\"}}", "a", "Invalid character after parsing property name. Expected ':' but got: }. Path 'a', line 1, position 9.")]
[InlineData("{\"age\":\"x\"}", "age", "Could not convert string to decimal: x. Path 'age', line 1, position 10.")]
[InlineData("{\"login\":1}", "login", "Error converting value 1 to type 'Microsoft.AspNetCore.Mvc.Formatters.JsonInputFormatterTest+UserLogin'. Path 'login', line 1, position 10.")]
- [InlineData("{\"login\":{\"username\":\"somevalue\"}}", "login", "Required property 'Password' not found in JSON. Path 'login', line 1, position 33.")]
+ [InlineData("{\"login\":{\"username\":\"somevalue\"}}", "login.Password", "Required property 'Password' not found in JSON. Path 'login', line 1, position 33.")]
public async Task ReadAsync_WithAllowInputFormatterExceptionMessages_RegistersJsonInputExceptionsAsInputFormatterException(
string content,
string modelStateKey,
@@ -582,7 +582,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
var contentBytes = Encoding.UTF8.GetBytes(content);
var httpContext = GetHttpContext(contentBytes);
-
+
var formatterContext = CreateInputFormatterContext(typeof(User), httpContext);
// Act
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Internal/JsonResultExecutorTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonResultExecutorTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Internal/JsonResultExecutorTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonResultExecutorTest.cs
index 8803474ccd..1db9b26cb6 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Internal/JsonResultExecutorTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonResultExecutorTest.cs
@@ -19,7 +19,7 @@ using Moq;
using Newtonsoft.Json;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters
{
public class JsonResultExecutorTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonResultTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonResultTest.cs
index bdc25acf77..866010f51e 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonResultTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonResultTest.cs
@@ -7,7 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.Formatters.Json.Internal;
+using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj
index 6536b2ef40..8de15c1ec8 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj
@@ -1,7 +1,7 @@
- $(StandardTestTfms)
+ netcoreapp3.0
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/DelegatingEnumerableTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DelegatingEnumerableTest.cs
similarity index 97%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/DelegatingEnumerableTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DelegatingEnumerableTest.cs
index b6945735eb..1fd2097e96 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/DelegatingEnumerableTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DelegatingEnumerableTest.cs
@@ -4,7 +4,7 @@
using System.Linq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
public class DelegatingEnumerableTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/DelegatingEnumeratorTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DelegatingEnumeratorTest.cs
similarity index 97%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/DelegatingEnumeratorTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DelegatingEnumeratorTest.cs
index 4fc0e455f0..cf973a51cb 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/DelegatingEnumeratorTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DelegatingEnumeratorTest.cs
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using Moq;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
public class DelegatingEnumeratorTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlDataContractSerializerMvcOptionsSetupTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DependencyInjection/XmlDataContractSerializerMvcOptionsSetupTest.cs
similarity index 80%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlDataContractSerializerMvcOptionsSetupTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DependencyInjection/XmlDataContractSerializerMvcOptionsSetupTest.cs
index 08c2b0aaf2..48dfa1aab7 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlDataContractSerializerMvcOptionsSetupTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DependencyInjection/XmlDataContractSerializerMvcOptionsSetupTest.cs
@@ -1,11 +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;
+using Microsoft.AspNetCore.Mvc.Formatters;
+using Microsoft.AspNetCore.Mvc.Formatters.Xml;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Options;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
+namespace Microsoft.Extensions.DependencyInjection
{
public class XmlDataContractSerializerMvcOptionsSetupTest
{
@@ -13,7 +15,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
public void AddsFormatterMapping()
{
// Arrange
- var optionsSetup = new XmlDataContractSerializerMvcOptionsSetup(Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
+ var optionsSetup = new XmlDataContractSerializerMvcOptionsSetup(Options.Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
var options = new MvcOptions();
// Act
@@ -28,7 +30,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
public void DoesNotOverrideExistingMapping()
{
// Arrange
- var optionsSetup = new XmlDataContractSerializerMvcOptionsSetup(Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
+ var optionsSetup = new XmlDataContractSerializerMvcOptionsSetup(Options.Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
var options = new MvcOptions();
options.FormatterMappings.SetMediaTypeMappingForFormat("xml", "text/xml");
@@ -44,7 +46,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
public void AddsInputFormatter()
{
// Arrange
- var optionsSetup = new XmlDataContractSerializerMvcOptionsSetup(Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
+ var optionsSetup = new XmlDataContractSerializerMvcOptionsSetup(Options.Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
var options = new MvcOptions();
// Act
@@ -58,7 +60,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
public void AddsOutputFormatter()
{
// Arrange
- var optionsSetup = new XmlDataContractSerializerMvcOptionsSetup(Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
+ var optionsSetup = new XmlDataContractSerializerMvcOptionsSetup(Options.Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
var options = new MvcOptions();
// Act
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerMvcOptionsSetupTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DependencyInjection/XmlSerializerMvcOptionsSetupTest.cs
similarity index 80%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerMvcOptionsSetupTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DependencyInjection/XmlSerializerMvcOptionsSetupTest.cs
index d3b8790e64..b357f78806 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerMvcOptionsSetupTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/DependencyInjection/XmlSerializerMvcOptionsSetupTest.cs
@@ -1,11 +1,14 @@
// 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;
+using Microsoft.AspNetCore.Mvc.Formatters;
+using Microsoft.AspNetCore.Mvc.Formatters.Xml;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Options;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
+namespace Microsoft.Extensions.DependencyInjection
{
public class XmlSerializerMvcOptionsSetupTest
{
@@ -13,7 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
public void AddsFormatterMapping()
{
// Arrange
- var optionsSetup = new XmlSerializerMvcOptionsSetup(Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
+ var optionsSetup = new XmlSerializerMvcOptionsSetup(Options.Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
var options = new MvcOptions();
// Act
@@ -28,7 +31,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
public void DoesNotOverrideExistingMapping()
{
// Arrange
- var optionsSetup = new XmlSerializerMvcOptionsSetup(Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
+ var optionsSetup = new XmlSerializerMvcOptionsSetup(Options.Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
var options = new MvcOptions();
options.FormatterMappings.SetMediaTypeMappingForFormat("xml", "text/xml");
@@ -44,7 +47,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
public void AddsInputFormatter()
{
// Arrange
- var optionsSetup = new XmlSerializerMvcOptionsSetup(Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
+ var optionsSetup = new XmlSerializerMvcOptionsSetup(Options.Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
var options = new MvcOptions();
// Act
@@ -58,7 +61,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
public void AddsOutputFormatter()
{
// Arrange
- var optionsSetup = new XmlSerializerMvcOptionsSetup(Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
+ var optionsSetup = new XmlSerializerMvcOptionsSetup(Options.Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
var options = new MvcOptions();
// Act
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/EnumerableWrapperProviderFactoryTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/EnumerableWrapperProviderFactoryTest.cs
similarity index 99%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/EnumerableWrapperProviderFactoryTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/EnumerableWrapperProviderFactoryTest.cs
index ccfcc526ae..fe31162d99 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/EnumerableWrapperProviderFactoryTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/EnumerableWrapperProviderFactoryTest.cs
@@ -6,7 +6,7 @@ using System.Linq;
using System.Collections.Generic;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
public class EnumerableWrapperProviderFactoryTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/EnumerableWrapperProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/EnumerableWrapperProviderTest.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/EnumerableWrapperProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/EnumerableWrapperProviderTest.cs
index b89802115d..95c7c7ebe1 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/EnumerableWrapperProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/EnumerableWrapperProviderTest.cs
@@ -7,7 +7,7 @@ using System.Linq;
using Microsoft.AspNetCore.Testing;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
public class EnumerableWrapperProviderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj
index 14f4f05b2f..3727766f75 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj
@@ -1,7 +1,7 @@
- $(StandardTestTfms)
+ netcoreapp3.0
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/PersonWrapper.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/PersonWrapper.cs
similarity index 93%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/PersonWrapper.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/PersonWrapper.cs
index 00488f741b..adfa86fafc 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/PersonWrapper.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/PersonWrapper.cs
@@ -3,7 +3,7 @@
using System;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
public class PersonWrapper : IUnwrappable
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/PersonWrapperProvider.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/PersonWrapperProvider.cs
similarity index 91%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/PersonWrapperProvider.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/PersonWrapperProvider.cs
index 572fc28ce7..ca82fc0d7b 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/PersonWrapperProvider.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/PersonWrapperProvider.cs
@@ -3,7 +3,7 @@
using System;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
public class PersonWrapperProvider : IWrapperProvider
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/PersonWrapperProviderFactory.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/PersonWrapperProviderFactory.cs
similarity index 89%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/PersonWrapperProviderFactory.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/PersonWrapperProviderFactory.cs
index 4870541b48..2e764089fd 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/PersonWrapperProviderFactory.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/PersonWrapperProviderFactory.cs
@@ -1,7 +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.
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
public class PersonWrapperProviderFactory : IWrapperProviderFactory
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/SerializableErrorWrapperProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/SerializableErrorWrapperProviderTest.cs
similarity index 96%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/SerializableErrorWrapperProviderTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/SerializableErrorWrapperProviderTest.cs
index fbf779a0aa..c256851372 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/SerializableErrorWrapperProviderTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/SerializableErrorWrapperProviderTest.cs
@@ -4,7 +4,7 @@
using Microsoft.AspNetCore.Testing;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
public class SerializableErrorWrapperProviderTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/SerializableErrorWrapperTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/SerializableErrorWrapperTests.cs
similarity index 98%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/SerializableErrorWrapperTests.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/SerializableErrorWrapperTests.cs
index ec0175b8df..cb96f35f93 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/SerializableErrorWrapperTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/SerializableErrorWrapperTests.cs
@@ -8,7 +8,7 @@ using System.Xml;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
public class SerializableErrorWrapperTests
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/SerializableWrapperProviderFactoryTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/SerializableWrapperProviderFactoryTest.cs
similarity index 96%
rename from src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/SerializableWrapperProviderFactoryTest.cs
rename to src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/SerializableWrapperProviderFactoryTest.cs
index e09a15b43c..153ef3750d 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Internal/SerializableWrapperProviderFactoryTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/SerializableWrapperProviderFactoryTest.cs
@@ -3,7 +3,7 @@
using Xunit;
-namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal
+namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
public class SerializableWrapperProviderFactoryTest
{
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlDataContractSerializerOutputFormatterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlDataContractSerializerOutputFormatterTest.cs
index d7ee5be5cf..fd33afc148 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlDataContractSerializerOutputFormatterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlDataContractSerializerOutputFormatterTest.cs
@@ -9,13 +9,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Microsoft.Extensions.Primitives;
using Microsoft.Net.Http.Headers;
-using Moq;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerOutputFormatterTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerOutputFormatterTest.cs
index dd2602e548..34bb5e0298 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerOutputFormatterTest.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerOutputFormatterTest.cs
@@ -10,13 +10,10 @@ using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Http.Features;
-using Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Microsoft.Extensions.Primitives;
using Microsoft.Net.Http.Headers;
-using Moq;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/DefaultOrderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/DefaultOrderTest.cs
deleted file mode 100644
index 676ff499fa..0000000000
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/DefaultOrderTest.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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.Net;
-using System.Net.Http;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.ActionConstraints;
-using Microsoft.AspNetCore.Mvc.ApiExplorer;
-using Microsoft.AspNetCore.Mvc.Controllers;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.AspNetCore.Mvc.Internal;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Mvc.FunctionalTests
-{
- // Tests that various MVC services have the correct order.
- public class DefaultOrderTest : IClassFixture>
- {
- public DefaultOrderTest(MvcTestFixture fixture)
- {
- Client = fixture.CreateDefaultClient();
- }
-
- public HttpClient Client { get; }
-
- [Theory]
- [InlineData(typeof(IActionDescriptorProvider), typeof(ControllerActionDescriptorProvider), -1000)]
- [InlineData(typeof(IActionInvokerProvider), null, -1000)]
- [InlineData(typeof(IApiDescriptionProvider), null, -1000)]
- [InlineData(typeof(IFilterProvider), null, -1000)]
- [InlineData(typeof(IActionConstraintProvider), null, -1000)]
- public async Task ServiceOrder_GetOrder(Type serviceType, Type actualType, int order)
- {
- // Arrange
- var url = "http://localhost/Order/GetServiceOrder?serviceType=" + serviceType.AssemblyQualifiedName;
-
- if (actualType != null)
- {
- url += "&actualType=" + actualType.AssemblyQualifiedName;
- }
-
- // Act
- var response = await Client.GetAsync(url);
- var content = await response.Content.ReadAsStringAsync();
-
- // Assert
- Assert.Equal(HttpStatusCode.OK, response.StatusCode);
- Assert.Equal(order, int.Parse(content));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ErrorPageTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ErrorPageTests.cs
index 31a74644b1..985b07e0eb 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ErrorPageTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ErrorPageTests.cs
@@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
public HttpClient Client { get; }
- [Fact]
+ [Fact(Skip = "https://github.com/aspnet/Mvc/issues/8753")]
public async Task CompilationFailuresAreListedByErrorPageMiddleware()
{
// Arrange
@@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
Assert.DoesNotContain(PreserveCompilationContextMessage, content);
}
- [Fact]
+ [Fact(Skip = "https://github.com/aspnet/Mvc/issues/8753")]
public async Task ParseFailuresAreListedByErrorPageMiddleware()
{
// Arrange
@@ -67,7 +67,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
Assert.Contains(expected, content);
}
- [Fact]
+ [Fact(Skip = "https://github.com/aspnet/Mvc/issues/8753")]
public async Task CompilationFailuresFromViewImportsAreListed()
{
// Arrange
@@ -90,7 +90,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
Assert.Contains(expectedCompilationContent, content);
}
- [Fact]
+ [Fact(Skip = "https://github.com/aspnet/Mvc/issues/8753")]
public async Task RuntimeErrorAreListedByErrorPageMiddleware()
{
// Arrange
@@ -127,7 +127,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
}
[Fact]
- public async void AggregateException_FlattensInnerExceptions()
+ public async Task AggregateException_FlattensInnerExceptions()
{
// Arrange
var aggregateException = "AggregateException: One or more errors occurred.";
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InputObjectValidationTests.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InputObjectValidationTests.cs
index a56ee08b8e..a91091265b 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InputObjectValidationTests.cs
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InputObjectValidationTests.cs
@@ -172,8 +172,10 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
public async Task CheckIfExcludedField_IsNotValidatedForNonBodyBoundModels()
{
// Arrange
- var kvps = new List>();
- kvps.Add(new KeyValuePair("Alias", "xyz"));
+ var kvps = new List>
+ {
+ new KeyValuePair("Alias", "xyz"),
+ };
var content = new FormUrlEncodedContent(kvps);
// Act
@@ -316,7 +318,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
validationProblemDetails.Errors,
error =>
{
- Assert.Empty(error.Key);
+ Assert.Equal("isbn", error.Key);
Assert.Equal(new[] { "Required property 'isbn' not found in JSON. Path '', line 1, position 44." }, error.Value);
});
}
diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj b/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj
index d93286ee67..4828581cd3 100644
--- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj
+++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj
@@ -1,8 +1,8 @@