diff --git a/src/Microsoft.AspNet.Mvc.Razor.Host/Directives/ChunkHelper.cs b/src/Microsoft.AspNet.Mvc.Razor.Host/Directives/ChunkHelper.cs index 2ef280e31b..c769c7f1ad 100644 --- a/src/Microsoft.AspNet.Mvc.Razor.Host/Directives/ChunkHelper.cs +++ b/src/Microsoft.AspNet.Mvc.Razor.Host/Directives/ChunkHelper.cs @@ -12,7 +12,11 @@ namespace Microsoft.AspNet.Mvc.Razor.Directives /// public static class ChunkHelper { - private const string TModelToken = ""; + /// + /// Token that is replaced by the model name in @inherits and @inject + /// chunks as part of . + /// + public static readonly string TModelToken = ""; /// /// Returns the used to determine the model name for the page generated diff --git a/src/Microsoft.AspNet.Mvc.Razor.Host/Directives/SetBaseTypeChunkMerger.cs b/src/Microsoft.AspNet.Mvc.Razor.Host/Directives/SetBaseTypeChunkMerger.cs index 18802ec877..05ab57f9ac 100644 --- a/src/Microsoft.AspNet.Mvc.Razor.Host/Directives/SetBaseTypeChunkMerger.cs +++ b/src/Microsoft.AspNet.Mvc.Razor.Host/Directives/SetBaseTypeChunkMerger.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Microsoft.AspNet.Razor.Chunks; namespace Microsoft.AspNet.Mvc.Razor.Directives diff --git a/src/Microsoft.AspNet.Mvc.Razor.Host/ModelChunk.cs b/src/Microsoft.AspNet.Mvc.Razor.Host/ModelChunk.cs index 684b8bf2f2..f920cb4ce5 100644 --- a/src/Microsoft.AspNet.Mvc.Razor.Host/ModelChunk.cs +++ b/src/Microsoft.AspNet.Mvc.Razor.Host/ModelChunk.cs @@ -5,20 +5,23 @@ namespace Microsoft.AspNet.Mvc.Razor { + /// + /// for an @model directive. + /// public class ModelChunk : Chunk { /// - /// Represents the chunk for an @model statement. + /// Initializes a new instance of . /// - /// The base type of the view. - /// The type of the view's Model. - public ModelChunk(string baseType, string modelType) + /// The type of the view's model. + public ModelChunk(string modelType) { - BaseType = baseType; ModelType = modelType; } - public string BaseType { get; private set; } - public string ModelType { get; private set; } + /// + /// Gets the type of the view's model. + /// + public string ModelType { get; } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Razor.Host/ModelChunkGenerator.cs b/src/Microsoft.AspNet.Mvc.Razor.Host/ModelChunkGenerator.cs index a6650141d7..55e55920f1 100644 --- a/src/Microsoft.AspNet.Mvc.Razor.Host/ModelChunkGenerator.cs +++ b/src/Microsoft.AspNet.Mvc.Razor.Host/ModelChunkGenerator.cs @@ -10,36 +10,31 @@ namespace Microsoft.AspNet.Razor.Generator { public class ModelChunkGenerator : SpanChunkGenerator { - public ModelChunkGenerator(string baseType, string modelType) + public ModelChunkGenerator(string modelType) { - BaseType = baseType; ModelType = modelType; } - public string BaseType { get; private set; } - public string ModelType { get; private set; } + public string ModelType { get; } public override void GenerateChunk(Span target, ChunkGeneratorContext context) { - var modelChunk = new ModelChunk(BaseType, ModelType); + var modelChunk = new ModelChunk(ModelType); context.ChunkTreeBuilder.AddChunk(modelChunk, target, topLevel: true); } - public override string ToString() - { - return BaseType + "<" + ModelType + ">"; - } + public override string ToString() => ModelType; public override bool Equals(object obj) { var other = obj as ModelChunkGenerator; return other != null && - string.Equals(ModelType, other.ModelType, StringComparison.Ordinal); + string.Equals(ModelType, other.ModelType, StringComparison.Ordinal); } public override int GetHashCode() { - return ModelType.GetHashCode(); + return StringComparer.Ordinal.GetHashCode(ModelType); } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Razor.Host/ModelChunkVisitor.cs b/src/Microsoft.AspNet.Mvc.Razor.Host/ModelChunkVisitor.cs deleted file mode 100644 index ce9f5d333c..0000000000 --- a/src/Microsoft.AspNet.Mvc.Razor.Host/ModelChunkVisitor.cs +++ /dev/null @@ -1,37 +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 Microsoft.AspNet.Razor.CodeGenerators; -using Microsoft.AspNet.Razor.CodeGenerators.Visitors; - -namespace Microsoft.AspNet.Mvc.Razor -{ - public class ModelChunkVisitor : MvcCSharpCodeVisitor - { - public ModelChunkVisitor( - CSharpCodeWriter writer, - CodeGeneratorContext context) - : base(writer, context) - { - if (writer == null) - { - throw new ArgumentNullException(nameof(writer)); - } - - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - } - - protected override void Visit(ModelChunk chunk) - { - var csharpVisitor = new CSharpCodeVisitor(Writer, Context); - - Writer.Write(chunk.BaseType).Write("<"); - csharpVisitor.CreateExpressionCodeMapping(chunk.ModelType, chunk); - Writer.Write(">"); - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpChunkVisitor.cs b/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpChunkVisitor.cs index 18d7dc7cc0..e90bbc70bb 100644 --- a/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpChunkVisitor.cs +++ b/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpChunkVisitor.cs @@ -31,10 +31,6 @@ public override void Accept(Chunk chunk) { Visit((InjectChunk)chunk); } - else if (chunk is ModelChunk) - { - Visit((ModelChunk)chunk); - } else { base.Accept(chunk); @@ -42,6 +38,5 @@ public override void Accept(Chunk chunk) } protected abstract void Visit(InjectChunk chunk); - protected abstract void Visit(ModelChunk chunk); } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpCodeGenerator.cs b/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpCodeGenerator.cs index b5a5091ff8..76f4d2428a 100644 --- a/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpCodeGenerator.cs +++ b/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpCodeGenerator.cs @@ -2,8 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Globalization; -using Microsoft.AspNet.Mvc.Razor.Directives; using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.CodeGenerators.Visitors; @@ -47,8 +45,6 @@ public MvcCSharpCodeGenerator( _injectAttribute = injectAttribute; } - private string Model { get; set; } - protected override CSharpCodeVisitor CreateCSharpCodeVisitor( CSharpCodeWriter writer, CodeGeneratorContext context) @@ -71,32 +67,6 @@ protected override CSharpCodeVisitor CreateCSharpCodeVisitor( return csharpCodeVisitor; } - protected override CSharpCodeWritingScope BuildClassDeclaration(CSharpCodeWriter writer) - { - // Grab the last model chunk so it gets intellisense. - var modelChunk = ChunkHelper.GetModelChunk(Context.ChunkTreeBuilder.ChunkTree); - - Model = modelChunk != null ? modelChunk.ModelType : _defaultModel; - - // If there were any model chunks then we need to modify the class declaration signature. - if (modelChunk != null) - { - writer.Write(string.Format(CultureInfo.InvariantCulture, "public class {0} : ", Context.ClassName)); - - var modelVisitor = new ModelChunkVisitor(writer, Context); - // This generates the base class signature - modelVisitor.Accept(modelChunk); - - writer.WriteLine(); - - return new CSharpCodeWritingScope(writer); - } - else - { - return base.BuildClassDeclaration(writer); - } - } - protected override void BuildConstructor(CSharpCodeWriter writer) { if (writer == null) diff --git a/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpCodeVistor.cs b/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpCodeVistor.cs index fe6e4bda4f..77169dc992 100644 --- a/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpCodeVistor.cs +++ b/src/Microsoft.AspNet.Mvc.Razor.Host/MvcCSharpCodeVistor.cs @@ -27,9 +27,5 @@ public MvcCSharpCodeVisitor( protected override void Visit(InjectChunk chunk) { } - - protected override void Visit(ModelChunk chunk) - { - } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Razor.Host/MvcRazorCodeParser.cs b/src/Microsoft.AspNet.Mvc.Razor.Host/MvcRazorCodeParser.cs index 8cc621e39f..252ea60ad7 100644 --- a/src/Microsoft.AspNet.Mvc.Razor.Host/MvcRazorCodeParser.cs +++ b/src/Microsoft.AspNet.Mvc.Razor.Host/MvcRazorCodeParser.cs @@ -16,13 +16,11 @@ public class MvcRazorCodeParser : CSharpCodeParser { private const string ModelKeyword = "model"; private const string InjectKeyword = "inject"; - private readonly string _baseType; private SourceLocation? _endInheritsLocation; private bool _modelStatementFound; - public MvcRazorCodeParser(string baseType) + public MvcRazorCodeParser() { - _baseType = baseType; MapDirectives(ModelDirective, ModelKeyword); MapDirectives(InjectDirective, InjectKeyword); } @@ -120,9 +118,10 @@ protected virtual void InjectDirective() if (!hasTypeError && (EndOfFile || At(CSharpSymbolType.NewLine))) { // Add an error for the property name only if we successfully read the type name - Context.OnError(startLocation, - Resources.FormatMvcRazorCodeParser_InjectDirectivePropertyNameRequired(InjectKeyword), - keywordwithSingleWhitespaceLength + remainingWhitespaceLength + typeName.Length); + Context.OnError( + startLocation, + Resources.FormatMvcRazorCodeParser_InjectDirectivePropertyNameRequired(InjectKeyword), + keywordwithSingleWhitespaceLength + remainingWhitespaceLength + typeName.Length); } // Read until end of line. Span now contains 'MyApp.MyService MyServiceName'. @@ -135,8 +134,8 @@ protected virtual void InjectDirective() // Parse out 'MyServicePropertyName' from the Span. var propertyName = Span.GetContent() - .Value - .Substring(typeName.Length); + .Value + .Substring(typeName.Length); // ';' is optional propertyName = RemoveWhitespaceAndTrailingSemicolons(propertyName); @@ -149,7 +148,7 @@ protected virtual void InjectDirective() private SpanChunkGenerator CreateModelChunkGenerator(string model) { - return new ModelChunkGenerator(_baseType, model); + return new ModelChunkGenerator(model); } // Internal for unit testing diff --git a/src/Microsoft.AspNet.Mvc.Razor.Host/MvcRazorHost.cs b/src/Microsoft.AspNet.Mvc.Razor.Host/MvcRazorHost.cs index fd8b80bb00..5cf3b8108e 100644 --- a/src/Microsoft.AspNet.Mvc.Razor.Host/MvcRazorHost.cs +++ b/src/Microsoft.AspNet.Mvc.Razor.Host/MvcRazorHost.cs @@ -42,11 +42,14 @@ public class MvcRazorHost : RazorEngineHost, IMvcRazorHost { LookupText = "Microsoft.AspNet.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNet.Mvc.Razor" }, + new SetBaseTypeChunk + { + // Microsoft.Aspnet.Mvc.Razor.RazorPage + TypeName = BaseType + ChunkHelper.TModelToken + } }; // CodeGenerationContext.DefaultBaseClass is set to MyBaseType. - // This field holds the type name without the generic decoration (MyBaseType) - private readonly string _baseType; private readonly IChunkTreeCache _chunkTreeCache; private readonly RazorPathNormalizer _pathNormalizer; private ChunkInheritanceUtility _chunkInheritanceUtility; @@ -56,10 +59,9 @@ internal MvcRazorHost(IChunkTreeCache chunkTreeCache, RazorPathNormalizer pathNo : base(new CSharpRazorCodeLanguage()) { _pathNormalizer = pathNormalizer; - _baseType = BaseType; _chunkTreeCache = chunkTreeCache; - DefaultBaseClass = BaseType + "<" + DefaultModel + ">"; + DefaultBaseClass = BaseType + ChunkHelper.TModelToken; DefaultNamespace = "Asp"; // Enable instrumentation by default to allow precompiled views to work with BrowserLink. EnableInstrumentation = true; @@ -279,7 +281,7 @@ public override ParserBase DecorateCodeParser(ParserBase incomingCodeParser) throw new ArgumentNullException(nameof(incomingCodeParser)); } - return new MvcRazorCodeParser(_baseType); + return new MvcRazorCodeParser(); } /// diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/DirectivesTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/DirectivesTest.cs index 84e4a05e2c..bac07d5e06 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/DirectivesTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/DirectivesTest.cs @@ -42,5 +42,20 @@ public async Task ViewInheritsBasePageFromViewStarts() // Assert Assert.Equal(expected, body.Trim()); } + + [Fact] + public async Task ViewAndViewComponentsReplaceTModelTokenFromInheritedBasePages() + { + // Arrange + var expected = +@"WriteLiteral says:

