Fix type name

This commit is contained in:
Ryan Brandenburg 2017-03-24 14:25:16 -07:00
parent 22c7c90b5a
commit 60a87829f8
38 changed files with 635 additions and 237 deletions

View File

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
VisualStudioVersion = 15.0.26327.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C0D6505-79B3-49D0-B4C3-176F0F1836ED}"
EndProject
@ -47,6 +47,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Ra
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.Extensions.Test", "test\Microsoft.AspNetCore.Mvc.Razor.Extensions.Test\Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj", "{7CFD5646-A757-4498-9E01-9C8528ED60AE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.Common", "test\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj", "{078AEF36-F319-4CE2-BAA2-5B58A6536B46}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -181,6 +183,14 @@ Global
{7CFD5646-A757-4498-9E01-9C8528ED60AE}.Release|Any CPU.Build.0 = Release|Any CPU
{7CFD5646-A757-4498-9E01-9C8528ED60AE}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{7CFD5646-A757-4498-9E01-9C8528ED60AE}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.Release|Any CPU.Build.0 = Release|Any CPU
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -202,5 +212,6 @@ Global
{37E61BDB-658E-4F44-A499-D64CC6D35485} = {92463391-81BE-462B-AC3C-78C6C760741F}
{995F2FEB-65FA-4399-B1C0-16E0B3FBDB15} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{7CFD5646-A757-4498-9E01-9C8528ED60AE} = {92463391-81BE-462B-AC3C-78C6C760741F}
{078AEF36-F319-4CE2-BAA2-5B58A6536B46} = {92463391-81BE-462B-AC3C-78C6C760741F}
EndGlobalSection
EndGlobal

View File

@ -1,5 +1,6 @@
<Project>
<ItemGroup>
<ExcludeFromTest Include="$(RepositoryRoot)\test\Microsoft.VisualStudio.LanguageServices.Razor.Test\Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj" Condition="'$(OS)'!='Windows_NT'" />
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.VisualStudio.LanguageServices.Razor.Test\Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj" Condition="'$(OS)'!='Windows_NT'" />
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
</ItemGroup>
</Project>

View File

@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
{
public class InjectDirectiveTargetExtension : IInjectDirectiveTargetExtension
{
private const string RazorInjectAttribute = "[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]";
private const string RazorInjectAttribute = "[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]";
public void WriteInjectProperty(CSharpRenderingContext context, InjectDirectiveIRNode node)
{

View File

@ -3,6 +3,7 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Evolution.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Test.Common, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View File

@ -16,9 +16,9 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
{
public class RazorEngineTest
public class CodeGenerationTests
{
private static Assembly _assembly = typeof(RazorEngineTest).GetTypeInfo().Assembly;
private static Assembly _assembly = typeof(CodeGenerationTests).GetTypeInfo().Assembly;
#region Runtime
[Fact]
@ -62,6 +62,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
{
RunRuntimeTest("ModelExpressionTagHelper");
}
[Fact]
public void RazorEngine_RazorPages_Runtime()
{
RunRuntimeTest("RazorPages", BuildDivDescriptors());
}
#endregion
#region DesignTime
@ -112,9 +118,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
{
RunDesignTimeTest("ModelExpressionTagHelper");
}
[Fact]
public void RazorEngine_RazorPages_DesignTime()
{
RunDesignTimeTest("RazorPages", BuildDivDescriptors());
}
#endregion
private static void RunRuntimeTest(string testName)
private static void RunRuntimeTest(string testName, IEnumerable<TagHelperDescriptor> descriptors = null)
{
// Arrange
var inputFile = "TestFiles/Input/" + testName + ".cshtml";
@ -125,8 +137,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
{
RazorExtensions.Register(b);
b.Features.Add(new DefaultTagHelperFeature());
b.Features.Add(GetMetadataReferenceFeature());
if (descriptors != null)
{
b.AddTagHelpers(descriptors);
}
else
{
b.Features.Add(new DefaultTagHelperFeature());
}
});
var inputContent = ResourceFile.ReadResource(_assembly, inputFile, sourceFile: true);
@ -155,7 +176,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
#endif
}
private static void RunDesignTimeTest(string testName)
private static void RunDesignTimeTest(string testName, IEnumerable<TagHelperDescriptor> descriptors = null)
{
// Arrange
var inputFile = "TestFiles/Input/" + testName + ".cshtml";
@ -169,8 +190,16 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
{
RazorExtensions.Register(b);
b.Features.Add(new DefaultTagHelperFeature());
b.Features.Add(GetMetadataReferenceFeature());
if (descriptors != null)
{
b.AddTagHelpers(descriptors);
}
else
{
b.Features.Add(new DefaultTagHelperFeature());
}
});
var inputContent = ResourceFile.ReadResource(_assembly, inputFile, sourceFile: true);
@ -203,9 +232,27 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
#endif
}
private static IEnumerable<TagHelperDescriptor> BuildDivDescriptors()
{
return new List<TagHelperDescriptor> {
BuildDescriptor("div", "DivTagHelper", "TestAssembly"),
BuildDescriptor("a", "UrlResolutionTagHelper", "Microsoft.AspNetCore.Mvc.Razor")
};
}
private static TagHelperDescriptor BuildDescriptor(
string tagName,
string typeName,
string assemblyName)
{
return ITagHelperDescriptorBuilder.Create(typeName, assemblyName)
.TagMatchingRule(ruleBuilder => ruleBuilder.RequireTagName(tagName))
.Build();
}
private static IRazorEngineFeature GetMetadataReferenceFeature()
{
var currentAssembly = typeof(RazorEngineTest).GetTypeInfo().Assembly;
var currentAssembly = typeof(CodeGenerationTests).GetTypeInfo().Assembly;
var dependencyContext = DependencyContext.Load(currentAssembly);
var references = dependencyContext.CompileLibraries.SelectMany(l => l.ResolveReferencePaths())

View File

@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Assert
Assert.Equal(
"[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]" + Environment.NewLine +
"[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]" + Environment.NewLine +
"public PropertyType PropertyName { get; private set; }" + Environment.NewLine,
context.Writer.Builder.ToString());
}
@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Assert
Assert.Equal(
"#line 2 \"test-path\"" + Environment.NewLine +
"[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]" + Environment.NewLine +
"[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]" + Environment.NewLine +
"public PropertyType<ModelType> PropertyName { get; private set; }" + Environment.NewLine + Environment.NewLine +
"#line default" + Environment.NewLine +
"#line hidden" + Environment.NewLine,

View File

@ -20,6 +20,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc.Razor.Extensions\Microsoft.AspNetCore.Mvc.Razor.Extensions.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Razor.Runtime\Microsoft.AspNetCore.Razor.Runtime.csproj" />
<ProjectReference Include="..\..\src\Microsoft.CodeAnalysis.Razor\Microsoft.CodeAnalysis.Razor.csproj" />

View File

@ -0,0 +1,40 @@
@page
@model NewModel
@addTagHelper "*, TestAssembly"
@using Microsoft.AspNetCore.Mvc.RazorPages
@functions {
public class NewModel : PageModel
{
public IActionResult OnPost(Customer customer)
{
Name = customer.Name;
return Redirect("~/customers/inlinepagemodels/");
}
public string Name { get; set; }
}
public class Customer
{
public string Name { get; set; }
}
}
<h1>New Customer</h1>
<form method="post" class="form-horizontal" >
<div class="text-danger"></div>
<div class="form-group">
<label class="col-md-2 control-label">@Name</label>
<div class="col-md-10">
<input class="form-control" />
<span class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-primary">Save</button>
</div>
</div>
</form>

View File

@ -51,15 +51,15 @@ __o = Html.Input("SomeKey");
#line hidden
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
}
}

View File

@ -54,17 +54,17 @@ System.Object MyPropertyName = null;
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyApp MyPropertyName { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
}
}

View File

@ -61,17 +61,17 @@ System.Object Html = null;
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyService<MyModel> Html { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyApp MyPropertyName { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
}
}

View File

@ -77,21 +77,21 @@ System.Object Html2 = null;
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyService<MyModel> Html2 { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyApp MyPropertyName2 { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyService<MyModel> Html { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyApp MyPropertyName { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
}
}

View File

@ -45,15 +45,15 @@ System.Collections.IEnumerable __typeHelper = null;
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<System.Collections.IEnumerable> Html { get; private set; }
}
}

View File

@ -62,15 +62,15 @@ __Microsoft_AspNetCore_Mvc_Razor_Extensions_InputTestTagHelper.For = ModelExpres
#line hidden
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<DateTime> Html { get; private set; }
}
}

