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
This commit is contained in:
Doug Bunting 2015-04-27 11:41:05 -07:00
parent 3c9456e2a3
commit 05ac641f9a
17 changed files with 74 additions and 39 deletions

View File

@ -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; }
/// <summary>

View File

@ -39,13 +39,15 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
/// <summary>
/// Gets or sets the <see cref="IMemoryCache"/> instance used to cache entries.
/// </summary>
[Activate, HtmlAttributeNotBound]
[Activate]
[HtmlAttributeNotBound]
public IMemoryCache MemoryCache { get; set; }
/// <summary>
/// Gets or sets the <see cref="ViewContext"/> for the current executing View.
/// </summary>
[Activate, HtmlAttributeNotBound]
[Activate]
[HtmlAttributeNotBound]
public ViewContext ViewContext { get; set; }
/// <summary>

View File

@ -25,7 +25,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
/// </remarks>
public string Names { get; set; }
[Activate, HtmlAttributeNotBound]
[Activate]
[HtmlAttributeNotBound]
public IHostingEnvironment HostingEnvironment { get; set; }
/// <inheritdoc />

View File

@ -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; }
/// <summary>

View File

@ -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; }
/// <summary>

View File

@ -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; }
/// <summary>

View File

@ -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<LinkTagHelper> 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.

View File

@ -19,10 +19,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
/// </remarks>
public class OptionTagHelper : TagHelper
{
[Activate, HtmlAttributeNotBound]
[Activate]
[HtmlAttributeNotBound]
public IHtmlGenerator Generator { get; set; }
[Activate, HtmlAttributeNotBound]
[Activate]
[HtmlAttributeNotBound]
public ViewContext ViewContext { get; set; }
/// <summary>

View File

@ -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<ScriptTagHelper> 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.

View File

@ -30,10 +30,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
/// </remarks>
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; }
/// <summary>

View File

@ -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; }
/// <summary>

View File

@ -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; }
/// <summary>

View File

@ -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; }
/// <summary>

View File

@ -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; }
}

View File

@ -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; }

View File

@ -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)

View File

@ -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;