From 60d600dd5c458365631049240dda22f49907c438 Mon Sep 17 00:00:00 2001 From: cjrosa Date: Fri, 30 Sep 2016 12:40:53 -0400 Subject: [PATCH] Issue #5310 (#5334) * Issue #5310 --- .../MvcRazorParser.cs | 27 +----- .../TagHelpersWebSite.Home.Index.html | 5 + .../DictionaryPrefixTestTagHelper.cs | 20 ++++ .../ViewComponentTagHelperChunkVisitorTest.cs | 2 +- .../MvcRazorHostTest.cs | 52 ++++++++-- .../Input/ModelExpressionTagHelper.cshtml | 6 +- .../DesignTime/ModelExpressionTagHelper.cs | 23 ++++- .../Runtime/ModelExpressionTagHelper.cs | 97 ++++++++++++++----- .../DictionaryPrefixTestTagHelper.cs | 33 +++++++ .../TagHelpersWebSite/Views/Home/Index.cshtml | 5 + 10 files changed, 208 insertions(+), 62 deletions(-) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/DictionaryPrefixTestTagHelper.cs create mode 100644 test/WebSites/TagHelpersWebSite/TagHelpers/DictionaryPrefixTestTagHelper.cs diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Host/MvcRazorParser.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Host/MvcRazorParser.cs index 086f4ba2c1..b0b0fa53b7 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Host/MvcRazorParser.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Host/MvcRazorParser.cs @@ -21,7 +21,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor public class MvcRazorParser : RazorParser { private readonly IEnumerable _viewImportsDirectiveDescriptors; - private readonly string _modelExpressionTypeName; /// /// Initializes a new instance of . @@ -63,8 +62,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor _viewImportsDirectiveDescriptors = GetTagHelperDirectiveDescriptors( inheritedChunkTrees, defaultInheritedChunks); - - _modelExpressionTypeName = modelExpressionTypeName; } /// @@ -87,29 +84,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor _viewImportsDirectiveDescriptors, errorSink); - var descriptors = visitor.GetDescriptors(documentRoot); - foreach (var descriptor in descriptors) - { - foreach (var attributeDescriptor in descriptor.Attributes) - { - if (attributeDescriptor.IsIndexer && - string.Equals( - attributeDescriptor.TypeName, - _modelExpressionTypeName, - StringComparison.Ordinal)) - { - errorSink.OnError( - SourceLocation.Undefined, - Resources.FormatMvcRazorParser_InvalidPropertyType( - descriptor.TypeName, - attributeDescriptor.Name, - _modelExpressionTypeName), - length: 0); - } - } - } - - return descriptors; + return visitor.GetDescriptors(documentRoot); } private static IEnumerable GetTagHelperDirectiveDescriptors( diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/compiler/resources/TagHelpersWebSite.Home.Index.html b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/compiler/resources/TagHelpersWebSite.Home.Index.html index dcf5fd12da..27bc4cf95a 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/compiler/resources/TagHelpersWebSite.Home.Index.html +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/compiler/resources/TagHelpersWebSite.Home.Index.html @@ -39,6 +39,11 @@

Rendering Template:

Tag Cloud from Template:

Lorem,ipsum,dolor,sit,amet,consectetur,adipisicing,elit,sed,do,eiusmod,tempor,incididunt,ut,labore,et,dolore,magna,aliquaUt,enim
+
+

Dictionary Valued Model Expression

+
  • TagsToShow
  • Version.Build
+
+