View File

@ -49,15 +49,15 @@ System.Collections.IEnumerable __typeHelper = null;
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<System.Collections.IEnumerable> Html { get; private set; }
}
}

View File

@ -0,0 +1,101 @@
namespace AspNetCore
{
#line hidden
using TModel = NewModel;
using System;
using System.Threading.Tasks;
#line 2 ""
using System.Linq;
#line default
#line hidden
#line 3 ""
using System.Collections.Generic;
#line default
#line hidden
#line 4 ""
using Microsoft.AspNetCore.Mvc;
#line default
#line hidden
#line 5 ""
using Microsoft.AspNetCore.Mvc.Rendering;
#line default
#line hidden
#line 6 ""
using Microsoft.AspNetCore.Mvc.ViewFeatures;
#line default
#line hidden
#line 5 "/TestFiles/Input/RazorPages.cshtml"
using Microsoft.AspNetCore.Mvc.RazorPages;
#line default
#line hidden
public class _TestFiles_Input_RazorPages_cshtml : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
((System.Action)(() => {
NewModel __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object __typeHelper = "*, TestAssembly";
}
))();
}
#pragma warning restore 219
private static System.Object __o = null;
private global::DivTagHelper __DivTagHelper = null;
#pragma warning disable 1998
public async override global::System.Threading.Tasks.Task ExecuteAsync()
{
__DivTagHelper = CreateTagHelper<global::DivTagHelper>();
#line 29 "/TestFiles/Input/RazorPages.cshtml"
__o = Name;
#line default
#line hidden
__DivTagHelper = CreateTagHelper<global::DivTagHelper>();
__DivTagHelper = CreateTagHelper<global::DivTagHelper>();
__DivTagHelper = CreateTagHelper<global::DivTagHelper>();
__DivTagHelper = CreateTagHelper<global::DivTagHelper>();
}
#pragma warning restore 1998
#line 7 "/TestFiles/Input/RazorPages.cshtml"
public class NewModel : PageModel
{
public IActionResult OnPost(Customer customer)
{
Name = customer.Name;
return Redirect("~/customers/inlinepagemodels/");
}
public string Name { get; set; }
}
public class Customer
{
public string Name { get; set; }
}
#line default
#line hidden
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<NewModel> Html { get; private set; }
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<NewModel> ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<NewModel>)PageContext?.ViewData;
public NewModel Model => ViewData.Model;
}
}

