From 4e7d1a5a32860ba4f4f6a86fd0b9e1049e4d8c50 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 15 Mar 2018 11:25:10 -0700 Subject: [PATCH] Rename PartialTagHelper `asp-for` to `for`. #7379 --- src/Microsoft.AspNetCore.Mvc.TagHelpers/PartialTagHelper.cs | 4 +--- .../HtmlGeneration_Home/ProductListUsingTagHelpers.cshtml | 4 ++-- .../Views/HtmlGeneration_Home/Warehouse.cshtml | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/PartialTagHelper.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/PartialTagHelper.cs index 59b7d5d30e..cb69697095 100644 --- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/PartialTagHelper.cs +++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/PartialTagHelper.cs @@ -20,7 +20,6 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers [HtmlTargetElement("partial", Attributes = "name", TagStructure = TagStructure.WithoutEndTag)] public class PartialTagHelper : TagHelper { - private const string ForAttributeName = "asp-for"; private readonly ICompositeViewEngine _viewEngine; private readonly IViewBufferScope _viewBufferScope; @@ -40,7 +39,6 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers /// /// An expression to be evaluated against the current model. /// - [HtmlAttributeName(ForAttributeName)] public ModelExpression For { get; set; } /// @@ -102,7 +100,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers // Determine which ViewData we should use to construct a new ViewData var baseViewData = ViewData ?? ViewContext.ViewData; - // Use the rendering View's model only if an asp-for expression does not exist + // Use the rendering View's model only if an for expression does not exist var model = For != null ? For.Model : ViewContext.ViewData.Model; var newViewData = new ViewDataDictionary(baseViewData, model); var partialViewContext = new ViewContext(ViewContext, view, newViewData, writer); diff --git a/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/ProductListUsingTagHelpers.cshtml b/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/ProductListUsingTagHelpers.cshtml index 17da2c943e..4f78aabfb1 100644 --- a/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/ProductListUsingTagHelpers.cshtml +++ b/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/ProductListUsingTagHelpers.cshtml @@ -1,4 +1,4 @@ -@using HtmlGenerationWebSite.Models +@using HtmlGenerationWebSite.Models @model IList @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @@ -15,7 +15,7 @@ - + } @* Print the HtmlFieldPrefix outside of the partial tag helper to ensure it hasn't been modified *@
HtmlFieldPrefix = @ViewData.TemplateInfo.HtmlFieldPrefix
diff --git a/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/Warehouse.cshtml b/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/Warehouse.cshtml index 64ca9c12af..2a039cd8dd 100644 --- a/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/Warehouse.cshtml +++ b/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/Warehouse.cshtml @@ -2,4 +2,4 @@ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

@Html.DisplayFor(m => m.City)

- \ No newline at end of file + \ No newline at end of file