From 05ac641f9a648f557af8868ca5862cc6a09653fc Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Mon, 27 Apr 2015 11:41:05 -0700 Subject: [PATCH] PR comment on c162209 - place `[HtmlAttributeNotBound]` on its own line - don't use (wonderful) shortcut syntax - @Eilon's comment https://github.com/aspnet/Mvc/pull/2452/files#r29162068 --- .../AnchorTagHelper.cs | 3 ++- .../CacheTagHelper.cs | 6 ++++-- .../EnvironmentTagHelper.cs | 3 ++- .../FormTagHelper.cs | 6 ++++-- .../InputTagHelper.cs | 6 ++++-- .../LabelTagHelper.cs | 6 ++++-- .../LinkTagHelper.cs | 18 ++++++++++++------ .../OptionTagHelper.cs | 6 ++++-- .../ScriptTagHelper.cs | 18 ++++++++++++------ .../SelectTagHelper.cs | 6 ++++-- .../TextAreaTagHelper.cs | 7 ++++--- .../ValidationMessageTagHelper.cs | 6 ++++-- .../ValidationSummaryTagHelper.cs | 6 ++++-- .../RazorPageCreateTagHelperTest.cs | 7 ++++--- .../TagHelpersWebSite/TagHelpers/ATagHelper.cs | 3 ++- .../TagHelpers/PrettyTagHelper.cs | 3 ++- .../TagCloudViewComponentTagHelper.cs | 3 ++- 17 files changed, 74 insertions(+), 39 deletions(-) diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs index a7b3cda430..1aa66bc63c 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs @@ -24,7 +24,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers private const string RouteAttributePrefix = "asp-route-"; private const string Href = "href"; - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHtmlGenerator Generator { get; set; } /// diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/CacheTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/CacheTagHelper.cs index 9dcdd2da8b..6733103188 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/CacheTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/CacheTagHelper.cs @@ -39,13 +39,15 @@ namespace Microsoft.AspNet.Mvc.TagHelpers /// /// Gets or sets the instance used to cache entries. /// - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IMemoryCache MemoryCache { get; set; } /// /// Gets or sets the for the current executing View. /// - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } /// diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/EnvironmentTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/EnvironmentTagHelper.cs index 51e9cdc10d..d421154ed1 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/EnvironmentTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/EnvironmentTagHelper.cs @@ -25,7 +25,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers /// public string Names { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHostingEnvironment HostingEnvironment { get; set; } /// diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/FormTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/FormTagHelper.cs index 4bcdf86dc7..02db12682f 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/FormTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/FormTagHelper.cs @@ -21,10 +21,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers private const string RouteAttributePrefix = "asp-route-"; private const string HtmlActionAttributeName = "action"; - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHtmlGenerator Generator { get; set; } /// diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/InputTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/InputTagHelper.cs index f5761beb44..09ebb5b702 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/InputTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/InputTagHelper.cs @@ -62,10 +62,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers { "time", "{0:HH:mm:ss.fff}" }, }; - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHtmlGenerator Generator { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } /// diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/LabelTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/LabelTagHelper.cs index 92147945e3..0769ecd3e2 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/LabelTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/LabelTagHelper.cs @@ -15,10 +15,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers { private const string ForAttributeName = "asp-for"; - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHtmlGenerator Generator { get; set; } /// diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/LinkTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/LinkTagHelper.cs index ada03a638a..0bc7c12cb2 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/LinkTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/LinkTagHelper.cs @@ -180,26 +180,32 @@ namespace Microsoft.AspNet.Mvc.TagHelpers [HtmlAttributeName(FallbackTestValueAttributeName)] public string FallbackTestValue { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ILoggerFactory LoggerFactory { get; set; } // TODO: will remove LoggerFactory and activate logger once DI/hosting bug is fixed [HtmlAttributeNotBound] public ILogger Logger { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHostingEnvironment HostingEnvironment { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IMemoryCache Cache { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHtmlEncoder HtmlEncoder { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IJavaScriptStringEncoder JavaScriptEncoder { get; set; } // Internal for ease of use when testing. diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/OptionTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/OptionTagHelper.cs index 2b87a530a2..dd2c758cbd 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/OptionTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/OptionTagHelper.cs @@ -19,10 +19,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers /// public class OptionTagHelper : TagHelper { - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHtmlGenerator Generator { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } /// diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/ScriptTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/ScriptTagHelper.cs index fbfa5750fc..4ab93099a2 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/ScriptTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/ScriptTagHelper.cs @@ -149,26 +149,32 @@ namespace Microsoft.AspNet.Mvc.TagHelpers [HtmlAttributeName(FallbackTestExpressionAttributeName)] public string FallbackTestExpression { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ILoggerFactory LoggerFactory { get; set; } // TODO: will remove LoggerFactory and activate logger once DI/hosting bug is fixed [HtmlAttributeNotBound] public ILogger Logger { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHostingEnvironment HostingEnvironment { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IMemoryCache Cache { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHtmlEncoder HtmlEncoder { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IJavaScriptStringEncoder JavaScriptEncoder { get; set; } // Internal for ease of use when testing. diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/SelectTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/SelectTagHelper.cs index 0a7094f1a7..91dc9b4de7 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/SelectTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/SelectTagHelper.cs @@ -30,10 +30,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers /// public static readonly string SelectedValuesFormDataKey = nameof(SelectTagHelper) + "-SelectedValues"; - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHtmlGenerator Generator { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } /// diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/TextAreaTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/TextAreaTagHelper.cs index c91e9fb226..902a90f4c1 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/TextAreaTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/TextAreaTagHelper.cs @@ -3,7 +3,6 @@ using Microsoft.AspNet.Mvc.Rendering; using Microsoft.AspNet.Razor.Runtime.TagHelpers; -using Microsoft.AspNet.Razor.TagHelpers; namespace Microsoft.AspNet.Mvc.TagHelpers { @@ -15,10 +14,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers { private const string ForAttributeName = "asp-for"; - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHtmlGenerator Generator { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } /// diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/ValidationMessageTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/ValidationMessageTagHelper.cs index 6d007813f9..1cd27d207d 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/ValidationMessageTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/ValidationMessageTagHelper.cs @@ -16,10 +16,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers { private const string ValidationForAttributeName = "asp-validation-for"; - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHtmlGenerator Generator { get; set; } /// diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/ValidationSummaryTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/ValidationSummaryTagHelper.cs index ca9dab610a..f392f67475 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/ValidationSummaryTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/ValidationSummaryTagHelper.cs @@ -17,10 +17,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers private const string ValidationSummaryAttributeName = "asp-validation-summary"; private ValidationSummary _validationSummary; - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IHtmlGenerator Generator { get; set; } /// diff --git a/test/Microsoft.AspNet.Mvc.Razor.Test/RazorPageCreateTagHelperTest.cs b/test/Microsoft.AspNet.Mvc.Razor.Test/RazorPageCreateTagHelperTest.cs index 34019d1d14..e1faeff179 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Test/RazorPageCreateTagHelperTest.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Test/RazorPageCreateTagHelperTest.cs @@ -11,7 +11,6 @@ using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Rendering; using Microsoft.AspNet.Razor.Runtime.TagHelpers; using Microsoft.AspNet.Routing; -using Microsoft.Framework.DependencyInjection; using Moq; using Xunit; @@ -147,7 +146,8 @@ namespace Microsoft.AspNet.Mvc.Razor private class ServiceTagHelper : TagHelper { - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public MyService ActivatedService { get; set; } } @@ -159,7 +159,8 @@ namespace Microsoft.AspNet.Mvc.Razor private class ViewDataTagHelper : TagHelper { - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewDataDictionary ViewData { get; set; } } diff --git a/test/WebSites/TagHelpersWebSite/TagHelpers/ATagHelper.cs b/test/WebSites/TagHelpersWebSite/TagHelpers/ATagHelper.cs index b33637a065..96404619c5 100644 --- a/test/WebSites/TagHelpersWebSite/TagHelpers/ATagHelper.cs +++ b/test/WebSites/TagHelpersWebSite/TagHelpers/ATagHelper.cs @@ -9,7 +9,8 @@ namespace TagHelpersWebSite.TagHelpers { public class ATagHelper : TagHelper { - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public IUrlHelper UrlHelper { get; set; } public string Controller { get; set; } diff --git a/test/WebSites/TagHelpersWebSite/TagHelpers/PrettyTagHelper.cs b/test/WebSites/TagHelpersWebSite/TagHelpers/PrettyTagHelper.cs index 421d7e9d71..f8415d49f8 100644 --- a/test/WebSites/TagHelpersWebSite/TagHelpers/PrettyTagHelper.cs +++ b/test/WebSites/TagHelpersWebSite/TagHelpers/PrettyTagHelper.cs @@ -25,7 +25,8 @@ namespace TagHelpersWebSite.TagHelpers public string Style { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } public override void Process(TagHelperContext context, TagHelperOutput output) diff --git a/test/WebSites/TagHelpersWebSite/TagHelpers/TagCloudViewComponentTagHelper.cs b/test/WebSites/TagHelpersWebSite/TagHelpers/TagCloudViewComponentTagHelper.cs index 9279777fbe..3142b8eb99 100644 --- a/test/WebSites/TagHelpersWebSite/TagHelpers/TagCloudViewComponentTagHelper.cs +++ b/test/WebSites/TagHelpersWebSite/TagHelpers/TagCloudViewComponentTagHelper.cs @@ -25,7 +25,8 @@ namespace MvcSample.Web.Components public int Count { get; set; } - [Activate, HtmlAttributeNotBound] + [Activate] + [HtmlAttributeNotBound] public ViewContext ViewContext { get; set; } public int Order { get; } = 0;