Updating MvcRazorHost to use overload that generates pragma checksum

Fixes #1152
This commit is contained in:
Pranav K 2014-09-29 16:07:11 -07:00
parent f82516d155
commit f33eec4845
5 changed files with 23 additions and 13 deletions

View File

@ -128,11 +128,8 @@ namespace Microsoft.AspNet.Mvc.Razor
{ {
// Adding a prefix so that the main view class can be easily identified. // Adding a prefix so that the main view class can be easily identified.
var className = MainClassNamePrefix + ParserHelpers.SanitizeClassName(rootRelativePath); var className = MainClassNamePrefix + ParserHelpers.SanitizeClassName(rootRelativePath);
using (var reader = new StreamReader(inputStream)) var engine = new RazorTemplateEngine(this);
{ return engine.GenerateCode(inputStream, className, DefaultNamespace, rootRelativePath);
var engine = new RazorTemplateEngine(this);
return engine.GenerateCode(reader, className, DefaultNamespace, rootRelativePath);
}
} }
/// <inheritdoc /> /// <inheritdoc />

View File

@ -1,4 +1,5 @@
namespace Asp #pragma checksum "TestFiles/Input/Basic.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "63d2634be31f68aa89a0c1561d67c73cc446f3d4"
namespace Asp
{ {
using System; using System;
using System.Linq; using System.Linq;
@ -28,13 +29,22 @@
{ {
WriteLiteral("<div"); WriteLiteral("<div");
WriteAttribute("class", Tuple.Create(" class=\"", 4), Tuple.Create("\"", 17), WriteAttribute("class", Tuple.Create(" class=\"", 4), Tuple.Create("\"", 17),
Tuple.Create(Tuple.Create("", 12), Tuple.Create<System.Object, System.Int32>(logo, 12), false)); Tuple.Create(Tuple.Create("", 12), Tuple.Create<System.Object, System.Int32>(
WriteLiteral(">\r\n Hello world\r\n "); #line 1 "TestFiles/Input/Basic.cshtml"
#line 3 "TestFiles/Input/Basic.cshtml" logo
Write(Html.Input("SomeKey"));
#line default #line default
#line hidden #line hidden
, 12), false));
WriteLiteral(">\r\n Hello world\r\n ");
Write(
#line 3 "TestFiles/Input/Basic.cshtml"
Html.Input("SomeKey")
#line default
#line hidden
);
WriteLiteral("\r\n</div>"); WriteLiteral("\r\n</div>");
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -1,4 +1,5 @@
namespace Asp #pragma checksum "TestFiles/Input/Inject.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "424b7fe9f12352c59210b5fa8c74ca8c9c67de81"
namespace Asp
{ {
#line 1 "TestFiles/Input/Inject.cshtml" #line 1 "TestFiles/Input/Inject.cshtml"
using MyNamespace using MyNamespace

View File

@ -1,4 +1,5 @@
namespace Asp #pragma checksum "TestFiles/Input/InjectWithModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0c0e10d3fd8f5bf30eabc22ca0ee91355a13426d"
namespace Asp
{ {
using System; using System;
using System.Linq; using System.Linq;

View File

@ -1,4 +1,5 @@
namespace Asp #pragma checksum "TestFiles/Input/Model.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2c1e88396568d309c236020e59bf2abacfadd612"
namespace Asp
{ {
using System; using System;
using System.Linq; using System.Linq;