View File

@ -0,0 +1,52 @@
Source Location: (16:2,7 [8] /TestFiles/Input/RazorPages.cshtml)
|NewModel|
Generated Location: (879:41,0 [8] )
|NewModel|
Source Location: (40:3,14 [17] /TestFiles/Input/RazorPages.cshtml)
|"*, TestAssembly"|
Generated Location: (999:45,29 [17] )
|"*, TestAssembly"|
Source Location: (666:28,47 [4] /TestFiles/Input/RazorPages.cshtml)
|Name|
Generated Location: (1500:57,47 [4] )
|Name|
Source Location: (117:6,12 [360] /TestFiles/Input/RazorPages.cshtml)
|
public class NewModel : PageModel
{
public IActionResult OnPost(Customer customer)
{
Name = customer.Name;
return Redirect("~/customers/inlinepagemodels/");
}
public string Name { get; set; }
}
public class Customer
{
public string Name { get; set; }
}
|
Generated Location: (1929:68,12 [360] )
|
public class NewModel : PageModel
{
public IActionResult OnPost(Customer customer)
{
Name = customer.Name;
return Redirect("~/customers/inlinepagemodels/");
}
public string Name { get; set; }
}
public class Customer
{
public string Name { get; set; }
}
|

View File

@ -49,17 +49,17 @@ System.Object Model = null;
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public IHtmlHelper<dynamic> Model { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
}
}

View File

@ -59,15 +59,15 @@ Write(Html.Input("SomeKey"));
EndContext();
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
}
}

View File

@ -41,17 +41,17 @@ using MyNamespace;
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyApp MyPropertyName { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
}
}

View File

@ -36,17 +36,17 @@ using Microsoft.AspNetCore.Mvc.ViewFeatures;
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyService<MyModel> Html { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyApp MyPropertyName { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
}
}

View File

@ -36,21 +36,21 @@ using Microsoft.AspNetCore.Mvc.ViewFeatures;
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyService<MyModel> Html2 { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyApp MyPropertyName2 { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyService<MyModel> Html { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public MyApp MyPropertyName { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
}
}

View File

@ -36,15 +36,15 @@ using Microsoft.AspNetCore.Mvc.ViewFeatures;
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<System.Collections.IEnumerable> Html { get; private set; }
}
}

