diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorDirectiveFeature.cs b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorDirectiveFeature.cs index 5fb597984f..f94e3db4e8 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorDirectiveFeature.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorDirectiveFeature.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; namespace Microsoft.AspNetCore.Razor.Evolution { - internal class DefaultRazorDirectiveFeature : IRazorDirectiveFeature, IRazorConfigureParserFeature + internal class DefaultRazorDirectiveFeature : IRazorDirectiveFeature, IRazorParserOptionsFeature { public ICollection Directives { get; } = new List(); @@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution public int Order => 100; - void IRazorConfigureParserFeature.Configure(RazorParserOptions options) + void IRazorParserOptionsFeature.Configure(RazorParserOptions options) { options.Directives.Clear(); diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorParsingPhase.cs b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorParsingPhase.cs index 1e344ca25d..dd9eba432a 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorParsingPhase.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorParsingPhase.cs @@ -7,11 +7,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution { internal class DefaultRazorParsingPhase : RazorEnginePhaseBase, IRazorParsingPhase { - private IRazorConfigureParserFeature[] _parserOptionsCallbacks; + private IRazorParserOptionsFeature[] _parserOptionsCallbacks; protected override void OnIntialized() { - _parserOptionsCallbacks = Engine.Features.OfType().ToArray(); + _parserOptionsCallbacks = Engine.Features.OfType().ToArray(); } protected override void ExecuteCore(RazorCodeDocument codeDocument) diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/DesignTimeParserOptionsFeature.cs b/src/Microsoft.AspNetCore.Razor.Evolution/DesignTimeParserOptionsFeature.cs new file mode 100644 index 0000000000..f52d2948dd --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Evolution/DesignTimeParserOptionsFeature.cs @@ -0,0 +1,17 @@ +// 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. + +namespace Microsoft.AspNetCore.Razor.Evolution +{ + internal class DesignTimeParserOptionsFeature : IRazorParserOptionsFeature + { + public RazorEngine Engine { get; set; } + + public int Order { get; set; } + + public void Configure(RazorParserOptions options) + { + options.DesignTimeMode = true; + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/IRazorConfigureParserFeature.cs b/src/Microsoft.AspNetCore.Razor.Evolution/IRazorParserOptionsFeature.cs similarity index 80% rename from src/Microsoft.AspNetCore.Razor.Evolution/IRazorConfigureParserFeature.cs rename to src/Microsoft.AspNetCore.Razor.Evolution/IRazorParserOptionsFeature.cs index 588a5516d6..dca4f725f6 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/IRazorConfigureParserFeature.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/IRazorParserOptionsFeature.cs @@ -3,7 +3,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution { - internal interface IRazorConfigureParserFeature : IRazorEngineFeature + public interface IRazorParserOptionsFeature : IRazorEngineFeature { int Order { get; } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/RazorEngine.cs b/src/Microsoft.AspNetCore.Razor.Evolution/RazorEngine.cs index 6e30191215..1a68e114ed 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/RazorEngine.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/RazorEngine.cs @@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution internal static void AddDesignTimeDefaults(IRazorEngineBuilder builder) { - builder.Features.Add(new ConfigureDesignTimeOptions()); + builder.Features.Add(new DesignTimeParserOptionsFeature()); builder.Features.Add(new RazorDesignTimeIRPass()); } @@ -116,17 +116,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution public abstract IReadOnlyList Phases { get; } public abstract void Process(RazorCodeDocument document); - - internal class ConfigureDesignTimeOptions : IRazorConfigureParserFeature - { - public RazorEngine Engine { get; set; } - - public int Order { get; set; } - - public void Configure(RazorParserOptions options) - { - options.DesignTimeMode = true; - } - } } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/DefaultRazorParsingPhaseTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/DefaultRazorParsingPhaseTest.cs index c852e0b3b3..1ba99a8fd6 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/DefaultRazorParsingPhaseTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/DefaultRazorParsingPhaseTest.cs @@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution var engine = RazorEngine.CreateEmpty((b) => { b.Phases.Add(phase); - b.Features.Add(new MyConfigureParserOptions()); + b.Features.Add(new MyParserOptionsFeature()); }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); @@ -54,7 +54,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution var engine = RazorEngine.CreateEmpty((b) => { b.Phases.Add(phase); - b.Features.Add(new MyConfigureParserOptions()); + b.Features.Add(new MyParserOptionsFeature()); }); var imports = new[] @@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution t => { Assert.Same(t.Source, imports[1]); Assert.Equal("test_directive", Assert.Single(t.Options.Directives).Name); }); } - private class MyConfigureParserOptions : IRazorConfigureParserFeature + private class MyParserOptionsFeature : IRazorParserOptionsFeature { public RazorEngine Engine { get; set; } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineTest.cs index 068d2da49f..023a7e3ddd 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineTest.cs @@ -185,7 +185,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution feature => Assert.IsType(feature), feature => Assert.IsType(feature), feature => Assert.IsType(feature), - feature => Assert.IsType(feature), + feature => Assert.IsType(feature), feature => Assert.IsType(feature)); }