Write says:BobWriteLiteral says:

+Write says:WriteLiteral says:Write says:98052WriteLiteral says:"; + + // Act + var body = await Client.GetStringAsync("Directives/ViewReplacesTModelTokenFromInheritedBasePages"); + + // Assert + Assert.Equal(expected, body.Trim()); + } } } \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/ModelChunkVisitorTest.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/ModelChunkVisitorTest.cs deleted file mode 100644 index 1c188335f4..0000000000 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/ModelChunkVisitorTest.cs +++ /dev/null @@ -1,117 +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 Microsoft.AspNet.Mvc.Razor.Directives; -using Microsoft.AspNet.Razor; -using Microsoft.AspNet.Razor.Chunks; -using Microsoft.AspNet.Razor.Chunks.Generators; -using Microsoft.AspNet.Razor.CodeGenerators; -using Microsoft.AspNet.Razor.Generator; -using Microsoft.AspNet.Razor.Parser.SyntaxTree; -using Xunit; - -namespace Microsoft.AspNet.Mvc.Razor -{ - public class ModelChunkVisitorTest - { - [Fact] - public void Visit_IgnoresNonModelChunks() - { - // Arrange - var writer = new CSharpCodeWriter(); - var context = CreateContext(); - - var visitor = new ModelChunkVisitor(writer, context); - - // Act - visitor.Accept(new Chunk[] - { - new LiteralChunk(), - new CodeAttributeChunk() - }); - var code = writer.GenerateCode(); - - // Assert - Assert.Empty(code); - } - - [Fact] - public void Visit_GeneratesBaseClass_ForModelChunks() - { - // Arrange - var expected = -"MyBase<" + Environment.NewLine + -"#line 1 \"\"" + Environment.NewLine + -"My_Generic.After.Periods" + Environment.NewLine + -Environment.NewLine + -"#line default" + Environment.NewLine + -"#line hidden" + Environment.NewLine + -">"; - var writer = new CSharpCodeWriter(); - var context = CreateContext(); - - var visitor = new ModelChunkVisitor(writer, context); - var factory = SpanFactory.CreateCsHtml(); - var node = (Span)factory.Code("Some code") - .As(new ModelChunkGenerator("MyBase", "MyGeneric")); - - // Act - visitor.Accept(new Chunk[] - { - new LiteralChunk(), - new ModelChunk("MyBase", "My_Generic.After.Periods") { Association = node } - }); - var code = writer.GenerateCode(); - - // Assert - Assert.Equal(expected, code); - } - - [Fact] - public void Visit_WithDesignTimeHost_GeneratesBaseClass_ForModelChunks() - { - // Arrange - var expected = -"MyBase<" + Environment.NewLine + -"#line 1 \"\"" + Environment.NewLine + -"My_Generic.After.Periods" + Environment.NewLine + -Environment.NewLine + -"#line default" + Environment.NewLine + -"#line hidden" + Environment.NewLine + -">"; - var writer = new CSharpCodeWriter(); - var context = CreateContext(); - context.Host.DesignTimeMode = true; - - var visitor = new ModelChunkVisitor(writer, context); - var factory = SpanFactory.CreateCsHtml(); - var node = (Span)factory.Code("Some code") - .As(new ModelChunkGenerator("MyType", "MyPropertyName")); - - // Act - visitor.Accept(new Chunk[] - { - new LiteralChunk(), - new ModelChunk("MyBase", "My_Generic.After.Periods") { Association = node } - }); - var code = writer.GenerateCode(); - - // Assert - Assert.Equal(expected, code); - } - - private static CodeGeneratorContext CreateContext() - { - var fileProvider = new TestFileProvider(); - return new CodeGeneratorContext( - new ChunkGeneratorContext( - new MvcRazorHost(new DefaultChunkTreeCache(fileProvider)), - "MyClass", - "MyNamespace", - string.Empty, - shouldGenerateLinePragmas: true), - new ErrorSink()); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/MvcCSharpRazorCodeParserTest.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/MvcCSharpRazorCodeParserTest.cs index f0f6c0666e..6d0ecd0359 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/MvcCSharpRazorCodeParserTest.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/MvcCSharpRazorCodeParserTest.cs @@ -47,7 +47,7 @@ public void ParseModelKeyword_HandlesSingleInstance() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code(" Foo") - .As(new ModelChunkGenerator("RazorView", "Foo")) + .As(new ModelChunkGenerator("Foo")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml() }; @@ -80,7 +80,7 @@ public void ParseModelKeyword_InfersBaseType_FromModelName( factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code(modelName + Environment.NewLine) - .As(new ModelChunkGenerator("RazorView", expectedModel)) + .As(new ModelChunkGenerator(expectedModel)) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.Markup("Bar") .With(new MarkupChunkGenerator()) @@ -112,7 +112,7 @@ public void ParseModelKeyword_ErrorOnMissingModelType() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code(" ") - .As(new ModelChunkGenerator("RazorView", string.Empty)) + .As(new ModelChunkGenerator(string.Empty)) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml(), }; @@ -143,7 +143,7 @@ public void ParseModelKeyword_ErrorOnMultipleModelStatements() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code("Foo" + Environment.NewLine) - .As(new ModelChunkGenerator("RazorView", "Foo")) + .As(new ModelChunkGenerator("Foo")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml(), factory.CodeTransition(SyntaxConstants.TransitionString) @@ -151,7 +151,7 @@ public void ParseModelKeyword_ErrorOnMultipleModelStatements() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code("Bar") - .As(new ModelChunkGenerator("RazorView", "Bar")) + .As(new ModelChunkGenerator("Bar")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml() }; @@ -190,7 +190,7 @@ public void ParseModelKeyword_ErrorOnModelFollowedByInherits() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code("Foo" + Environment.NewLine) - .As(new ModelChunkGenerator("RazorView", "Foo")) + .As(new ModelChunkGenerator("Foo")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml(), factory.CodeTransition(SyntaxConstants.TransitionString) @@ -245,7 +245,7 @@ public void ParseModelKeyword_ErrorOnInheritsFollowedByModel() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code("Foo") - .As(new ModelChunkGenerator("RazorView", "Foo")) + .As(new ModelChunkGenerator("Foo")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml() }; @@ -543,11 +543,6 @@ private static List ParseDocument( private sealed class TestMvcCSharpRazorCodeParser : MvcRazorCodeParser { - public TestMvcCSharpRazorCodeParser() - : base("RazorView") - { - } - public bool HasDirective(string directive) { Action handler; diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/MvcRazorHostTest.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/MvcRazorHostTest.cs index 9d929509e3..3e27fa8245 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/MvcRazorHostTest.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/MvcRazorHostTest.cs @@ -20,7 +20,6 @@ using Microsoft.AspNet.Razor.CodeGenerators.Visitors; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Testing; -using Microsoft.Framework.Internal; using Xunit; namespace Microsoft.AspNet.Mvc.Razor @@ -127,38 +126,38 @@ public void MvcRazorHost_GeneratesTagHelperModelExpressionCode_DesignTime() { DesignTimeMode = true }; - var expectedLineMappings = new List + var expectedLineMappings = new[] { - BuildLineMapping( - documentAbsoluteIndex: 7, - documentLineIndex: 0, - documentCharacterIndex: 7, - generatedAbsoluteIndex: 444, - generatedLineIndex: 12, - generatedCharacterIndex: 7, - contentLength: 8), BuildLineMapping( documentAbsoluteIndex: 33, documentLineIndex: 2, documentCharacterIndex: 14, - generatedAbsoluteIndex: 823, - generatedLineIndex: 25, + generatedAbsoluteIndex: 718, + generatedLineIndex: 19, generatedCharacterIndex: 14, contentLength: 85), + BuildLineMapping( + documentAbsoluteIndex: 0, + documentLineIndex: 0, + documentCharacterIndex: 0, + generatedAbsoluteIndex: 910, + generatedLineIndex: 25, + generatedCharacterIndex: 0, + contentLength: 46), BuildLineMapping( documentAbsoluteIndex: 139, documentLineIndex: 4, documentCharacterIndex: 17, - generatedAbsoluteIndex: 2313, - generatedLineIndex: 55, + generatedAbsoluteIndex: 2371, + generatedLineIndex: 54, generatedCharacterIndex: 95, contentLength: 3), BuildLineMapping( documentAbsoluteIndex: 166, documentLineIndex: 5, documentCharacterIndex: 18, - generatedAbsoluteIndex: 2626, - generatedLineIndex: 61, + generatedAbsoluteIndex: 2684, + generatedLineIndex: 60, generatedCharacterIndex: 87, contentLength: 5), }; @@ -198,20 +197,28 @@ public void BasicVisitor_GeneratesCorrectLineMappings() host.NamespaceImports.Clear(); var expectedLineMappings = new[] { + BuildLineMapping( + documentAbsoluteIndex: 0, + documentLineIndex: 0, + documentCharacterIndex: 0, + generatedAbsoluteIndex: 343, + generatedLineIndex: 11, + generatedCharacterIndex: 0, + contentLength: 45), BuildLineMapping( documentAbsoluteIndex: 13, documentLineIndex: 0, documentCharacterIndex: 13, - generatedAbsoluteIndex: 1269, - generatedLineIndex: 32, + generatedAbsoluteIndex: 1412, + generatedLineIndex: 37, generatedCharacterIndex: 13, contentLength: 4), BuildLineMapping( documentAbsoluteIndex: 43, documentLineIndex: 2, documentCharacterIndex: 5, - generatedAbsoluteIndex: 1353, - generatedLineIndex: 37, + generatedAbsoluteIndex: 1496, + generatedLineIndex: 42, generatedCharacterIndex: 6, contentLength: 21), }; @@ -230,7 +237,7 @@ public void InjectVisitor_GeneratesCorrectLineMappings() DesignTimeMode = true }; host.NamespaceImports.Clear(); - var expectedLineMappings = new List + var expectedLineMappings = new[] { BuildLineMapping( documentAbsoluteIndex: 1, @@ -240,12 +247,20 @@ public void InjectVisitor_GeneratesCorrectLineMappings() generatedLineIndex: 3, generatedCharacterIndex: 0, contentLength: 17), + BuildLineMapping( + documentAbsoluteIndex: 0, + documentLineIndex: 0, + documentCharacterIndex: 0, + generatedAbsoluteIndex: 443, + generatedLineIndex: 17, + generatedCharacterIndex: 0, + contentLength: 45), BuildLineMapping( documentAbsoluteIndex: 28, documentLineIndex: 1, documentCharacterIndex: 8, - generatedAbsoluteIndex: 706, - generatedLineIndex: 26, + generatedAbsoluteIndex: 850, + generatedLineIndex: 31, generatedCharacterIndex: 8, contentLength: 20), }; @@ -267,27 +282,27 @@ public void InjectVisitorWithModel_GeneratesCorrectLineMappings() var expectedLineMappings = new[] { BuildLineMapping( - documentAbsoluteIndex: 7, + documentAbsoluteIndex: 0, documentLineIndex: 0, - documentCharacterIndex: 7, - generatedAbsoluteIndex: 214, - generatedLineIndex: 6, - generatedCharacterIndex: 7, - contentLength: 7), + documentCharacterIndex: 0, + generatedAbsoluteIndex: 363, + generatedLineIndex: 11, + generatedCharacterIndex: 0, + contentLength: 45), BuildLineMapping( documentAbsoluteIndex: 24, documentLineIndex: 1, documentCharacterIndex: 8, - generatedAbsoluteIndex: 731, - generatedLineIndex: 26, + generatedAbsoluteIndex: 788, + generatedLineIndex: 25, generatedCharacterIndex: 8, contentLength: 20), BuildLineMapping( documentAbsoluteIndex: 54, documentLineIndex: 2, documentCharacterIndex: 8, - generatedAbsoluteIndex: 957, - generatedLineIndex: 34, + generatedAbsoluteIndex: 1014, + generatedLineIndex: 33, generatedCharacterIndex: 8, contentLength: 23), }; @@ -309,43 +324,43 @@ public void InjectVisitorWithSemicolon_GeneratesCorrectLineMappings() var expectedLineMappings = new[] { BuildLineMapping( - documentAbsoluteIndex: 7, + documentAbsoluteIndex: 0, documentLineIndex: 0, - documentCharacterIndex: 7, - generatedAbsoluteIndex: 222, - generatedLineIndex: 6, - generatedCharacterIndex: 7, - contentLength: 7), + documentCharacterIndex: 0, + generatedAbsoluteIndex: 371, + generatedLineIndex: 11, + generatedCharacterIndex: 0, + contentLength: 45), BuildLineMapping( documentAbsoluteIndex: 24, documentLineIndex: 1, documentCharacterIndex: 8, - generatedAbsoluteIndex: 747, - generatedLineIndex: 26, + generatedAbsoluteIndex: 804, + generatedLineIndex: 25, generatedCharacterIndex: 8, contentLength: 20), BuildLineMapping( documentAbsoluteIndex: 58, documentLineIndex: 2, documentCharacterIndex: 8, - generatedAbsoluteIndex: 977, - generatedLineIndex: 34, + generatedAbsoluteIndex: 1034, + generatedLineIndex: 33, generatedCharacterIndex: 8, contentLength: 23), BuildLineMapping( documentAbsoluteIndex: 93, documentLineIndex: 3, documentCharacterIndex: 8, - generatedAbsoluteIndex: 1210, - generatedLineIndex: 42, + generatedAbsoluteIndex: 1267, + generatedLineIndex: 41, generatedCharacterIndex: 8, contentLength: 21), BuildLineMapping( documentAbsoluteIndex: 129, documentLineIndex: 4, documentCharacterIndex: 8, - generatedAbsoluteIndex: 1441, - generatedLineIndex: 50, + generatedAbsoluteIndex: 1498, + generatedLineIndex: 49, generatedCharacterIndex: 8, contentLength: 24), }; @@ -366,7 +381,14 @@ public void ModelVisitor_GeneratesCorrectLineMappings() host.NamespaceImports.Clear(); var expectedLineMappings = new[] { - BuildLineMapping(7, 0, 7, 194, 6, 7, 30), + BuildLineMapping( + documentAbsoluteIndex: 0, + documentLineIndex: 0, + documentCharacterIndex: 0, + generatedAbsoluteIndex: 366, + generatedLineIndex: 11, + generatedCharacterIndex: 0, + contentLength: 68), }; // Act and Assert diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Basic.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Basic.cs index 12b8fe71b3..0b4e72cce3 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Basic.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Basic.cs @@ -8,6 +8,11 @@ public class ASPV_TestFiles_Input_Basic_cshtml : Microsoft.AspNet.Mvc.Razor.Razo private void @__RazorDesignTimeHelpers__() { #pragma warning disable 219 +#line 1 "TestFiles/Input/Basic.cshtml" +Microsoft.AspNet.Mvc.Razor.RazorPage __inheritsHelper = null; + +#line default +#line hidden #pragma warning restore 219 } #line hidden diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Inject.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Inject.cs index daeb196d90..0525e6b978 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Inject.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Inject.cs @@ -14,6 +14,11 @@ public class ASPV_TestFiles_Input_Inject_cshtml : Microsoft.AspNet.Mvc.Razor.Raz private void @__RazorDesignTimeHelpers__() { #pragma warning disable 219 +#line 1 "TestFiles/Input/Inject.cshtml" +Microsoft.AspNet.Mvc.Razor.RazorPage __inheritsHelper = null; + +#line default +#line hidden #pragma warning restore 219 } #line hidden diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/InjectWithModel.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/InjectWithModel.cs index f450aaa679..85d744bcf4 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/InjectWithModel.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/InjectWithModel.cs @@ -2,18 +2,17 @@ namespace Asp { using System.Threading.Tasks; - public class ASPV_TestFiles_Input_InjectWithModel_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage< -#line 1 "TestFiles/Input/InjectWithModel.cshtml" - MyModel - -#line default -#line hidden - > + public class ASPV_TestFiles_Input_InjectWithModel_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage { private static object @__o; private void @__RazorDesignTimeHelpers__() { #pragma warning disable 219 +#line 1 "TestFiles/Input/InjectWithModel.cshtml" +Microsoft.AspNet.Mvc.Razor.RazorPage __inheritsHelper = null; + +#line default +#line hidden #pragma warning restore 219 } #line hidden diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/InjectWithSemicolon.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/InjectWithSemicolon.cs index 870cfefac0..e21e518fdd 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/InjectWithSemicolon.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/InjectWithSemicolon.cs @@ -2,18 +2,17 @@ namespace Asp { using System.Threading.Tasks; - public class ASPV_TestFiles_Input_InjectWithSemicolon_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage< -#line 1 "TestFiles/Input/InjectWithSemicolon.cshtml" - MyModel - -#line default -#line hidden - > + public class ASPV_TestFiles_Input_InjectWithSemicolon_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage { private static object @__o; private void @__RazorDesignTimeHelpers__() { #pragma warning disable 219 +#line 1 "TestFiles/Input/InjectWithSemicolon.cshtml" +Microsoft.AspNet.Mvc.Razor.RazorPage __inheritsHelper = null; + +#line default +#line hidden #pragma warning restore 219 } #line hidden diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Model.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Model.cs index fd10a02d57..1f5d2ac9d9 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Model.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/Model.cs @@ -2,18 +2,17 @@ namespace Asp { using System.Threading.Tasks; - public class ASPV_TestFiles_Input_Model_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage< -#line 1 "TestFiles/Input/Model.cshtml" - System.Collections.IEnumerable - -#line default -#line hidden - > + public class ASPV_TestFiles_Input_Model_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage { private static object @__o; private void @__RazorDesignTimeHelpers__() { #pragma warning disable 219 +#line 1 "TestFiles/Input/Model.cshtml" +Microsoft.AspNet.Mvc.Razor.RazorPage __inheritsHelper = null; + +#line default +#line hidden #pragma warning restore 219 } #line hidden diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.cs index 8cc6727db1..2ff199a009 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.cs @@ -8,13 +8,7 @@ namespace Asp using Microsoft.AspNet.Mvc.Rendering; using System.Threading.Tasks; - public class ASPV_TestFiles_Input_ModelExpressionTagHelper_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage< -#line 1 "TestFiles/Input/ModelExpressionTagHelper.cshtml" - DateTime - -#line default -#line hidden - > + public class ASPV_TestFiles_Input_ModelExpressionTagHelper_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage { private static object @__o; private void @__RazorDesignTimeHelpers__() @@ -28,6 +22,11 @@ private void @__RazorDesignTimeHelpers__() #line default #line hidden ; +#line 1 "TestFiles/Input/ModelExpressionTagHelper.cshtml" +Microsoft.AspNet.Mvc.Razor.RazorPage __inheritsHelper = null; + +#line default +#line hidden #pragma warning restore 219 } #line hidden diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/InjectWithModel.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/InjectWithModel.cs index ade4477345..cd2685ae8d 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/InjectWithModel.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/InjectWithModel.cs @@ -8,13 +8,7 @@ namespace Asp using Microsoft.AspNet.Mvc.Rendering; using System.Threading.Tasks; - public class ASPV_TestFiles_Input_InjectWithModel_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage< -#line 1 "TestFiles/Input/InjectWithModel.cshtml" - MyModel - -#line default -#line hidden - > + public class ASPV_TestFiles_Input_InjectWithModel_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage { #line hidden public ASPV_TestFiles_Input_InjectWithModel_cshtml() diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/InjectWithSemicolon.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/InjectWithSemicolon.cs index a8e1c90e5e..0aaa447dbb 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/InjectWithSemicolon.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/InjectWithSemicolon.cs @@ -8,13 +8,7 @@ namespace Asp using Microsoft.AspNet.Mvc.Rendering; using System.Threading.Tasks; - public class ASPV_TestFiles_Input_InjectWithSemicolon_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage< -#line 1 "TestFiles/Input/InjectWithSemicolon.cshtml" - MyModel - -#line default -#line hidden - > + public class ASPV_TestFiles_Input_InjectWithSemicolon_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage { #line hidden public ASPV_TestFiles_Input_InjectWithSemicolon_cshtml() diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/Model.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/Model.cs index 9e37256e86..9bf4df5725 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/Model.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/Model.cs @@ -8,13 +8,7 @@ namespace Asp using Microsoft.AspNet.Mvc.Rendering; using System.Threading.Tasks; - public class ASPV_TestFiles_Input_Model_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage< -#line 1 "TestFiles/Input/Model.cshtml" - System.Collections.IEnumerable - -#line default -#line hidden - > + public class ASPV_TestFiles_Input_Model_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage { #line hidden public ASPV_TestFiles_Input_Model_cshtml() diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs index 80f62e1b9f..df9436836a 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs @@ -9,13 +9,7 @@ namespace Asp using Microsoft.AspNet.Mvc.Rendering; using System.Threading.Tasks; - public class ASPV_TestFiles_Input_ModelExpressionTagHelper_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage< -#line 1 "TestFiles/Input/ModelExpressionTagHelper.cshtml" - DateTime - -#line default -#line hidden - > + public class ASPV_TestFiles_Input_ModelExpressionTagHelper_cshtml : Microsoft.AspNet.Mvc.Razor.RazorPage { #line hidden #pragma warning disable 0414 diff --git a/test/Microsoft.AspNet.Mvc.Razor.Test/MvcRazorCodeParserTest.cs b/test/Microsoft.AspNet.Mvc.Razor.Test/MvcRazorCodeParserTest.cs index 423eddec79..e512743261 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Test/MvcRazorCodeParserTest.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Test/MvcRazorCodeParserTest.cs @@ -16,8 +16,6 @@ namespace Microsoft.AspNet.Mvc.Razor.Host.Test { public class MvcRazorCodeParserTest { - private const string DefaultBaseType = "Microsoft.AspNet.ViewPage"; - [Fact] public void Constructor_AddsModelKeyword() { @@ -43,7 +41,7 @@ public void ParseModelKeyword_HandlesSingleInstance() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code(" Foo") - .As(new ModelChunkGenerator(DefaultBaseType, "Foo")) + .As(new ModelChunkGenerator("Foo")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml() }; @@ -67,7 +65,7 @@ public void ParseModelKeyword_HandlesNullableTypes() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code("Foo?" + Environment.NewLine) - .As(new ModelChunkGenerator(DefaultBaseType, "Foo?")) + .As(new ModelChunkGenerator("Foo?")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.Markup("Bar") .With(new MarkupChunkGenerator()) @@ -92,7 +90,7 @@ public void ParseModelKeyword_HandlesArrays() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code("Foo[[]][]" + Environment.NewLine) - .As(new ModelChunkGenerator(DefaultBaseType, "Foo[[]][]")) + .As(new ModelChunkGenerator("Foo[[]][]")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.Markup("Bar") .With(new MarkupChunkGenerator()) @@ -117,7 +115,7 @@ public void ParseModelKeyword_HandlesVSTemplateSyntax() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code("$rootnamespace$.MyModel") - .As(new ModelChunkGenerator(DefaultBaseType, "$rootnamespace$.MyModel")) + .As(new ModelChunkGenerator("$rootnamespace$.MyModel")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml() }; @@ -142,7 +140,7 @@ public void ParseModelKeyword_ErrorOnMissingModelType() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code(" ") - .As(new ModelChunkGenerator(DefaultBaseType, string.Empty)) + .As(new ModelChunkGenerator(string.Empty)) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml() }; @@ -174,7 +172,7 @@ public void ParseModelKeyword_ErrorOnMultipleModelStatements() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code("Foo" + Environment.NewLine) - .As(new ModelChunkGenerator(DefaultBaseType, "Foo")) + .As(new ModelChunkGenerator("Foo")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml(), factory.CodeTransition(SyntaxConstants.TransitionString) @@ -182,7 +180,7 @@ public void ParseModelKeyword_ErrorOnMultipleModelStatements() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code("Bar") - .As(new ModelChunkGenerator(DefaultBaseType, "Bar")) + .As(new ModelChunkGenerator("Bar")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml() }; @@ -219,7 +217,7 @@ public void ParseModelKeyword_ErrorOnModelFollowedByInherits() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code("Foo" + Environment.NewLine) - .As(new ModelChunkGenerator(DefaultBaseType, "Foo")) + .As(new ModelChunkGenerator("Foo")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml(), factory.CodeTransition(SyntaxConstants.TransitionString) @@ -272,7 +270,7 @@ public void ParseModelKeyword_ErrorOnInheritsFollowedByModel() factory.MetaCode("model ") .Accepts(AcceptedCharacters.None), factory.Code("Foo") - .As(new ModelChunkGenerator(DefaultBaseType, "Foo")) + .As(new ModelChunkGenerator("Foo")) .Accepts(AcceptedCharacters.AnyExceptNewline), factory.EmptyHtml() }; @@ -314,12 +312,6 @@ private static List ParseDocument(string documentContents, IList@Model.Name +@Component.Invoke("InheritingViewComponent", Model.Address) \ No newline at end of file diff --git a/test/WebSites/RazorWebSite/Views/InheritingInherits/_ViewComponent.cshtml b/test/WebSites/RazorWebSite/Views/InheritingInherits/_ViewComponent.cshtml new file mode 100644 index 0000000000..4291f267d0 --- /dev/null +++ b/test/WebSites/RazorWebSite/Views/InheritingInherits/_ViewComponent.cshtml @@ -0,0 +1,2 @@ +@model Address +@Model.ZipCode \ No newline at end of file diff --git a/test/WebSites/RazorWebSite/Views/InheritingInherits/_ViewImports.cshtml b/test/WebSites/RazorWebSite/Views/InheritingInherits/_ViewImports.cshtml new file mode 100644 index 0000000000..da3ea1b89e --- /dev/null +++ b/test/WebSites/RazorWebSite/Views/InheritingInherits/_ViewImports.cshtml @@ -0,0 +1 @@ +@inherits MyBasePage \ No newline at end of file