View File

@ -107,15 +107,15 @@ __Microsoft_AspNetCore_Mvc_Razor_Extensions_InputTestTagHelper.For = ModelExpres
EndContext();
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<DateTime> Html { get; private set; }
}
}

View File

@ -0,0 +1,222 @@
#pragma checksum "/TestFiles/Input/RazorPages.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "1b3a99159b0df739708e9384e871a4983f59c1e4"
namespace AspNetCore
{
#line hidden
using System;
using System.Threading.Tasks;
#line 2 ""
using System.Linq;
#line default
#line hidden
#line 3 ""
using System.Collections.Generic;
#line default
#line hidden
#line 4 ""
using Microsoft.AspNetCore.Mvc;
#line default
#line hidden
#line 5 ""
using Microsoft.AspNetCore.Mvc.Rendering;
#line default
#line hidden
#line 6 ""
using Microsoft.AspNetCore.Mvc.ViewFeatures;
#line default
#line hidden
#line 5 "/TestFiles/Input/RazorPages.cshtml"
using Microsoft.AspNetCore.Mvc.RazorPages;
#line default
#line hidden
public class _TestFiles_Input_RazorPages_cshtml : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
{
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("text-danger"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("col-md-10"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("form-group"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("col-md-offset-2 col-md-10"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
#line hidden
#pragma warning disable 0414
private string __tagHelperStringValueBuffer = null;
#pragma warning restore 0414
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null;
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner();
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null;
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager
{
get
{
if (__backed__tagHelperScopeManager == null)
{
__backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope);
}
return __backed__tagHelperScopeManager;
}
}
private global::DivTagHelper __DivTagHelper = null;
#pragma warning disable 1998
public async override global::System.Threading.Tasks.Task ExecuteAsync()
{
BeginContext(7, 2, true);
WriteLiteral("\r\n");
EndContext();
BeginContext(103, 2, true);
WriteLiteral("\r\n");
EndContext();
BeginContext(480, 76, true);
WriteLiteral("\r\n<h1>New Customer</h1>\r\n<form method=\"post\" class=\"form-horizontal\" >\r\n ");
EndContext();
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => {
}
);
__DivTagHelper = CreateTagHelper<global::DivTagHelper>();
__tagHelperExecutionContext.Add(__DivTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
BeginContext(556, 31, false);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
EndContext();
BeginContext(587, 6, true);
WriteLiteral("\r\n ");
EndContext();
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => {
BeginContext(617, 48, true);
WriteLiteral("\r\n <label class=\"col-md-2 control-label\">");
EndContext();
BeginContext(666, 4, false);
#line 29 "/TestFiles/Input/RazorPages.cshtml"
Write(Name);
#line default
#line hidden
EndContext();
BeginContext(670, 18, true);
WriteLiteral("</label>\r\n ");
EndContext();
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => {
BeginContext(711, 101, true);
WriteLiteral("\r\n <input class=\"form-control\" />\r\n <span class=\"text-danger\"></span>\r\n ");
EndContext();
}
);
__DivTagHelper = CreateTagHelper<global::DivTagHelper>();
__tagHelperExecutionContext.Add(__DivTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
BeginContext(688, 130, false);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
EndContext();
BeginContext(818, 6, true);
WriteLiteral("\r\n ");
EndContext();
}
);
__DivTagHelper = CreateTagHelper<global::DivTagHelper>();
__tagHelperExecutionContext.Add(__DivTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
BeginContext(593, 237, false);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
EndContext();
BeginContext(830, 6, true);
WriteLiteral("\r\n ");
EndContext();
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => {
BeginContext(860, 10, true);
WriteLiteral("\r\n ");
EndContext();
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => {
BeginContext(909, 83, true);
WriteLiteral("\r\n <button type=\"submit\" class=\"btn btn-primary\">Save</button>\r\n ");
EndContext();
}
);
__DivTagHelper = CreateTagHelper<global::DivTagHelper>();
__tagHelperExecutionContext.Add(__DivTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3);
BeginContext(870, 128, false);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
EndContext();
BeginContext(998, 6, true);
WriteLiteral("\r\n ");
EndContext();
}
);
__DivTagHelper = CreateTagHelper<global::DivTagHelper>();
__tagHelperExecutionContext.Add(__DivTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
BeginContext(836, 174, false);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
EndContext();
BeginContext(1010, 11, true);
WriteLiteral("\r\n</form>\r\n");
EndContext();
}
#pragma warning restore 1998
#line 7 "/TestFiles/Input/RazorPages.cshtml"
public class NewModel : PageModel
{
public IActionResult OnPost(Customer customer)
{
Name = customer.Name;
return Redirect("~/customers/inlinepagemodels/");
}
public string Name { get; set; }
}
public class Customer
{
public string Name { get; set; }
}
#line default
#line hidden
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<NewModel> Html { get; private set; }
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<NewModel> ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<NewModel>)PageContext?.ViewData;
public NewModel Model => ViewData.Model;
}
}

View File

@ -36,17 +36,17 @@ using Microsoft.AspNetCore.Mvc.ViewFeatures;
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public IHtmlHelper<dynamic> Model { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Razor.Internal.RazorInjectAttribute]
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
}
}

View File

@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
{
Content = content,
};
var project = new TestRazorProject(new[] { projectItem });
var project = new TestRazorProject(new[]{ projectItem });
var razorEngine = RazorEngine.Create();
var templateEngine = new RazorTemplateEngine(razorEngine, project);

View File

@ -13,6 +13,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Razor.Evolution\Microsoft.AspNetCore.Razor.Evolution.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="Moq" Version="$(MoqVersion)" />

View File

@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution
public void NormalizeAndEnsureValidPath_DoesNotModifyPath()
{
// Arrange
var project = new TestRazorProject(new Dictionary<string, RazorProjectItem>());
var project = new TestRazorProject();
// Act
var path = project.NormalizeAndEnsureValidPath("/Views/Home/Index.cshtml");
@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution
public void NormalizeAndEnsureValidPath_ThrowsIfPathIsNullOrEmpty(string path)
{
// Arrange
var project = new TestRazorProject(new Dictionary<string, RazorProjectItem>());
var project = new TestRazorProject();
// Act and Assert
ExceptionAssert.ThrowsArgumentNullOrEmptyString(() => project.NormalizeAndEnsureValidPath(path), "path");
@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution
public void NormalizeAndEnsureValidPath_ThrowsIfPathDoesNotStartWithForwardSlash(string path)
{
// Arrange
var project = new TestRazorProject(new Dictionary<string, RazorProjectItem>());
var project = new TestRazorProject();
// Act and Assert
ExceptionAssert.ThrowsArgument(
@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution
public void FindHierarchicalItems_ReturnsEmptySequenceIfPathIsAtRoot()
{
// Arrange
var project = new TestRazorProject(new Dictionary<string, RazorProjectItem>());
var project = new TestRazorProject();
// Act
var result = project.FindHierarchicalItems("/", "File.cshtml");
@ -72,11 +72,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution
{
// Arrange
var path = "/Views/Home/Index.cshtml";
var items = new Dictionary<string, RazorProjectItem>
var items = new List<RazorProjectItem>
{
{ $"/{fileName}", CreateProjectItem($"/{fileName}") },
{ $"/Views/{fileName}", CreateProjectItem($"/Views/{fileName}") },
{ $"/Views/Home/{fileName}", CreateProjectItem($"/Views/Home/{fileName}") },
CreateProjectItem($"/{fileName}"),
CreateProjectItem($"/Views/{fileName}"),
CreateProjectItem($"/Views/Home/{fileName}")
};
var project = new TestRazorProject(items);
@ -96,9 +96,9 @@ namespace Microsoft.AspNetCore.Razor.Evolution
{
// Arrange
var path = "/Index.cshtml";
var items = new Dictionary<string, RazorProjectItem>
var items = new List<RazorProjectItem>
{
{ "/File.cshtml", CreateProjectItem("/File.cshtml") },
CreateProjectItem("/File.cshtml")
};
var project = new TestRazorProject(items);
@ -116,13 +116,13 @@ namespace Microsoft.AspNetCore.Razor.Evolution
{
// Arrange
var path = "/Areas/MyArea/Views/Home/File.cshtml";
var items = new Dictionary<string, RazorProjectItem>
var items = new List<RazorProjectItem>
{
{ "/Areas/MyArea/Views/Home/File.cshtml", CreateProjectItem("/Areas/MyArea/Views/Home/File.cshtml") },
{ "/Areas/MyArea/Views/File.cshtml", CreateProjectItem("/Areas/MyArea/Views/File.cshtml") },
{ "/Areas/MyArea/File.cshtml", CreateProjectItem("/Areas/MyArea/File.cshtml") },
{ "/Areas/File.cshtml", CreateProjectItem("/Areas/File.cshtml") },
{ "/File.cshtml", CreateProjectItem("/File.cshtml") },
CreateProjectItem("/Areas/MyArea/Views/Home/File.cshtml"),
CreateProjectItem("/Areas/MyArea/Views/File.cshtml"),
CreateProjectItem("/Areas/MyArea/File.cshtml"),
CreateProjectItem("/Areas/File.cshtml"),
CreateProjectItem("/File.cshtml"),
};
var project = new TestRazorProject(items);
@ -143,9 +143,9 @@ namespace Microsoft.AspNetCore.Razor.Evolution
{
// Arrange
var path = "/File.cshtml";
var items = new Dictionary<string, RazorProjectItem>
var items = new List<RazorProjectItem>
{
{ "/File.cshtml", CreateProjectItem("/File.cshtml") },
CreateProjectItem("/File.cshtml")
};
var project = new TestRazorProject(items);
@ -161,10 +161,10 @@ namespace Microsoft.AspNetCore.Razor.Evolution
{
// Arrange
var path = "/Areas/MyArea/Views/Home/Test.cshtml";
var items = new Dictionary<string, RazorProjectItem>
var items = new List<RazorProjectItem>
{
{ "/Areas/MyArea/File.cshtml", CreateProjectItem("/Areas/MyArea/File.cshtml") },
{ "/File.cshtml", CreateProjectItem("/File.cshtml") },
CreateProjectItem("/Areas/MyArea/File.cshtml"),
CreateProjectItem("/File.cshtml")
};
var project = new TestRazorProject(items);
@ -208,10 +208,10 @@ namespace Microsoft.AspNetCore.Razor.Evolution
{
// Arrange
var path = "/Areas/MyArea/Views/Home/Test.cshtml";
var items = new Dictionary<string, RazorProjectItem>
var items = new List<RazorProjectItem>
{
{ "/Areas/MyArea/File.cshtml", CreateProjectItem("/Areas/MyArea/File.cshtml") },
{ "/File.cshtml", CreateProjectItem("/File.cshtml") },
CreateProjectItem("/Areas/MyArea/File.cshtml"),
CreateProjectItem("/File.cshtml")
};
var project = new TestRazorProject(items);
@ -250,10 +250,10 @@ namespace Microsoft.AspNetCore.Razor.Evolution
{
// Arrange
var path = "/Areas/MyArea/Views/Home/Test.cshtml";
var items = new Dictionary<string, RazorProjectItem>
var items = new List<RazorProjectItem>
{
{ "/Areas/MyArea/File.cshtml", CreateProjectItem("/Areas/MyArea/File.cshtml") },
{ "/File.cshtml", CreateProjectItem("/File.cshtml") },
CreateProjectItem("/Areas/MyArea/File.cshtml"),
CreateProjectItem("/File.cshtml")
};
var project = new TestRazorProject(items);
@ -282,10 +282,10 @@ namespace Microsoft.AspNetCore.Razor.Evolution
{
// Arrange
var path = "/Areas/MyArea/Views/Home/Test.cshtml";
var items = new Dictionary<string, RazorProjectItem>
var items = new List<RazorProjectItem>
{
{ "/Areas/MyArea/File.cshtml", CreateProjectItem("/Areas/MyArea/File.cshtml") },
{ "/File.cshtml", CreateProjectItem("/File.cshtml") },
CreateProjectItem("/Areas/MyArea/File.cshtml"),
CreateProjectItem("/File.cshtml"),
};
var project = new TestRazorProject(items);
@ -308,10 +308,10 @@ namespace Microsoft.AspNetCore.Razor.Evolution
// Arrange
var basePath = "/Pages";
var path = "/Areas/MyArea/Views/Home/Test.cshtml";
var items = new Dictionary<string, RazorProjectItem>
var items = new List<RazorProjectItem>
{
{ "/Areas/MyArea/File.cshtml", CreateProjectItem("/Areas/MyArea/File.cshtml") },
{ "/File.cshtml", CreateProjectItem("/File.cshtml") },
CreateProjectItem("/Areas/MyArea/File.cshtml"),
CreateProjectItem("/File.cshtml"),
};
var project = new TestRazorProject(items);
@ -329,29 +329,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution
projectItem.SetupGet(f => f.Exists).Returns(true);
return projectItem.Object;
}
private class TestRazorProject : RazorProject
{
private readonly Dictionary<string, RazorProjectItem> _items;
public TestRazorProject(Dictionary<string, RazorProjectItem> items)
{
_items = items;
}
public override IEnumerable<RazorProjectItem> EnumerateItems(string basePath) => throw new NotImplementedException();
public override RazorProjectItem GetItem(string path)
{
if (!_items.TryGetValue(path, out var item))
{
item = new NotFoundProjectItem("", path);
}
return item;
}
public new string NormalizeAndEnsureValidPath(string path) => base.NormalizeAndEnsureValidPath(path);
}
}
}

View File

@ -1,39 +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;
namespace Microsoft.AspNetCore.Razor.Evolution
{
public class TestRazorProject : RazorProject
{
private readonly Dictionary<string, RazorProjectItem> _lookup;
public TestRazorProject()
: this(new RazorProjectItem[0])
{
}
public TestRazorProject(IList<RazorProjectItem> items)
{
_lookup = items.ToDictionary(item => item.Path);
}
public override IEnumerable<RazorProjectItem> EnumerateItems(string basePath)
{
throw new NotImplementedException();
}
public override RazorProjectItem GetItem(string path)
{
if (!_lookup.TryGetValue(path, out var value))
{
value = new NotFoundProjectItem("", path);
}
return value;
}
}
}

View File

@ -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.IO;
using System.Text;
namespace Microsoft.AspNetCore.Razor.Evolution
{
public class TestRazorProjectItem : RazorProjectItem
{
public TestRazorProjectItem(
string path,
string physicalPath = null,
string basePath = "/")
{
Path = path;
PhysicalPath = physicalPath;
BasePath = basePath;
}
public override string BasePath { get; }
public override string Path { get; }
public override string PhysicalPath { get; }
public override bool Exists => true;
public string Content { get; set; } = "Default content";
public override Stream Read() => new MemoryStream(Encoding.UTF8.GetBytes(Content));
}
}

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Microsoft.AspNetCore.Razor.Evolution;
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
{
@ -46,8 +47,8 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
{
get
{
var inputTypePropertyInfo = typeof(TestType).GetProperty("Type");
var inputCheckedPropertyInfo = typeof(TestType).GetProperty("Checked");
var inputTypePropertyInfo = typeof(TestType).GetRuntimeProperty("Type");
var inputCheckedPropertyInfo = typeof(TestType).GetRuntimeProperty("Checked");
return new[]
{
@ -292,8 +293,8 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
{
get
{
var inputTypePropertyInfo = typeof(TestType).GetProperty("Type");
var inputCheckedPropertyInfo = typeof(TestType).GetProperty("Checked");
var inputTypePropertyInfo = typeof(TestType).GetRuntimeProperty("Type");
var inputCheckedPropertyInfo = typeof(TestType).GetRuntimeProperty("Checked");
return new[]
{
CreateTagHelperDescriptor(
@ -399,7 +400,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
{
get
{
var propertyInfo = typeof(TestType).GetProperty("BoundProperty");
var propertyInfo = typeof(TestType).GetRuntimeProperty("BoundProperty");
return new[]
{
CreateTagHelperDescriptor(
@ -422,9 +423,9 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
{
get
{
var pAgePropertyInfo = typeof(TestType).GetProperty("Age");
var inputTypePropertyInfo = typeof(TestType).GetProperty("Type");
var checkedPropertyInfo = typeof(TestType).GetProperty("Checked");
var pAgePropertyInfo = typeof(TestType).GetRuntimeProperty("Age");
var inputTypePropertyInfo = typeof(TestType).GetRuntimeProperty("Type");
var checkedPropertyInfo = typeof(TestType).GetRuntimeProperty("Checked");
return new[]
{

View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFrameworks>netstandard1.3</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Razor.Evolution\Microsoft.AspNetCore.Razor.Evolution.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(AspNetCoreVersion)" />
</ItemGroup>
</Project>

View File

@ -35,5 +35,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution
return value;
}
public new string NormalizeAndEnsureValidPath(string path) => base.NormalizeAndEnsureValidPath(path);
}
}