Obsoleted IRazorEngineBuilder APIs

This commit is contained in:
Ajay Bhargav Baaskaran 2018-04-11 14:58:23 -07:00
parent 6130eb0ec5
commit f8dc5c4702
166 changed files with 1052 additions and 792 deletions

View File

@ -106,6 +106,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
}
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static IRazorEngineBuilder Register(IRazorEngineBuilder builder)
{
if (builder == null)

View File

@ -128,6 +128,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
}
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static IRazorEngineBuilder Register(IRazorEngineBuilder builder)
{
if (builder == null)

View File

@ -55,6 +55,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
}
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static void Register(IRazorEngineBuilder builder)
{
if (builder == null)
@ -86,6 +87,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
builder.Features.Add(new MvcViewDocumentClassifierPass());
}
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static void RegisterViewComponentTagHelpers(IRazorEngineBuilder builder)
{
if (builder == null)
@ -100,7 +102,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
builder.AddTargetExtension(new ViewComponentTagHelperTargetExtension());
}
#pragma warning disable CS0618 // Type or member is obsolete
private static void EnsureDesignTime(IRazorEngineBuilder builder)
#pragma warning restore CS0618 // Type or member is obsolete
{
if (builder.DesignTime)
{

View File

@ -106,6 +106,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
}
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static IRazorEngineBuilder Register(IRazorEngineBuilder builder)
{
if (builder == null)

View File

@ -135,6 +135,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
}
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static IRazorEngineBuilder Register(IRazorEngineBuilder builder)
{
if (builder == null)

View File

@ -188,6 +188,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
}
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static void Register(IRazorEngineBuilder builder)
{
if (builder == null)

View File

@ -105,6 +105,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
}
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static IRazorEngineBuilder Register(IRazorEngineBuilder builder)
{
if (builder == null)

View File

@ -47,6 +47,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
}
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static void Register(IRazorEngineBuilder builder)
{
if (builder == null)

View File

@ -6,7 +6,9 @@ using System.Collections.Generic;
namespace Microsoft.AspNetCore.Razor.Language
{
#pragma warning disable CS0618 // Type or member is obsolete
internal class DefaultRazorEngineBuilder : IRazorEngineBuilder
#pragma warning restore CS0618 // Type or member is obsolete
{
public DefaultRazorEngineBuilder(bool designTime)
{

View File

@ -32,14 +32,18 @@ namespace Microsoft.AspNetCore.Razor.Language
public override RazorProjectEngine Build()
{
#pragma warning disable CS0618 // Type or member is obsolete
var engine = RazorEngine.CreateEmpty(ConfigureRazorEngine);
#pragma warning restore CS0618 // Type or member is obsolete
var projectFeatures = Features.OfType<IRazorProjectEngineFeature>().ToArray();
var projectEngine = new DefaultRazorProjectEngine(Configuration, engine, FileSystem, projectFeatures);
return projectEngine;
}
#pragma warning disable CS0618 // Type or member is obsolete
private void ConfigureRazorEngine(IRazorEngineBuilder engineBuilder)
#pragma warning disable CS0618 // Type or member is obsolete
{
var engineFeatures = Features.OfType<IRazorEngineFeature>();
foreach (var engineFeature in engineFeatures)

View File

@ -28,6 +28,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
}
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static void Register(IRazorEngineBuilder builder)
{
if (builder == null)

View File

@ -30,6 +30,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
}
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static void Register(IRazorEngineBuilder builder)
{
if (builder == null)

View File

@ -10,8 +10,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
{
internal class PreallocatedTagHelperAttributeOptimizationPass : IntermediateNodePassBase, IRazorOptimizationPass
{
// We want to run after the passes that 'lower' tag helpers.
public override int Order => DefaultFeatureOrder + 1000;
// We want to run after the passes that 'lower' tag helpers. We also want this to run after DefaultTagHelperOptimizationPass.
public override int Order => DefaultFeatureOrder + 1010;
protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode)
{

View File

@ -30,6 +30,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
}
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static void Register(IRazorEngineBuilder builder)
{
if (builder == null)

View File

@ -1,10 +1,12 @@
// 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;
namespace Microsoft.AspNetCore.Razor.Language
{
[Obsolete("This class is obsolete and will be removed in a future version. The recommended alternative is " + nameof(RazorProjectEngineBuilder) + ".")]
public interface IRazorEngineBuilder
{
ICollection<IRazorEngineFeature> Features { get; }

View File

@ -12,22 +12,9 @@ namespace Microsoft.AspNetCore.Razor.Language
{
public abstract class RazorEngine
{
public static RazorEngine Create()
{
return Create(configure: null);
}
public static RazorEngine Create(Action<IRazorEngineBuilder> configure) => CreateCore(RazorConfiguration.Default, false, configure);
public static RazorEngine CreateDesignTime()
{
return CreateDesignTime(configure: null);
}
public static RazorEngine CreateDesignTime(Action<IRazorEngineBuilder> configure) => CreateCore(RazorConfiguration.Default, true, configure);
// Internal since RazorEngine APIs are going to be obsolete.
internal static RazorEngine CreateCore(RazorConfiguration configuration, bool designTime, Action<IRazorEngineBuilder> configure)
#pragma warning disable CS0618 // Type or member is obsolete
private static RazorEngine CreateCore(RazorConfiguration configuration, bool designTime, Action<IRazorEngineBuilder> configure)
#pragma warning disable CS0618 // Type or member is obsolete
{
if (configuration == null)
{
@ -50,37 +37,15 @@ namespace Microsoft.AspNetCore.Razor.Language
return builder.Build();
}
public static RazorEngine CreateEmpty(Action<IRazorEngineBuilder> configure)
{
if (configure == null)
{
throw new ArgumentNullException(nameof(configure));
}
var builder = new DefaultRazorEngineBuilder(designTime: false);
configure(builder);
return builder.Build();
}
public static RazorEngine CreateDesignTimeEmpty(Action<IRazorEngineBuilder> configure)
{
if (configure == null)
{
throw new ArgumentNullException(nameof(configure));
}
var builder = new DefaultRazorEngineBuilder(designTime: true);
configure(builder);
return builder.Build();
}
internal static void AddDefaults(IRazorEngineBuilder builder)
#pragma warning disable CS0618 // Type or member is obsolete
private static void AddDefaults(IRazorEngineBuilder builder)
#pragma warning restore CS0618 // Type or member is obsolete
{
AddDefaultPhases(builder.Phases);
AddDefaultFeatures(builder.Features);
}
internal static void AddDefaultPhases(IList<IRazorEnginePhase> phases)
private static void AddDefaultPhases(IList<IRazorEnginePhase> phases)
{
phases.Add(new DefaultRazorParsingPhase());
phases.Add(new DefaultRazorSyntaxTreePhase());
@ -92,7 +57,7 @@ namespace Microsoft.AspNetCore.Razor.Language
phases.Add(new DefaultRazorCSharpLoweringPhase());
}
internal static void AddDefaultFeatures(ICollection<IRazorEngineFeature> features)
private static void AddDefaultFeatures(ICollection<IRazorEngineFeature> features)
{
// General extensibility
features.Add(new DefaultRazorDirectiveFeature());
@ -139,7 +104,7 @@ namespace Microsoft.AspNetCore.Razor.Language
features.Add(configurationFeature);
}
internal static void AddDefaultRuntimeFeatures(RazorConfiguration configuration, ICollection<IRazorEngineFeature> features)
private static void AddDefaultRuntimeFeatures(RazorConfiguration configuration, ICollection<IRazorEngineFeature> features)
{
// Configure options
features.Add(new DefaultRazorParserOptionsFeature(designTime: false, version: configuration.LanguageVersion));
@ -156,7 +121,7 @@ namespace Microsoft.AspNetCore.Razor.Language
targetExtension.TargetExtensions.Add(new PreallocatedAttributeTargetExtension());
}
internal static void AddDefaultDesignTimeFeatures(RazorConfiguration configuration, ICollection<IRazorEngineFeature> features)
private static void AddDefaultDesignTimeFeatures(RazorConfiguration configuration, ICollection<IRazorEngineFeature> features)
{
// Configure options
features.Add(new DefaultRazorParserOptionsFeature(designTime: true, version: configuration.LanguageVersion));
@ -179,6 +144,52 @@ namespace Microsoft.AspNetCore.Razor.Language
public abstract IReadOnlyList<IRazorEnginePhase> Phases { get; }
public abstract void Process(RazorCodeDocument document);
#region Obsolete
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static RazorEngine Create()
{
return Create(configure: null);
}
[Obsolete("This method is obsolete and will be removed in a future version. The recommended alternative is " + nameof(RazorProjectEngine) + "." + nameof(RazorProjectEngine.Create))]
public static RazorEngine Create(Action<IRazorEngineBuilder> configure) => CreateCore(RazorConfiguration.Default, false, configure);
[Obsolete("This method is obsolete and will be removed in a future version. The recommended alternative is " + nameof(RazorProjectEngine) + "." + nameof(RazorProjectEngine.Create))]
public static RazorEngine CreateDesignTime()
{
return CreateDesignTime(configure: null);
}
[Obsolete("This method is obsolete and will be removed in a future version. The recommended alternative is " + nameof(RazorProjectEngine) + "." + nameof(RazorProjectEngine.Create))]
public static RazorEngine CreateDesignTime(Action<IRazorEngineBuilder> configure) => CreateCore(RazorConfiguration.Default, true, configure);
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static RazorEngine CreateEmpty(Action<IRazorEngineBuilder> configure)
{
if (configure == null)
{
throw new ArgumentNullException(nameof(configure));
}
var builder = new DefaultRazorEngineBuilder(designTime: false);
configure(builder);
return builder.Build();
}
[Obsolete("This method is obsolete and will be removed in a future version.")]
public static RazorEngine CreateDesignTimeEmpty(Action<IRazorEngineBuilder> configure)
{
if (configure == null)
{
throw new ArgumentNullException(nameof(configure));
}
var builder = new DefaultRazorEngineBuilder(designTime: true);
configure(builder);
return builder.Build();
}
#endregion
}
}

View File

@ -11,6 +11,7 @@ namespace Microsoft.AspNetCore.Razor.Language
/// <summary>
/// Extension methods to <see cref="IRazorEngineBuilder" />.
/// </summary>
[Obsolete("This class is obsolete and will be removed in a future version. The recommended alternative is " + nameof(RazorProjectEngineBuilderExtensions) + ".")]
public static class RazorEngineBuilderExtensions
{
/// <summary>

View File

@ -53,6 +53,19 @@ namespace Microsoft.AspNetCore.Razor.Language
protected abstract void ProcessCore(RazorCodeDocument codeDocument);
internal static RazorProjectEngine CreateEmpty(Action<RazorProjectEngineBuilder> configure = null)
{
var builder = new DefaultRazorProjectEngineBuilder(RazorConfiguration.Default, RazorProjectFileSystem.Empty);
configure?.Invoke(builder);
return builder.Build();
}
internal static RazorProjectEngine Create() => Create(configure: null);
internal static RazorProjectEngine Create(Action<RazorProjectEngineBuilder> configure) => Create(RazorConfiguration.Default, RazorProjectFileSystem.Empty, configure);
public static RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem) => Create(configuration, fileSystem, configure: null);
public static RazorProjectEngine Create(
@ -78,7 +91,7 @@ namespace Microsoft.AspNetCore.Razor.Language
//
// This allows extensions to rely on default features, and customizations to override choices made by
// extensions.
RazorEngine.AddDefaultPhases(builder.Phases);
AddDefaultPhases(builder.Phases);
AddDefaultsFeatures(builder.Features);
LoadExtensions(builder, configuration.Extensions);
@ -87,7 +100,19 @@ namespace Microsoft.AspNetCore.Razor.Language
return builder.Build();
}
private static void AddDefaultPhases(IList<IRazorEnginePhase> phases)
{
phases.Add(new DefaultRazorParsingPhase());
phases.Add(new DefaultRazorSyntaxTreePhase());
phases.Add(new DefaultRazorTagHelperBinderPhase());
phases.Add(new DefaultRazorIntermediateNodeLoweringPhase());
phases.Add(new DefaultRazorDocumentClassifierPhase());
phases.Add(new DefaultRazorDirectiveClassifierPhase());
phases.Add(new DefaultRazorOptimizationPhase());
phases.Add(new DefaultRazorCSharpLoweringPhase());
}
private static void AddDefaultsFeatures(ICollection<IRazorFeature> features)
{
features.Add(new DefaultImportProjectFeature());
@ -109,7 +134,6 @@ namespace Microsoft.AspNetCore.Razor.Language
// Syntax Tree passes
features.Add(new DefaultDirectiveSyntaxTreePass());
features.Add(new HtmlNodeOptimizationPass());
features.Add(new PreallocatedTagHelperAttributeOptimizationPass());
// Intermediate Node Passes
features.Add(new DefaultDocumentClassifierPass());
@ -117,6 +141,7 @@ namespace Microsoft.AspNetCore.Razor.Language
features.Add(new DesignTimeDirectivePass());
features.Add(new DirectiveRemovalOptimizationPass());
features.Add(new DefaultTagHelperOptimizationPass());
features.Add(new PreallocatedTagHelperAttributeOptimizationPass());
// Default Code Target Extensions
var targetExtensionFeature = new DefaultRazorTargetExtensionFeature();

View File

@ -32,8 +32,8 @@ namespace Microsoft.CodeAnalysis.Remote.Razor
{
var projectId = ProjectId.CreateFromSerialized(projectIdBytes, projectDebugName);
var engine = RazorEngine.Create();
var directives = engine.Features.OfType<IRazorDirectiveFeature>().FirstOrDefault()?.Directives;
var projectEngine = RazorProjectEngine.Create();
var directives = projectEngine.EngineFeatures.OfType<IRazorDirectiveFeature>().FirstOrDefault()?.Directives;
return Task.FromResult(directives ?? Enumerable.Empty<DirectiveDescriptor>());
}
@ -41,7 +41,7 @@ namespace Microsoft.CodeAnalysis.Remote.Razor
{
var projectId = ProjectId.CreateFromSerialized(projectIdBytes, projectDebugName);
var engine = RazorEngine.Create();
var projectEngine = RazorProjectEngine.Create();
RazorSourceDocument source;
using (var stream = new MemoryStream())
@ -54,7 +54,7 @@ namespace Microsoft.CodeAnalysis.Remote.Razor
}
var code = RazorCodeDocument.Create(source);
engine.Process(code);
projectEngine.Engine.Process(code);
var csharp = code.GetCSharpDocument();
if (csharp == null)

View File

@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new AssemblyAttributeInjectionPass
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
// Act
@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new AssemblyAttributeInjectionPass
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
// Act
@ -71,7 +71,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new AssemblyAttributeInjectionPass
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
// Act
@ -112,7 +112,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new AssemblyAttributeInjectionPass
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
// Act
@ -147,7 +147,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new AssemblyAttributeInjectionPass
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
// Act
@ -190,7 +190,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new AssemblyAttributeInjectionPass
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
var source = TestRazorSourceDocument.Create("test", new RazorSourceDocumentProperties(filePath: null, relativePath: "/Views/Index.cshtml"));
@ -237,7 +237,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new AssemblyAttributeInjectionPass
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
var source = TestRazorSourceDocument.Create("test", new RazorSourceDocumentProperties(filePath: null, relativePath: "/Views/Index.cshtml"));
@ -290,7 +290,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new AssemblyAttributeInjectionPass
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
var source = TestRazorSourceDocument.Create("test", new RazorSourceDocumentProperties(filePath: null, relativePath: "\\test\\\"Index.cshtml"));
@ -349,7 +349,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new AssemblyAttributeInjectionPass
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
var source = TestRazorSourceDocument.Create("test", new RazorSourceDocumentProperties(filePath: null, relativePath: "/Views/Index.cshtml"));
@ -404,7 +404,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new AssemblyAttributeInjectionPass
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
var source = TestRazorSourceDocument.Create("test", new RazorSourceDocumentProperties(filePath: null, relativePath: "test\\\"Index.cshtml"));
@ -425,15 +425,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
node => Assert.Same(@namespace, node));
}
private RazorEngine CreateEngine()
{
return RazorEngine.Create(b =>
{
// Notice we're not registering the InjectDirective.Pass here so we can run it on demand.
b.Features.Add(new AssemblyAttributeInjectionPass());
});
}
private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
{
for (var i = 0; i < engine.Phases.Count; i++)

View File

@ -173,12 +173,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
private RazorEngine CreateEngine()
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
// Notice we're not registering the InjectDirective.Pass here so we can run it on demand.
b.AddDirective(InjectDirective.Directive);
b.AddDirective(ModelDirective.Directive);
});
}).Engine;
}
private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)

View File

@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new InstrumentationPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = RazorProjectEngine.CreateEmpty().Engine,
};
// Act
@ -67,7 +67,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new InstrumentationPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = RazorProjectEngine.CreateEmpty().Engine,
};
// Act
@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new InstrumentationPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = RazorProjectEngine.CreateEmpty().Engine,
};
// Act
@ -135,7 +135,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new InstrumentationPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = RazorProjectEngine.CreateEmpty().Engine,
};
// Act
@ -168,7 +168,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new InstrumentationPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = RazorProjectEngine.CreateEmpty().Engine,
};
// Act
@ -207,7 +207,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new InstrumentationPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = RazorProjectEngine.CreateEmpty().Engine,
};
// Act
@ -258,7 +258,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new InstrumentationPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = RazorProjectEngine.CreateEmpty().Engine,
};
// Act
@ -299,7 +299,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new InstrumentationPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = RazorProjectEngine.CreateEmpty().Engine,
};
// Act
@ -327,7 +327,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var pass = new InstrumentationPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = RazorProjectEngine.CreateEmpty().Engine,
};
// Act

View File

@ -1,6 +1,7 @@
// 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.IO;
using System.Linq;
@ -10,7 +11,6 @@ using Microsoft.AspNetCore.Razor.Language.IntegrationTests;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Razor;
using Xunit;
@ -602,11 +602,11 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
Assert.Empty(baseCompilation.GetDiagnostics());
// Arrange
var engine = CreateRuntimeEngine(baseCompilation);
var document = CreateCodeDocument();
var engine = CreateEngine(baseCompilation);
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var document = engine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
@ -621,11 +621,11 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
Assert.Empty(baseCompilation.GetDiagnostics());
// Arrange
var engine = CreateDesignTimeEngine(baseCompilation);
var document = CreateCodeDocument();
var engine = CreateEngine(baseCompilation);
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var document = engine.ProcessDesignTime(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
@ -661,68 +661,22 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
}
}
protected RazorEngine CreateDesignTimeEngine(CSharpCompilation compilation)
protected RazorProjectEngine CreateEngine(CSharpCompilation compilation)
{
var references = compilation.References.Concat(new[] { compilation.ToMetadataReference() });
return RazorEngine.CreateDesignTime(b =>
return CreateProjectEngine(b =>
{
RazorExtensions.Register(b);
var existingImportFeature = b.Features.OfType<IImportProjectFeature>().Single();
b.SetImportFeature(new NormalizedDefaultImportFeature(existingImportFeature));
b.Features.Add(GetMetadataReferenceFeature(references));
b.Features.Add(new CompilationTagHelperFeature());
});
}
protected RazorEngine CreateRuntimeEngine(CSharpCompilation compilation)
{
var references = compilation.References.Concat(new[] { compilation.ToMetadataReference() });
return RazorEngine.Create(b =>
{
RazorExtensions.Register(b);
b.Features.Add(GetMetadataReferenceFeature(references));
b.Features.Add(new CompilationTagHelperFeature());
});
}
protected override void OnCreatingCodeDocument(ref RazorSourceDocument source, IList<RazorSourceDocument> imports)
{
// It's important that we normalize the newlines in the default imports. The default imports will
// be created with Environment.NewLine, but we need to normalize to `\r\n` so that the indices
// are the same on xplat.
var buffer = new char[DefaultImports.Length];
DefaultImports.CopyTo(0, buffer, 0, DefaultImports.Length);
var text = new string(buffer);
text = Regex.Replace(text, "(?<!\r)\n", "\r\n");
imports.Add(RazorSourceDocument.Create(text, DefaultImports.FilePath, DefaultImports.Encoding));
}
private static MetadataReference BuildDynamicAssembly(
string text,
IEnumerable<MetadataReference> references,
string assemblyName)
{
var syntaxTree = new SyntaxTree[] { CSharpSyntaxTree.ParseText(text) };
var compilation = CSharpCompilation.Create(
assemblyName,
syntaxTree,
references,
options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
var stream = new MemoryStream();
var compilationResult = compilation.Emit(stream, options: new EmitOptions());
stream.Position = 0;
Assert.True(compilationResult.Success);
return MetadataReference.CreateFromStream(stream);
}
private static IRazorEngineFeature GetMetadataReferenceFeature(IEnumerable<MetadataReference> references)
{
return new DefaultMetadataReferenceFeature()
@ -730,5 +684,48 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
References = references.ToList()
};
}
private class NormalizedDefaultImportFeature : RazorProjectEngineFeatureBase, IImportProjectFeature
{
private IImportProjectFeature _existingFeature;
public NormalizedDefaultImportFeature(IImportProjectFeature existingFeature)
{
_existingFeature = existingFeature;
}
protected override void OnInitialized()
{
_existingFeature.ProjectEngine = ProjectEngine;
}
public IReadOnlyList<RazorProjectItem> GetImports(RazorProjectItem projectItem)
{
var normalizedImports = new List<RazorProjectItem>();
var imports = _existingFeature.GetImports(projectItem);
foreach (var import in imports)
{
var text = string.Empty;
using (var stream = import.Read())
using (var reader = new StreamReader(stream))
{
text = reader.ReadToEnd().Trim();
}
// It's important that we normalize the newlines in the default imports. The default imports will
// be created with Environment.NewLine, but we need to normalize to `\r\n` so that the indices
// are the same on xplat.
var normalizedText = Regex.Replace(text, "(?<!\r)\n", "\r\n", RegexOptions.None, TimeSpan.FromSeconds(10));
var normalizedImport = new TestRazorProjectItem(import.FilePath, import.PhysicalPath, import.RelativePhysicalPath, import.BasePath)
{
Content = normalizedText
};
normalizedImports.Add(normalizedImport);
}
return normalizedImports;
}
}
}
}

View File

@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.IntegrationTests
})
};
var engine = RazorEngine.Create(b =>
var engine = CreateProjectEngine(b =>
{
b.AddTagHelpers(descriptors);
b.Features.Add(new InstrumentationPass());
@ -52,10 +52,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.IntegrationTests
b.AddTargetExtension(new TemplateTargetExtension());
});
var document = CreateCodeDocument();
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var document = engine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());

View File

@ -236,26 +236,26 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
private RazorEngine CreateEngine()
{
return RazorEngine.Create(b =>
{
// Notice we're not registering the ModelDirective.Pass here so we can run it on demand.
b.AddDirective(ModelDirective.Directive);
// There's some special interaction with the inherits directive
InheritsDirective.Register(b);
});
return CreateEngineCore();
}
private RazorEngine CreateDesignTimeEngine()
{
return RazorEngine.CreateDesignTime(b =>
return CreateEngineCore(designTime: true);
}
private RazorEngine CreateEngineCore(bool designTime = false)
{
return RazorProjectEngine.Create(b =>
{
// Notice we're not registering the ModelDirective.Pass here so we can run it on demand.
b.AddDirective(ModelDirective.Directive);
// There's some special interaction with the inherits directive
InheritsDirective.Register(b);
});
b.Features.Add(new DesignTimeOptionsFeature(designTime));
}).Engine;
}
private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
@ -315,5 +315,29 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
Node = node;
}
}
private class DesignTimeOptionsFeature : IConfigureRazorParserOptionsFeature, IConfigureRazorCodeGenerationOptionsFeature
{
private bool _designTime;
public DesignTimeOptionsFeature(bool designTime)
{
_designTime = designTime;
}
public int Order { get; }
public RazorEngine Engine { get; set; }
public void Configure(RazorParserOptionsBuilder options)
{
options.SetDesignTime(_designTime);
}
public void Configure(RazorCodeGenerationOptionsBuilder options)
{
options.SetDesignTime(_designTime);
}
}
}
}

View File

@ -151,10 +151,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
private RazorEngine CreateEngine(params TagHelperDescriptor[] tagHelpers)
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
b.Features.Add(new TestTagHelperFeature(tagHelpers));
});
}).Engine;
}
private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)

View File

@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
"@using Microsoft.AspNetCore.Mvc.ViewFeatures",
};
var mvcRazorTemplateEngine = new MvcRazorTemplateEngine(
RazorEngine.Create(),
RazorProjectEngine.Create().Engine,
new TestRazorProjectFileSystem());
// Act
@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
"@inject global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider",
};
var mvcRazorTemplateEngine = new MvcRazorTemplateEngine(
RazorEngine.Create(),
RazorProjectEngine.Create().Engine,
new TestRazorProjectFileSystem());
// Act
@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
{
// Arrange
var mvcRazorTemplateEngine = new MvcRazorTemplateEngine(
RazorEngine.Create(),
RazorProjectEngine.Create().Engine,
new TestRazorProjectFileSystem());
// Act

View File

@ -15,11 +15,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Arrange
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -35,12 +35,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Arrange
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
irDocument.DocumentKind = "some-value";
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -56,11 +56,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Arrange
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -79,11 +79,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var properties = new RazorSourceDocumentProperties(filePath: "ignored", relativePath: "Test.cshtml");
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", properties));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -106,11 +106,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var properties = new RazorSourceDocumentProperties(filePath: "ignored", relativePath: relativePath);
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", properties));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -129,11 +129,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var properties = new RazorSourceDocumentProperties(filePath: @"x::\application\Views\Home\Index.cshtml", relativePath: null);
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", properties));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -152,11 +152,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var properties = new RazorSourceDocumentProperties(filePath: @"x:\Test.cshtml", relativePath: "path.with+invalid-chars");
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", properties));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -174,11 +174,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Arrange
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -192,13 +192,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
Assert.Equal(new[] { "public", "async", "override" }, visitor.Method.Modifiers);
}
private static RazorEngine CreateEngine() => RazorEngine.Create();
private static RazorProjectEngine CreateProjectEngine() => RazorProjectEngine.Create();
private static DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
private static DocumentIntermediateNode CreateIRDocument(RazorProjectEngine projectEngine, RazorCodeDocument codeDocument)
{
for (var i = 0; i < engine.Phases.Count; i++)
for (var i = 0; i < projectEngine.Phases.Count; i++)
{
var phase = engine.Phases[i];
var phase = projectEngine.Phases[i];
phase.Execute(codeDocument);
if (phase is IRazorIntermediateNodeLoweringPhase)

View File

@ -3,6 +3,7 @@
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Language.Intermediate;
using Moq;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
@ -132,7 +133,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage/AddUser.cshtml"));
var pass = new NamespaceDirective.Pass();
pass.Engine = RazorEngine.CreateEmpty(b => { });
pass.Engine = Mock.Of<RazorEngine>();
// Act
pass.Execute(codeDocument, document);
@ -179,7 +180,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage/AddUser.cshtml"));
var pass = new NamespaceDirective.Pass();
pass.Engine = RazorEngine.CreateEmpty(b => { });
pass.Engine = Mock.Of<RazorEngine>();
// Act
pass.Execute(codeDocument, document);
@ -217,7 +218,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage-Info/Add+User.cshtml"));
var pass = new NamespaceDirective.Pass();
pass.Engine = RazorEngine.CreateEmpty(b => { });
pass.Engine = Mock.Of<RazorEngine>();
// Act
pass.Execute(codeDocument, document);
@ -264,7 +265,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage/AddUser.cshtml"));
var pass = new NamespaceDirective.Pass();
pass.Engine = RazorEngine.CreateEmpty(b => { });
pass.Engine = Mock.Of<RazorEngine>();
// Act
pass.Execute(codeDocument, document);
@ -302,7 +303,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage/AddUser.cshtml"));
var pass = new NamespaceDirective.Pass();
pass.Engine = RazorEngine.CreateEmpty(b => { });
pass.Engine = Mock.Of<RazorEngine>();
// Act
pass.Execute(codeDocument, document);
@ -338,7 +339,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage/AddUser.cshtml"));
var pass = new NamespaceDirective.Pass();
pass.Engine = RazorEngine.CreateEmpty(b => { });
pass.Engine = Mock.Of<RazorEngine>();
// Act
pass.Execute(codeDocument, document);

View File

@ -123,10 +123,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
private RazorEngine CreateEngine()
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
PageDirective.Register(b);
});
}).Engine;
}
private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)

View File

@ -334,10 +334,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
private static RazorEngine CreateEngine()
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
PageDirective.Register(b);
});
}).Engine;
}
private static DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4120ddad9d4353ed260e0585fe71080d78ff8ab3"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6d079dd6c39f39d17a2faff14404b37ab7e8b8fc"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"4120ddad9d4353ed260e0585fe71080d78ff8ab3", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"6d079dd6c39f39d17a2faff14404b37ab7e8b8fc", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "fec5cf763044f842fa2114e997bb07e0bf280cd6"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5add9dba0a182cd75498c5b24f64a2547e7f49b0"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"fec5cf763044f842fa2114e997bb07e0bf280cd6", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"5add9dba0a182cd75498c5b24f64a2547e7f49b0", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "91cf923452a86b2906083cb0236d6d5b3bc528ef"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3ff83e2f0d946feb387a8ea03a529c64350014f8"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"91cf923452a86b2906083cb0236d6d5b3bc528ef", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"3ff83e2f0d946feb387a8ea03a529c64350014f8", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel : MyBasePageForViews<MyModel>
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "052fe5ad02d36ebdf943dddd543cb26aaff62411"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "d196fc1c66d46d35e35af9b01c737e12bcce6782"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")]
@ -13,8 +13,8 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"052fe5ad02d36ebdf943dddd543cb26aaff62411", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"28770296d18b0505bb216c6143cc1ec6514adb7b", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Imports0.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"d196fc1c66d46d35e35af9b01c737e12bcce6782", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"30a9e14edcefbf4970c45de29d8870cf1a9b90b5", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Imports0.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports : MyPageModel<MyModel>
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a039b7091118c718dc3023b6ac58d9645cb58e59"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2cafb599699b78d76f0355b6f528050b4720789d"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"a039b7091118c718dc3023b6ac58d9645cb58e59", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"2cafb599699b78d76f0355b6f528050b4720789d", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<MyModel>
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5010aab35d235175dab517f8018e41aee9a2ac7f"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8a53bde02f202036e674a23018e04268a3a844bb"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"5010aab35d235175dab517f8018e41aee9a2ac7f", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"8a53bde02f202036e674a23018e04268a3a844bb", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<MyModel>
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "c711078454f5b0e8d2cb77d9cb7fa88cca32b884"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "592a6d8544c71b828d4a3fbf92d398cd3ea72790"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"c711078454f5b0e8d2cb77d9cb7fa88cca32b884", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"592a6d8544c71b828d4a3fbf92d398cd3ea72790", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "de132bd3e2a46a0d2ec953a168427c01e5829cde"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "010d175bb6c3f7fa6f2ae04c1fecb4e3bfbf928b"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"de132bd3e2a46a0d2ec953a168427c01e5829cde", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"010d175bb6c3f7fa6f2ae04c1fecb4e3bfbf928b", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5a9ff8440150c6746e4a8ba63bc633ea84930405"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "464e008b9a04181fe1e9f2cc6826095698de4739"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"5a9ff8440150c6746e4a8ba63bc633ea84930405", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"464e008b9a04181fe1e9f2cc6826095698de4739", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0906a816db301fe624bbe5a96c4b3013071ea492"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "741fc99adb54ad906c5cdc5391aeffb51a1e767b"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"0906a816db301fe624bbe5a96c4b3013071ea492", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"741fc99adb54ad906c5cdc5391aeffb51a1e767b", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<DateTime>
{
#line hidden

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "31c5b047a450ac9f6dc4116626667d26bfb657ba"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2c1e88396568d309c236020e59bf2abacfadd612"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"31c5b047a450ac9f6dc4116626667d26bfb657ba", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"2c1e88396568d309c236020e59bf2abacfadd612", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<System.Collections.IEnumerable>
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "b205857d3dad47cb3f0c1d7775ae251b306ab830"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "1edfb1ba4f5f6c70e2c72f4f23baf4dc0ae14377"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Test.Namespace.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml")]
@ -13,7 +13,7 @@ namespace Test.Namespace
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"b205857d3dad47cb3f0c1d7775ae251b306ab830", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"1edfb1ba4f5f6c70e2c72f4f23baf4dc0ae14377", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "1d35b023a80ffd4cbf92549aae24d6c47f4af7e5"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "40c0ffad85d8fef63edfb5d91a08bd1b3609ba6f"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"1d35b023a80ffd4cbf92549aae24d6c47f4af7e5", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"40c0ffad85d8fef63edfb5d91a08bd1b3609ba6f", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "d2a113c82e86efc28ea0a17c1f42bbb23a52fecf"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "547900310554f446d88da593a245719ee9dbb12f"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")]
@ -19,7 +19,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
#line default
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("RouteTemplate", "/About")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"d2a113c82e86efc28ea0a17c1f42bbb23a52fecf", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"547900310554f446d88da593a245719ee9dbb12f", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "c0587249e6e0b7ba4e1efc463f58577d5d0b6ae2"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8bf3954ad78688478de155359db8af32627ee2b8"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml")]
@ -18,7 +18,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
#line default
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"c0587249e6e0b7ba4e1efc463f58577d5d0b6ae2", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"8bf3954ad78688478de155359db8af32627ee2b8", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel : 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);

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "608b3f7b9b29c66ee25bde2d20324b4bef1aa070"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "d33caff161b646a61b273d7c544111395b652557"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml")]
@ -18,7 +18,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
#line default
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"608b3f7b9b29c66ee25bde2d20324b4bef1aa070", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"d33caff161b646a61b273d7c544111395b652557", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages : 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);

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "dbec91fd88a09c6a2e35b5adedb3f8ab8e3ae486"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4b7b87da15db4343c99430c0813fd6bc03643453"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"dbec91fd88a09c6a2e35b5adedb3f8ab8e3ae486", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"4b7b87da15db4343c99430c0813fd6bc03643453", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<DateTime>
{
#line hidden

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6a0ad3c59f3a87877c36928472f0508bd40cdd8c"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "bf860c3a5e96240c9d41a0b950e49c1a165ca44d"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"6a0ad3c59f3a87877c36928472f0508bd40cdd8c", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"bf860c3a5e96240c9d41a0b950e49c1a165ca44d", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper;

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2893acf42354a0bc8b6a2698f5d2e4fab0e59dbe"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "471b74bb73c8ae8e0ed24c654340198b9b4a1ec8"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Test.Namespace.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml")]
@ -13,7 +13,7 @@ namespace Test.Namespace
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"2893acf42354a0bc8b6a2698f5d2e4fab0e59dbe", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"471b74bb73c8ae8e0ed24c654340198b9b4a1ec8", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e57bbc3e746e8b13b4c33d8df0e022bd397d8caa"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "74c90591b68437a0868e91dc714ea9827ab8e03a"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")]
@ -13,7 +13,7 @@ namespace AspNetCore
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"e57bbc3e746e8b13b4c33d8df0e022bd397d8caa", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"74c90591b68437a0868e91dc714ea9827ab8e03a", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
#pragma warning disable 1998

View File

@ -1,11 +1,11 @@
#pragma checksum "TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "723b7da149db577d0c49cff7c00f2d831e8916e7"
#pragma checksum "TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "78993008d95836bec2b9175d4294bf7bd5f5f109"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Razor.Template), @"default", @"/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.cshtml")]
namespace Razor
{
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"723b7da149db577d0c49cff7c00f2d831e8916e7", @"/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"78993008d95836bec2b9175d4294bf7bd5f5f109", @"/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.cshtml")]
public class Template
{
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("value", "Hello", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);

View File

@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var provider = new ViewComponentTagHelperDescriptorProvider()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = RazorProjectEngine.CreateEmpty().Engine,
};
var expectedDescriptor = TagHelperDescriptorBuilder.Create(

View File

@ -30,13 +30,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
.Build()
};
var engine = CreateEngine(tagHelpers);
var projectEngine = CreateProjectEngine(tagHelpers);
var pass = new ViewComponentTagHelperPass()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var irDocument = CreateIRDocument(engine, codeDocument);
var irDocument = CreateIRDocument(projectEngine, codeDocument);
// Act
pass.Execute(codeDocument, irDocument);
@ -71,13 +71,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
.Build()
};
var engine = CreateEngine(tagHelpers);
var projectEngine = CreateProjectEngine(tagHelpers);
var pass = new ViewComponentTagHelperPass()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var irDocument = CreateIRDocument(engine, codeDocument);
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var vcthFullName = "AspNetCore.test.__Generated__TagCloudViewComponentTagHelper";
@ -118,13 +118,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
.Build()
};
var engine = CreateEngine(tagHelpers);
var projectEngine = CreateProjectEngine(tagHelpers);
var pass = new ViewComponentTagHelperPass()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var irDocument = CreateIRDocument(engine, codeDocument);
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var vcthFullName = "AspNetCore.test.__Generated__TagCloudViewComponentTagHelper";
@ -171,13 +171,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
.Build()
};
var engine = CreateEngine(tagHelpers);
var projectEngine = CreateProjectEngine(tagHelpers);
var pass = new ViewComponentTagHelperPass()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var irDocument = CreateIRDocument(engine, codeDocument);
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var vcthFullName = "AspNetCore.test.__Generated__TagCloudViewComponentTagHelper";
@ -206,9 +206,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
return RazorCodeDocument.Create(source);
}
private RazorEngine CreateEngine(params TagHelperDescriptor[] tagHelpers)
private RazorProjectEngine CreateProjectEngine(params TagHelperDescriptor[] tagHelpers)
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
b.Features.Add(new MvcViewDocumentClassifierPass());
@ -216,11 +216,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
});
}
private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
private DocumentIntermediateNode CreateIRDocument(RazorProjectEngine projectEngine, RazorCodeDocument codeDocument)
{
for (var i = 0; i < engine.Phases.Count; i++)
for (var i = 0; i < projectEngine.Phases.Count; i++)
{
var phase = engine.Phases[i];
var phase = projectEngine.Phases[i];
phase.Execute(codeDocument);
if (phase is IRazorDirectiveClassifierPhase)
@ -232,7 +232,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// We also expect the default tag helper pass to run first.
var documentNode = codeDocument.GetDocumentIntermediateNode();
var defaultTagHelperPass = engine.Features.OfType<DefaultTagHelperOptimizationPass>().Single();
var defaultTagHelperPass = projectEngine.EngineFeatures.OfType<DefaultTagHelperOptimizationPass>().Single();
defaultTagHelperPass.Execute(codeDocument, documentNode);
return codeDocument.GetDocumentIntermediateNode();

View File

@ -173,12 +173,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
private RazorEngine CreateEngine()
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
// Notice we're not registering the InjectDirective.Pass here so we can run it on demand.
b.AddDirective(InjectDirective.Directive);
b.AddDirective(ModelDirective.Directive);
});
}).Engine;
}
private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)

View File

@ -1,6 +1,7 @@
// 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.IO;
using System.Linq;
@ -251,11 +252,11 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
Assert.Empty(baseCompilation.GetDiagnostics());
// Arrange
var engine = CreateDesignTimeEngine(baseCompilation);
var document = CreateCodeDocument();
var engine = CreateEngine(baseCompilation);
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var document = engine.ProcessDesignTime(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
@ -291,56 +292,23 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
}
}
protected RazorEngine CreateDesignTimeEngine(CSharpCompilation compilation)
protected RazorProjectEngine CreateEngine(CSharpCompilation compilation)
{
var references = compilation.References.Concat(new[] { compilation.ToMetadataReference() });
return RazorEngine.CreateDesignTime(b =>
return CreateProjectEngine(b =>
{
RazorExtensions.Register(b);
RazorExtensions.RegisterViewComponentTagHelpers(b);
var existingImportFeature = b.Features.OfType<IImportProjectFeature>().Single();
b.SetImportFeature(new NormalizedDefaultImportFeature(existingImportFeature));
b.Features.Add(GetMetadataReferenceFeature(references));
b.Features.Add(new CompilationTagHelperFeature());
});
}
protected override void OnCreatingCodeDocument(ref RazorSourceDocument source, IList<RazorSourceDocument> imports)
{
// It's important that we normalize the newlines in the default imports. The default imports will
// be created with Environment.NewLine, but we need to normalize to `\r\n` so that the indices
// are the same on xplat.
var buffer = new char[DefaultImports.Length];
DefaultImports.CopyTo(0, buffer, 0, DefaultImports.Length);
var text = new string(buffer);
text = Regex.Replace(text, "(?<!\r)\n", "\r\n");
imports.Add(RazorSourceDocument.Create(text, DefaultImports.FilePath, DefaultImports.Encoding));
}
private static MetadataReference BuildDynamicAssembly(
string text,
IEnumerable<MetadataReference> references,
string assemblyName)
{
var syntaxTree = new SyntaxTree[] { CSharpSyntaxTree.ParseText(text) };
var compilation = CSharpCompilation.Create(
assemblyName,
syntaxTree,
references,
options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
var stream = new MemoryStream();
var compilationResult = compilation.Emit(stream, options: new EmitOptions());
stream.Position = 0;
Assert.True(compilationResult.Success);
return MetadataReference.CreateFromStream(stream);
}
private static IRazorEngineFeature GetMetadataReferenceFeature(IEnumerable<MetadataReference> references)
{
return new DefaultMetadataReferenceFeature()
@ -349,47 +317,47 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
};
}
private static IEnumerable<MetadataReference> CreateAppCodeReferences(string appCode, IEnumerable<MetadataReference> shimReferences)
private class NormalizedDefaultImportFeature : RazorProjectEngineFeatureBase, IImportProjectFeature
{
var references = new List<MetadataReference>(shimReferences);
private IImportProjectFeature _existingFeature;
if (appCode != null)
public NormalizedDefaultImportFeature(IImportProjectFeature existingFeature)
{
var appCodeSyntaxTrees = new List<SyntaxTree> { CSharpSyntaxTree.ParseText(appCode) };
var compilation = CSharpCompilation.Create(
"AppCode",
appCodeSyntaxTrees,
shimReferences,
options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
var stream = new MemoryStream();
var compilationResult = compilation.Emit(stream, options: new EmitOptions());
stream.Position = 0;
var diagString = string.Join(";", compilationResult.Diagnostics.Where(s => s.Severity == DiagnosticSeverity.Error).Select(s => s.ToString()));
Assert.True(compilationResult.Success, string.Format("Application code needed for tests didn't compile!: {0}", diagString));
references.Add(MetadataReference.CreateFromStream(stream));
_existingFeature = existingFeature;
}
return references;
}
protected override void OnInitialized()
{
_existingFeature.ProjectEngine = ProjectEngine;
}
private static IEnumerable<MetadataReference> CreateMvcShimReferences(string mvcShimName)
{
var dllPath = Path.Combine(Directory.GetCurrentDirectory(), mvcShimName);
var assembly = Assembly.LoadFile(dllPath);
var assemblyDependencyContext = DependencyContext.Load(assembly);
public IReadOnlyList<RazorProjectItem> GetImports(RazorProjectItem projectItem)
{
var normalizedImports = new List<RazorProjectItem>();
var imports = _existingFeature.GetImports(projectItem);
foreach (var import in imports)
{
var text = string.Empty;
using (var stream = import.Read())
using (var reader = new StreamReader(stream))
{
text = reader.ReadToEnd().Trim();
}
var assemblyReferencePaths = assemblyDependencyContext.CompileLibraries.SelectMany(l => l.ResolveReferencePaths());
// It's important that we normalize the newlines in the default imports. The default imports will
// be created with Environment.NewLine, but we need to normalize to `\r\n` so that the indices
// are the same on xplat.
var normalizedText = Regex.Replace(text, "(?<!\r)\n", "\r\n", RegexOptions.None, TimeSpan.FromSeconds(10));
var normalizedImport = new TestRazorProjectItem(import.FilePath, import.PhysicalPath, import.RelativePhysicalPath, import.BasePath)
{
Content = normalizedText
};
var references = assemblyReferencePaths
.Select(assemblyPath => MetadataReference.CreateFromFile(assemblyPath))
.ToList<MetadataReference>();
normalizedImports.Add(normalizedImport);
}
Assert.NotEmpty(references);
return references;
return normalizedImports;
}
}
}
}

View File

@ -236,26 +236,26 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
private RazorEngine CreateEngine()
{
return RazorEngine.Create(b =>
{
// Notice we're not registering the ModelDirective.Pass here so we can run it on demand.
b.AddDirective(ModelDirective.Directive);
// There's some special interaction with the inherits directive
InheritsDirective.Register(b);
});
return CreateEngineCore();
}
private RazorEngine CreateDesignTimeEngine()
{
return RazorEngine.CreateDesignTime(b =>
return CreateEngineCore(designTime: true);
}
private RazorEngine CreateEngineCore(bool designTime = false)
{
return RazorProjectEngine.Create(b =>
{
// Notice we're not registering the ModelDirective.Pass here so we can run it on demand.
b.AddDirective(ModelDirective.Directive);
// There's some special interaction with the inherits directive
InheritsDirective.Register(b);
});
b.Features.Add(new DesignTimeOptionsFeature(designTime));
}).Engine;
}
private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
@ -315,5 +315,29 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
Node = node;
}
}
private class DesignTimeOptionsFeature : IConfigureRazorParserOptionsFeature, IConfigureRazorCodeGenerationOptionsFeature
{
private bool _designTime;
public DesignTimeOptionsFeature(bool designTime)
{
_designTime = designTime;
}
public int Order { get; }
public RazorEngine Engine { get; set; }
public void Configure(RazorParserOptionsBuilder options)
{
options.SetDesignTime(_designTime);
}
public void Configure(RazorCodeGenerationOptionsBuilder options)
{
options.SetDesignTime(_designTime);
}
}
}
}

View File

@ -151,10 +151,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
private RazorEngine CreateEngine(params TagHelperDescriptor[] tagHelpers)
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
b.Features.Add(new TestTagHelperFeature(tagHelpers));
});
}).Engine;
}
private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)

View File

@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
"@using Microsoft.AspNetCore.Mvc.ViewFeatures",
};
var mvcRazorTemplateEngine = new MvcRazorTemplateEngine(
RazorEngine.Create(),
RazorProjectEngine.Create().Engine,
new TestRazorProjectFileSystem());
// Act
@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
"@inject global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider",
};
var mvcRazorTemplateEngine = new MvcRazorTemplateEngine(
RazorEngine.Create(),
RazorProjectEngine.Create().Engine,
new TestRazorProjectFileSystem());
// Act
@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
{
// Arrange
var mvcRazorTemplateEngine = new MvcRazorTemplateEngine(
RazorEngine.Create(),
RazorProjectEngine.Create().Engine,
new TestRazorProjectFileSystem());
// Act

View File

@ -15,11 +15,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
// Arrange
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -35,12 +35,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
// Arrange
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
irDocument.DocumentKind = "some-value";
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -56,11 +56,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
// Arrange
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -79,11 +79,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
var properties = new RazorSourceDocumentProperties(filePath: "ignored", relativePath: "Test.cshtml");
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", properties));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -106,11 +106,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
var properties = new RazorSourceDocumentProperties(filePath: "ignored", relativePath: relativePath);
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", properties));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -129,11 +129,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
var properties = new RazorSourceDocumentProperties(filePath: @"x::\application\Views\Home\Index.cshtml", relativePath: null);
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", properties));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -152,11 +152,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
var properties = new RazorSourceDocumentProperties(filePath: @"x:\Test.cshtml", relativePath: "path.with+invalid-chars");
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", properties));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -174,11 +174,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
// Arrange
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
var engine = CreateEngine();
var irDocument = CreateIRDocument(engine, codeDocument);
var projectEngine = CreateProjectEngine();
var irDocument = CreateIRDocument(projectEngine, codeDocument);
var pass = new MvcViewDocumentClassifierPass
{
Engine = engine
Engine = projectEngine.Engine
};
// Act
@ -192,9 +192,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
Assert.Equal(new[] { "public", "async", "override" }, visitor.Method.Modifiers);
}
private static RazorEngine CreateEngine() => RazorEngine.Create();
private static RazorProjectEngine CreateProjectEngine() => RazorProjectEngine.Create();
private static DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
private static DocumentIntermediateNode CreateIRDocument(RazorProjectEngine engine, RazorCodeDocument codeDocument)
{
for (var i = 0; i < engine.Phases.Count; i++)
{

View File

@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
var provider = new ViewComponentTagHelperDescriptorProvider()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = RazorProjectEngine.CreateEmpty().Engine,
};
var expectedDescriptor = TagHelperDescriptorBuilder.Create(

View File

@ -208,12 +208,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
private RazorEngine CreateEngine(params TagHelperDescriptor[] tagHelpers)
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
b.Features.Add(new MvcViewDocumentClassifierPass());
b.Features.Add(new TestTagHelperFeature(tagHelpers));
});
}).Engine;
}
private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)

View File

@ -446,16 +446,16 @@ Render Children
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument)
{
var engine = RazorEngine.Create();
var projectEngine = RazorProjectEngine.Create();
return Lower(codeDocument, engine);
return Lower(codeDocument, projectEngine);
}
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorEngine engine)
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorProjectEngine projectEngine)
{
for (var i = 0; i < engine.Phases.Count; i++)
for (var i = 0; i < projectEngine.Phases.Count; i++)
{
var phase = engine.Phases[i];
var phase = projectEngine.Phases[i];
phase.Execute(codeDocument);
if (phase is IRazorIntermediateNodeLoweringPhase)

View File

@ -557,16 +557,16 @@ WriteAttributeValue("" "", 27, false, 28, 6, false);
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument)
{
var engine = RazorEngine.Create();
var projectEngine = RazorProjectEngine.Create();
return Lower(codeDocument, engine);
return Lower(codeDocument, projectEngine);
}
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorEngine engine)
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorProjectEngine projectEngine)
{
for (var i = 0; i < engine.Phases.Count; i++)
for (var i = 0; i < projectEngine.Phases.Count; i++)
{
var phase = engine.Phases[i];
var phase = projectEngine.Phases[i];
phase.Execute(codeDocument);
if (phase is IRazorIntermediateNodeLoweringPhase)

View File

@ -98,16 +98,16 @@ AddHtmlAttributeValue("" "", 27, false, 28, 6, false);
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument)
{
var engine = RazorEngine.Create();
var projectEngine = RazorProjectEngine.Create();
return Lower(codeDocument, engine);
return Lower(codeDocument, projectEngine);
}
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorEngine engine)
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorProjectEngine projectEngine)
{
for (var i = 0; i < engine.Phases.Count; i++)
for (var i = 0; i < projectEngine.Phases.Count; i++)
{
var phase = engine.Phases[i];
var phase = projectEngine.Phases[i];
phase.Execute(codeDocument);
if (phase is IRazorIntermediateNodeLoweringPhase)

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Razor.Language
};
var pass = new DefaultDocumentClassifierPass();
pass.Engine = RazorEngine.CreateEmpty(b => { });
pass.Engine = RazorProjectEngine.Create().Engine;
// Act
pass.Execute(TestRazorCodeDocument.CreateEmpty(), documentNode);
@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Razor.Language
};
var pass = new DefaultDocumentClassifierPass();
pass.Engine = RazorEngine.CreateEmpty(b =>{ });
pass.Engine = RazorProjectEngine.Create().Engine;
// Act
pass.Execute(TestRazorCodeDocument.CreateEmpty(), documentNode);

View File

@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var phase = new DefaultRazorCSharpLoweringPhase();
var engine = RazorEngine.CreateEmpty(b => b.Phases.Add(phase));
var engine = RazorProjectEngine.CreateEmpty(b => b.Phases.Add(phase));
var codeDocument = TestRazorCodeDocument.CreateEmpty();
@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var phase = new DefaultRazorCSharpLoweringPhase();
var engine = RazorEngine.CreateEmpty(b => b.Phases.Add(phase));
var engine = RazorProjectEngine.CreateEmpty(b => b.Phases.Add(phase));
var codeDocument = TestRazorCodeDocument.CreateEmpty();
@ -60,7 +60,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{
// Arrange
var phase = new DefaultRazorCSharpLoweringPhase();
var engine = RazorEngine.CreateEmpty(b => b.Phases.Add(phase));
var engine = RazorProjectEngine.CreateEmpty(b => b.Phases.Add(phase));
var codeDocument = TestRazorCodeDocument.Create("<p class=@(");
var options = RazorCodeGenerationOptions.CreateDefault();
var irDocument = new DocumentIntermediateNode()

View File

@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var first = Mock.Of<IRazorDirectiveClassifierPass>(p => p.Order == 15);
var second = Mock.Of<IRazorDirectiveClassifierPass>(p => p.Order == 17);
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
@ -41,7 +41,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var phase = new DefaultRazorDirectiveClassifierPhase();
var engine = RazorEngine.CreateEmpty(b => b.Phases.Add(phase));
var engine = RazorProjectEngine.CreateEmpty(b => b.Phases.Add(phase));
var codeDocument = TestRazorCodeDocument.CreateEmpty();
@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var phase = new DefaultRazorDirectiveClassifierPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);

View File

@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var first = Mock.Of<IRazorDocumentClassifierPass>(p => p.Order == 15);
var second = Mock.Of<IRazorDocumentClassifierPass>(p => p.Order == 17);
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
@ -41,7 +41,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var phase = new DefaultRazorDocumentClassifierPhase();
var engine = RazorEngine.CreateEmpty(b => b.Phases.Add(phase));
var engine = RazorProjectEngine.CreateEmpty(b => b.Phases.Add(phase));
var codeDocument = TestRazorCodeDocument.CreateEmpty();
@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var phase = new DefaultRazorDocumentClassifierPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);

View File

@ -432,26 +432,28 @@ namespace Microsoft.AspNetCore.Razor.Language
private DocumentIntermediateNode Lower(
RazorCodeDocument codeDocument,
Action<IRazorEngineBuilder> builder = null,
Action<RazorProjectEngineBuilder> builder = null,
IEnumerable<TagHelperDescriptor> tagHelpers = null,
bool designTime = false)
{
tagHelpers = tagHelpers ?? new TagHelperDescriptor[0];
Action<IRazorEngineBuilder> configureEngine = b =>
Action<RazorProjectEngineBuilder> configureEngine = b =>
{
builder?.Invoke(b);
FunctionsDirective.Register(b);
SectionDirective.Register(b);
b.AddTagHelpers(tagHelpers);
b.Features.Add(new DesignTimeOptionsFeature(designTime));
};
var engine = designTime ? RazorEngine.CreateDesignTime(configureEngine) : RazorEngine.Create(configureEngine);
var projectEngine = RazorProjectEngine.Create(configureEngine);
for (var i = 0; i < engine.Phases.Count; i++)
for (var i = 0; i < projectEngine.Phases.Count; i++)
{
var phase = engine.Phases[i];
var phase = projectEngine.Phases[i];
phase.Execute(codeDocument);
if (phase is IRazorIntermediateNodeLoweringPhase)
@ -489,5 +491,29 @@ namespace Microsoft.AspNetCore.Razor.Language
return descriptor;
}
private class DesignTimeOptionsFeature : IConfigureRazorParserOptionsFeature, IConfigureRazorCodeGenerationOptionsFeature
{
private bool _designTime;
public DesignTimeOptionsFeature(bool designTime)
{
_designTime = designTime;
}
public int Order { get; }
public RazorEngine Engine { get; set; }
public void Configure(RazorParserOptionsBuilder options)
{
options.SetDesignTime(_designTime);
}
public void Configure(RazorCodeGenerationOptionsBuilder options)
{
options.SetDesignTime(_designTime);
}
}
}
}

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Razor.Language
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
});
var phase = new DefaultRazorIntermediateNodeLoweringPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
b.Features.Add(new DefaultRazorCodeGenerationOptionsFeature(designTime: false));
@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Razor.Language
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
});
var phase = new DefaultRazorIntermediateNodeLoweringPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
b.Features.Add(new DefaultRazorCodeGenerationOptionsFeature(designTime: false));
@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Razor.Language
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
});
var phase = new DefaultRazorIntermediateNodeLoweringPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
b.Features.Add(new DefaultRazorCodeGenerationOptionsFeature(designTime: false));
@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var codeBlockDirective = DirectiveDescriptor.CreateCodeBlockDirective("code", b => b.AddStringToken());
var razorBlockDirective = DirectiveDescriptor.CreateRazorBlockDirective("razor", b => b.AddStringToken());
var phase = new DefaultRazorIntermediateNodeLoweringPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
b.Features.Add(new DefaultRazorCodeGenerationOptionsFeature(designTime: false));
@ -159,7 +159,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var directive = DirectiveDescriptor.CreateCodeBlockDirective("custom", b => b.Usage = DirectiveUsage.FileScopedSinglyOccurring);
var phase = new DefaultRazorIntermediateNodeLoweringPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
b.Features.Add(new DefaultRazorCodeGenerationOptionsFeature(designTime: false));
@ -189,7 +189,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var directive = DirectiveDescriptor.CreateRazorBlockDirective("custom", b => b.Usage = DirectiveUsage.FileScopedSinglyOccurring);
var phase = new DefaultRazorIntermediateNodeLoweringPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
b.Features.Add(new DefaultRazorCodeGenerationOptionsFeature(designTime: false));
@ -219,7 +219,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var phase = new DefaultRazorIntermediateNodeLoweringPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
b.Features.Add(new DefaultRazorCodeGenerationOptionsFeature(designTime: false));
@ -239,7 +239,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{
// Arrange
var phase = new DefaultRazorIntermediateNodeLoweringPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
b.Features.Add(new DefaultRazorCodeGenerationOptionsFeature(designTime: false));
@ -262,7 +262,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{
// Arrange
var phase = new DefaultRazorIntermediateNodeLoweringPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
b.Features.Add(new DefaultRazorCodeGenerationOptionsFeature(designTime: false));

View File

@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var first = Mock.Of<IRazorOptimizationPass>(p => p.Order == 15);
var second = Mock.Of<IRazorOptimizationPass>(p => p.Order == 17);
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
@ -41,7 +41,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var phase = new DefaultRazorOptimizationPhase();
var engine = RazorEngine.CreateEmpty(b => b.Phases.Add(phase));
var engine = RazorProjectEngine.CreateEmpty(b => b.Phases.Add(phase));
var codeDocument = TestRazorCodeDocument.CreateEmpty();
@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var phase = new DefaultRazorOptimizationPhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);

View File

@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{
// Arrange
var phase = new DefaultRazorParsingPhase();
var engine = RazorEngine.CreateEmpty(builder =>
var engine = RazorProjectEngine.CreateEmpty(builder =>
{
builder.Phases.Add(phase);
builder.Features.Add(new DefaultRazorParserOptionsFeature(designTime: false, version: RazorLanguageVersion.Latest));
@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{
// Arrange
var phase = new DefaultRazorParsingPhase();
var engine = RazorEngine.CreateEmpty((builder) =>
var engine = RazorProjectEngine.CreateEmpty((builder) =>
{
builder.Phases.Add(phase);
builder.Features.Add(new DefaultRazorParserOptionsFeature(designTime: false, version: RazorLanguageVersion.Latest));
@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{
// Arrange
var phase = new DefaultRazorParsingPhase();
var engine = RazorEngine.CreateEmpty((builder) =>
var engine = RazorProjectEngine.CreateEmpty((builder) =>
{
builder.Phases.Add(phase);
builder.Features.Add(new DefaultRazorParserOptionsFeature(designTime: false, version: RazorLanguageVersion.Latest));

View File

@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var first = Mock.Of<IRazorSyntaxTreePass>(p => p.Order == 15);
var second = Mock.Of<IRazorSyntaxTreePass>(p => p.Order == 17);
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);
@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var phase = new DefaultRazorSyntaxTreePhase();
var engine = RazorEngine.CreateEmpty(b => b.Phases.Add(phase));
var engine = RazorProjectEngine.CreateEmpty(b => b.Phases.Add(phase));
var codeDocument = TestRazorCodeDocument.CreateEmpty();
@ -76,7 +76,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var phase = new DefaultRazorSyntaxTreePhase();
var engine = RazorEngine.CreateEmpty(b =>
var engine = RazorProjectEngine.CreateEmpty(b =>
{
b.Phases.Add(phase);

View File

@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Razor.Language.Legacy;
using Xunit;
@ -16,14 +15,14 @@ namespace Microsoft.AspNetCore.Razor.Language
public void Execute_CanHandleSingleLengthAddTagHelperDirective()
{
// Arrange
var engine = RazorEngine.Create(builder =>
var projectEngine = RazorProjectEngine.Create(builder =>
{
builder.AddTagHelpers(new TagHelperDescriptor[0]);
});
var phase = new DefaultRazorTagHelperBinderPhase()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var expectedDiagnostics = new[]
{
@ -55,14 +54,14 @@ namespace Microsoft.AspNetCore.Razor.Language
public void Execute_CanHandleSingleLengthRemoveTagHelperDirective()
{
// Arrange
var engine = RazorEngine.Create(builder =>
var projectEngine = RazorProjectEngine.Create(builder =>
{
builder.AddTagHelpers(new TagHelperDescriptor[0]);
});
var phase = new DefaultRazorTagHelperBinderPhase()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var expectedDiagnostics = new[]
{
@ -94,14 +93,14 @@ namespace Microsoft.AspNetCore.Razor.Language
public void Execute_CanHandleSingleLengthTagHelperPrefix()
{
// Arrange
var engine = RazorEngine.Create(builder =>
var projectEngine = RazorProjectEngine.Create(builder =>
{
builder.AddTagHelpers(new TagHelperDescriptor[0]);
});
var phase = new DefaultRazorTagHelperBinderPhase()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var expectedDiagnostics = new[]
{
@ -133,7 +132,7 @@ namespace Microsoft.AspNetCore.Razor.Language
public void Execute_RewritesTagHelpers()
{
// Arrange
var engine = RazorEngine.Create(builder =>
var projectEngine = RazorProjectEngine.Create(builder =>
{
builder.AddTagHelpers(new[]
{
@ -150,7 +149,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var phase = new DefaultRazorTagHelperBinderPhase()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var sourceDocument = CreateTestSourceDocument();
@ -192,14 +191,14 @@ namespace Microsoft.AspNetCore.Razor.Language
.NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.FullMatch)),
});
var engine = RazorEngine.Create(builder =>
var projectEngine = RazorProjectEngine.Create(builder =>
{
builder.AddTagHelpers(new[] { descriptor });
});
var phase = new DefaultRazorTagHelperBinderPhase()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var content = @"
@ -245,14 +244,14 @@ namespace Microsoft.AspNetCore.Razor.Language
.NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.FullMatch)),
});
var engine = RazorEngine.Create(builder =>
var projectEngine = RazorProjectEngine.Create(builder =>
{
builder.AddTagHelpers(new[] { descriptor });
});
var phase = new DefaultRazorTagHelperBinderPhase()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var content = @"
@ -282,10 +281,10 @@ namespace Microsoft.AspNetCore.Razor.Language
public void Execute_NoopsWhenNoTagHelperFeature()
{
// Arrange
var engine = RazorEngine.Create();
var projectEngine = RazorProjectEngine.Create();
var phase = new DefaultRazorTagHelperBinderPhase()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var sourceDocument = CreateTestSourceDocument();
var codeDocument = RazorCodeDocument.Create(sourceDocument);
@ -305,12 +304,12 @@ namespace Microsoft.AspNetCore.Razor.Language
public void Execute_NoopsWhenNoFeature()
{
// Arrange
var engine = RazorEngine.Create(builder =>
var projectEngine = RazorProjectEngine.Create(builder =>
{
});
var phase = new DefaultRazorTagHelperBinderPhase()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var sourceDocument = CreateTestSourceDocument();
var codeDocument = RazorCodeDocument.Create(sourceDocument);
@ -330,14 +329,14 @@ namespace Microsoft.AspNetCore.Razor.Language
public void Execute_NoopsWhenNoTagHelperDescriptorsAreResolved()
{
// Arrange
var engine = RazorEngine.Create(builder =>
var projectEngine = RazorProjectEngine.Create(builder =>
{
builder.Features.Add(new TestTagHelperFeature());
});
var phase = new DefaultRazorTagHelperBinderPhase()
{
Engine = engine,
Engine = projectEngine.Engine,
};
// No taghelper directives here so nothing is resolved.
@ -359,14 +358,14 @@ namespace Microsoft.AspNetCore.Razor.Language
public void Execute_SetsTagHelperDocumentContext()
{
// Arrange
var engine = RazorEngine.Create(builder =>
var projectEngine = RazorProjectEngine.Create(builder =>
{
builder.Features.Add(new TestTagHelperFeature());
});
var phase = new DefaultRazorTagHelperBinderPhase()
{
Engine = engine,
Engine = projectEngine.Engine,
};
// No taghelper directives here so nothing is resolved.
@ -388,7 +387,7 @@ namespace Microsoft.AspNetCore.Razor.Language
public void Execute_CombinesErrorsOnRewritingErrors()
{
// Arrange
var engine = RazorEngine.Create(builder =>
var projectEngine = RazorProjectEngine.Create(builder =>
{
builder.AddTagHelpers(new[]
{
@ -405,7 +404,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var phase = new DefaultRazorTagHelperBinderPhase()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var content =

View File

@ -18,10 +18,10 @@ namespace Microsoft.AspNetCore.Razor.Language
var content = "@custom \"Hello\"";
var sourceDocument = TestRazorSourceDocument.Create(content);
var codeDocument = RazorCodeDocument.Create(sourceDocument);
var defaultEngine = RazorEngine.Create(b =>
var defaultEngine = RazorProjectEngine.Create(b =>
{
b.AddDirective(DirectiveDescriptor.CreateDirective("custom", DirectiveKind.SingleLine, d => d.AddStringToken()));
});
}).Engine;
var documentNode = Lower(codeDocument, defaultEngine);
var pass = new DirectiveRemovalOptimizationPass()
{
@ -49,10 +49,10 @@ namespace Microsoft.AspNetCore.Razor.Language
var content = "@custom \"Hello\"" + Environment.NewLine + "@custom \"World\"";
var sourceDocument = TestRazorSourceDocument.Create(content);
var codeDocument = RazorCodeDocument.Create(sourceDocument);
var defaultEngine = RazorEngine.Create(b =>
var defaultEngine = RazorProjectEngine.Create(b =>
{
b.AddDirective(DirectiveDescriptor.CreateDirective("custom", DirectiveKind.SingleLine, d => d.AddStringToken()));
});
}).Engine;
var documentNode = Lower(codeDocument, defaultEngine);
var pass = new DirectiveRemovalOptimizationPass()
{
@ -81,10 +81,10 @@ namespace Microsoft.AspNetCore.Razor.Language
var expectedDiagnostic = RazorDiagnostic.Create(new RazorDiagnosticDescriptor("RZ9999", () => "Some diagnostic message.", RazorDiagnosticSeverity.Error), SourceSpan.Undefined);
var sourceDocument = TestRazorSourceDocument.Create(content);
var codeDocument = RazorCodeDocument.Create(sourceDocument);
var defaultEngine = RazorEngine.Create(b =>
var defaultEngine = RazorProjectEngine.Create(b =>
{
b.AddDirective(DirectiveDescriptor.CreateDirective("custom", DirectiveKind.SingleLine, d => d.AddStringToken()));
});
}).Engine;
var documentNode = Lower(codeDocument, defaultEngine);
// Add the diagnostic to the directive node.

View File

@ -13,6 +13,15 @@ namespace Microsoft.AspNetCore.Razor.Language
{
public class DocumentClassifierPassBaseTest
{
public RazorEngine Engine
{
get
{
var projectEngine = RazorProjectEngine.Create();
return projectEngine.Engine;
}
}
[Fact]
public void Execute_HasDocumentKind_IgnoresDocument()
{
@ -24,7 +33,7 @@ namespace Microsoft.AspNetCore.Razor.Language
};
var pass = new TestDocumentClassifierPass();
pass.Engine = RazorEngine.CreateEmpty(b => { });
pass.Engine = Engine;
// Act
pass.Execute(TestRazorCodeDocument.CreateEmpty(), documentNode);
@ -45,7 +54,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var pass = new TestDocumentClassifierPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = Engine,
ShouldMatch = false,
};
@ -73,13 +82,13 @@ namespace Microsoft.AspNetCore.Razor.Language
};
var pass = new TestDocumentClassifierPass();
pass.Engine = RazorEngine.CreateEmpty(b =>
pass.Engine = RazorProjectEngine.CreateEmpty(b =>
{
for (var i = 0; i < expected.Length; i++)
{
b.AddTargetExtension(expected[i]);
}
});
}).Engine;
ICodeTargetExtension[] extensions = null;
@ -102,7 +111,7 @@ namespace Microsoft.AspNetCore.Razor.Language
};
var pass = new TestDocumentClassifierPass();
pass.Engine = RazorEngine.CreateEmpty(b => { });
pass.Engine = Engine;
// Act
pass.Execute(TestRazorCodeDocument.CreateEmpty(), documentNode);
@ -130,7 +139,7 @@ namespace Microsoft.AspNetCore.Razor.Language
builder.Add(new UsingDirectiveIntermediateNode());
var pass = new TestDocumentClassifierPass();
pass.Engine = RazorEngine.CreateEmpty(b => { });
pass.Engine = Engine;
// Act
pass.Execute(TestRazorCodeDocument.CreateEmpty(), documentNode);
@ -157,7 +166,7 @@ namespace Microsoft.AspNetCore.Razor.Language
builder.Add(new CSharpCodeIntermediateNode());
var pass = new TestDocumentClassifierPass();
pass.Engine = RazorEngine.CreateEmpty(b => { });
pass.Engine = Engine;
// Act
pass.Execute(TestRazorCodeDocument.CreateEmpty(), documentNode);
@ -187,7 +196,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var pass = new TestDocumentClassifierPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = Engine,
Namespace = "TestNamespace",
Class = "TestClass",
Method = "TestMethod",
@ -222,7 +231,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var pass = new TestDocumentClassifierPass()
{
Engine = RazorEngine.CreateEmpty(b => { }),
Engine = Engine,
Namespace = "TestNamespace",
Class = "TestClass",
Method = "TestMethod",

View File

@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
var feature = new DefaultMetadataIdentifierFeature()
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
// Act
@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
var feature = new DefaultMetadataIdentifierFeature()
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
// Act
@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
var feature = new DefaultMetadataIdentifierFeature()
{
Engine = RazorEngine.Create(),
Engine = RazorProjectEngine.Create().Engine,
};
// Act

View File

@ -86,10 +86,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
private RazorEngine CreateEngine(params TagHelperDescriptor[] tagHelpers)
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
b.Features.Add(new TestTagHelperFeature(tagHelpers));
});
}).Engine;
}
private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)

View File

@ -1125,17 +1125,22 @@ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeMana
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument)
{
var engine = RazorEngine.Create();
return Lower(codeDocument, engine);
var projectEngine = RazorProjectEngine.Create();
return Lower(codeDocument, projectEngine);
}
private static DocumentIntermediateNode LowerDesignTime(RazorCodeDocument codeDocument)
{
var engine = RazorEngine.CreateDesignTime();
return Lower(codeDocument, engine);
var projectEngine = RazorProjectEngine.Create(b =>
{
b.Features.Add(new DesignTimeOptionsFeature(designTime: true));
});
return Lower(codeDocument, projectEngine);
}
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorEngine engine)
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorProjectEngine engine)
{
for (var i = 0; i < engine.Phases.Count; i++)
{
@ -1177,5 +1182,29 @@ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeMana
return descriptor;
}
private class DesignTimeOptionsFeature : IConfigureRazorParserOptionsFeature, IConfigureRazorCodeGenerationOptionsFeature
{
private bool _designTime;
public DesignTimeOptionsFeature(bool designTime)
{
_designTime = designTime;
}
public int Order { get; }
public RazorEngine Engine { get; set; }
public void Configure(RazorParserOptionsBuilder options)
{
options.SetDesignTime(_designTime);
}
public void Configure(RazorCodeGenerationOptionsBuilder options)
{
options.SetDesignTime(_designTime);
}
}
}
}

View File

@ -13,10 +13,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
public void Execute_SkipsDocumentWithNoClassNode()
{
// Arrange
var engine = CreateEngine();
var projectEngine = CreateProjectEngine();
var pass = new FunctionsDirectivePass()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var sourceDocument = TestRazorSourceDocument.Create("@functions { var value = true; }");
@ -38,16 +38,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
public void Execute_AddsStatementsToClassLevel()
{
// Arrange
var engine = CreateEngine();
var projectEngine = CreateProjectEngine();
var pass = new FunctionsDirectivePass()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var sourceDocument = TestRazorSourceDocument.Create("@functions { var value = true; }");
var codeDocument = RazorCodeDocument.Create(sourceDocument);
var irDocument = Lower(codeDocument, engine);
var irDocument = Lower(codeDocument, projectEngine);
// Act
pass.Execute(codeDocument, irDocument);
@ -74,19 +74,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
node => Assert.IsType<DirectiveIntermediateNode>(node));
}
private static RazorEngine CreateEngine()
private static RazorProjectEngine CreateProjectEngine()
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
FunctionsDirective.Register(b);
});
}
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorEngine engine)
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorProjectEngine projectEngine)
{
for (var i = 0; i < engine.Phases.Count; i++)
for (var i = 0; i < projectEngine.Phases.Count; i++)
{
var phase = engine.Phases[i];
var phase = projectEngine.Phases[i];
phase.Execute(codeDocument);
if (phase is IRazorDocumentClassifierPhase)

View File

@ -69,10 +69,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
private static RazorEngine CreateEngine()
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
InheritsDirective.Register(b);
});
}).Engine;
}
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorEngine engine)

View File

@ -353,10 +353,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
private static RazorEngine CreateEngine()
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
b.Features.Add(new DefaultMetadataIdentifierFeature());
});
}).Engine;
}
}
}

View File

@ -13,10 +13,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
public void Execute_SkipsDocumentWithNoClassNode()
{
// Arrange
var engine = CreateEngine();
var projectEngine = CreateProjectEngine();
var pass = new SectionDirectivePass()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var sourceDocument = TestRazorSourceDocument.Create("@section Header { <p>Hello World</p> }");
@ -38,17 +38,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
public void Execute_WrapsStatementInSectionNode()
{
// Arrange
var engine = CreateEngine();
var projectEngine = CreateProjectEngine();
var pass = new SectionDirectivePass()
{
Engine = engine,
Engine = projectEngine.Engine,
};
var content = "@section Header { <p>Hello World</p> }";
var sourceDocument = TestRazorSourceDocument.Create(content);
var codeDocument = RazorCodeDocument.Create(sourceDocument);
var irDocument = Lower(codeDocument, engine);
var irDocument = Lower(codeDocument, projectEngine);
// Act
pass.Execute(codeDocument, irDocument);
@ -76,19 +76,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
Children(section, c => Html(" <p>Hello World</p> ", c));
}
private static RazorEngine CreateEngine()
private static RazorProjectEngine CreateProjectEngine()
{
return RazorEngine.Create(b =>
return RazorProjectEngine.Create(b =>
{
SectionDirective.Register(b);
});
}
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorEngine engine)
private static DocumentIntermediateNode Lower(RazorCodeDocument codeDocument, RazorProjectEngine projectEngine)
{
for (var i = 0; i < engine.Phases.Count; i++)
for (var i = 0; i < projectEngine.Phases.Count; i++)
{
var phase = engine.Phases[i];
var phase = projectEngine.Phases[i];
phase.Execute(codeDocument);
if (phase is IRazorDocumentClassifierPhase)

View File

@ -12,83 +12,82 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
public void Empty()
{
// Arrange
var engine = RazorEngine.Create();
var document = CreateCodeDocument();
var projectEngine = CreateProjectEngine();
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
}
[Fact]
public void HelloWorld()
{
// Arrange
var engine = RazorEngine.Create();
var document = CreateCodeDocument();
var projectEngine = CreateProjectEngine();
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
}
[Fact]
public void CustomDirective()
{
// Arrange
var engine = RazorEngine.Create(b =>
var projectEngine = CreateProjectEngine(b =>
{
b.AddDirective(DirectiveDescriptor.CreateDirective("test", DirectiveKind.SingleLine));
});
var document = CreateCodeDocument();
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
}
[Fact]
public void BuildEngine_CallProcess()
{
// Arrange
var engine = RazorEngine.Create();
var document = RazorCodeDocument.Create(TestRazorSourceDocument.Create());
var projectEngine = CreateProjectEngine();
var projectItem = new TestRazorProjectItem("Index.cshtml");
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
Assert.NotNull(document.GetSyntaxTree());
Assert.NotNull(document.GetDocumentIntermediateNode());
Assert.NotNull(codeDocument.GetSyntaxTree());
Assert.NotNull(codeDocument.GetDocumentIntermediateNode());
}
[Fact]
public void CSharpDocument_Runtime_PreservesParserErrors()
{
// Arrange
var engine = RazorEngine.Create();
var document = RazorCodeDocument.Create(TestRazorSourceDocument.Create("@!!!", filePath: "test.cshtml"));
var projectEngine = CreateProjectEngine();
var projectItem = new TestRazorProjectItem("test.cshtml")
{
Content = "@!!!"
};
var expected = RazorDiagnosticFactory.CreateParsing_UnexpectedCharacterAtStartOfCodeBlock(
new SourceSpan(new SourceLocation("test.cshtml", 1, 0, 1), contentLength: 1),
"!");
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
var csharpDocument = document.GetCSharpDocument();
var csharpDocument = codeDocument.GetCSharpDocument();
var error = Assert.Single(csharpDocument.Diagnostics);
Assert.Equal(expected, error);
}
@ -97,18 +96,20 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
public void CSharpDocument_DesignTime_PreservesParserErrors()
{
// Arrange
var engine = RazorEngine.CreateDesignTime();
var document = RazorCodeDocument.Create(TestRazorSourceDocument.Create("@{", filePath: "test.cshtml"));
var projectEngine = CreateProjectEngine();
var projectItem = new TestRazorProjectItem("test.cshtml")
{
Content = "@{"
};
var expected = RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF(
new SourceSpan(new SourceLocation("test.cshtml", 1, 0, 1), contentLength: 1), Resources.BlockName_Code, "}", "{");
// Act
engine.Process(document);
var codeDocument = projectEngine.ProcessDesignTime(projectItem);
// Assert
var csharpDocument = document.GetCSharpDocument();
var csharpDocument = codeDocument.GetCSharpDocument();
var error = Assert.Single(csharpDocument.Diagnostics);
Assert.Equal(expected, error);
}

View File

@ -883,7 +883,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
private void DesignTimeTest()
{
// Arrange
var engine = RazorEngine.CreateDesignTime(builder =>
var projectEngine = CreateProjectEngine(builder =>
{
builder.ConfigureDocumentClassifier();
@ -895,21 +895,21 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
SectionDirective.Register(builder);
});
var document = CreateCodeDocument();
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.ProcessDesignTime(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
AssertSourceMappingsMatchBaseline(document);
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument());
AssertSourceMappingsMatchBaseline(codeDocument);
}
private void RunTimeTest()
{
// Arrange
var engine = RazorEngine.Create(builder =>
var projectEngine = CreateProjectEngine(builder =>
{
builder.ConfigureDocumentClassifier();
@ -921,20 +921,20 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
SectionDirective.Register(builder);
});
var document = CreateCodeDocument();
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument());
}
private void RunRuntimeTagHelpersTest(IEnumerable<TagHelperDescriptor> descriptors)
{
// Arrange
var engine = RazorEngine.Create(builder =>
var projectEngine = CreateProjectEngine(builder =>
{
builder.ConfigureDocumentClassifier();
builder.AddTagHelpers(descriptors);
@ -947,20 +947,20 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
SectionDirective.Register(builder);
});
var document = CreateCodeDocument();
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument());
}
private void RunDesignTimeTagHelpersTest(IEnumerable<TagHelperDescriptor> descriptors)
{
// Arrange
var engine = RazorEngine.CreateDesignTime(builder =>
var projectEngine = CreateProjectEngine(builder =>
{
builder.ConfigureDocumentClassifier();
builder.AddTagHelpers(descriptors);
@ -973,15 +973,15 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
SectionDirective.Register(builder);
});
var document = CreateCodeDocument();
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.ProcessDesignTime(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
AssertSourceMappingsMatchBaseline(document);
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument());
AssertSourceMappingsMatchBaseline(codeDocument);
}
}
}

View File

@ -12,22 +12,22 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
public void NamespaceToken()
{
// Arrange
var engine = RazorEngine.CreateDesignTime(builder =>
var engine = CreateProjectEngine(builder =>
{
builder.ConfigureDocumentClassifier();
builder.AddDirective(DirectiveDescriptor.CreateDirective("custom", DirectiveKind.SingleLine, b => b.AddNamespaceToken()));
});
var document = CreateCodeDocument();
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = engine.ProcessDesignTime(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
AssertSourceMappingsMatchBaseline(document);
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument());
AssertSourceMappingsMatchBaseline(codeDocument);
}
}
}

View File

@ -1,7 +1,6 @@
// 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 Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
@ -12,30 +11,28 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
public void HtmlWithDataDashAttribute()
{
// Arrange
var engine = RazorEngine.Create();
var document = CreateCodeDocument();
var projectEngine = CreateProjectEngine();
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
}
[Fact]
public void HtmlWithConditionalAttribute()
{
// Arrange
var engine = RazorEngine.Create();
var document = CreateCodeDocument();
var projectEngine = CreateProjectEngine();
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
}
}
}

View File

@ -1,7 +1,6 @@
// 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 Microsoft.AspNetCore.Razor.Language.Intermediate;
using Xunit;
@ -14,10 +13,10 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
{
// Arrange
var fileSystem = new DefaultRazorProjectFileSystem(TestProjectRoot);
var razorEngine = RazorEngine.Create(engine =>
var razorEngine = RazorProjectEngine.Create(engine =>
{
engine.Features.Add(new SuppressChecksumOptionsFeature());
});
}).Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, fileSystem);
// Act
@ -32,12 +31,12 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
{
// Arrange
var fileSystem = new DefaultRazorProjectFileSystem(TestProjectRoot);
var razorEngine = RazorEngine.Create(engine =>
var razorEngine = RazorProjectEngine.Create(engine =>
{
engine.Features.Add(new SuppressChecksumOptionsFeature());
engine.SetBaseType("MyBaseType");
});
}).Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, fileSystem);
// Act
@ -52,7 +51,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
{
// Arrange
var fileSystem = new DefaultRazorProjectFileSystem(TestProjectRoot);
var razorEngine = RazorEngine.Create(engine =>
var razorEngine = RazorProjectEngine.Create(engine =>
{
engine.Features.Add(new SuppressChecksumOptionsFeature());
@ -71,7 +70,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
@class.Interfaces = new[] { "global::System.IDisposable" };
@class.BaseType = "CustomBaseType";
});
});
}).Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, fileSystem);
// Act
@ -86,12 +85,12 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
{
// Arrange
var fileSystem = new DefaultRazorProjectFileSystem(TestProjectRoot);
var razorEngine = RazorEngine.Create(engine =>
var razorEngine = RazorProjectEngine.Create(engine =>
{
engine.Features.Add(new SuppressChecksumOptionsFeature());
engine.SetNamespace("MyApp.Razor.Views");
});
}).Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, fileSystem);
// Act

View File

@ -21,14 +21,14 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
assemblyName: "TestAssembly")
};
var engine = RazorEngine.Create(builder => builder.AddTagHelpers(descriptors));
var document = CreateCodeDocument();
var projectEngine = CreateProjectEngine(builder => builder.AddTagHelpers(descriptors));
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
}
[Fact]
@ -50,14 +50,14 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
})
};
var engine = RazorEngine.Create(builder => builder.AddTagHelpers(descriptors));
var document = CreateCodeDocument();
var projectEngine = CreateProjectEngine(builder => builder.AddTagHelpers(descriptors));
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
}
[Fact]
@ -87,14 +87,14 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
})
};
var engine = RazorEngine.Create(builder => builder.AddTagHelpers(descriptors));
var document = CreateCodeDocument();
var projectEngine = CreateProjectEngine(builder => builder.AddTagHelpers(descriptors));
var projectItem = CreateProjectItem();
// Act
engine.Process(document);
var codeDocument = projectEngine.Process(projectItem);
// Assert
AssertDocumentNodeMatchesBaseline(document.GetDocumentIntermediateNode());
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
}
private static TagHelperDescriptor CreateTagHelperDescriptor(

View File

@ -7,6 +7,7 @@ using Xunit;
namespace Microsoft.AspNetCore.Razor.Language
{
#pragma warning disable CS0618 // Type or member is obsolete
public class RazorEngineBuilderExtensionsTest
{
[Fact]
@ -93,4 +94,5 @@ namespace Microsoft.AspNetCore.Razor.Language
{
}
}
#pragma warning restore CS0618 // Type or member is obsolete
}

View File

@ -9,6 +9,7 @@ using Xunit;
namespace Microsoft.AspNetCore.Razor.Language
{
#pragma warning disable CS0618 // Type or member is obsolete
public class RazorEngineTest
{
[Fact]
@ -228,4 +229,5 @@ namespace Microsoft.AspNetCore.Razor.Language
phase => Assert.IsType<DefaultRazorCSharpLoweringPhase>(phase));
}
}
#pragma warning restore CS0618 // Type or member is obsolete
}

View File

@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{
// Arrange
var fileSystem = new TestRazorProjectFileSystem();
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, fileSystem)
{
Options =
@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var path = "/Views/Home/MyImport.cshtml";
var projectItem = new TestRazorProjectItem(path);
var project = new TestRazorProjectFileSystem(new[] { projectItem });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, project)
{
Options =
@ -63,7 +63,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{
// Arrange
var project = new TestRazorProjectFileSystem(new RazorProjectItem[] { });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, project);
// Act & Assert
@ -77,7 +77,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{
// Arrange
var project = new TestRazorProjectFileSystem(new RazorProjectItem[] { });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, project);
// Act & Assert
@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var path = "/Views/Home/Index.cshtml";
var projectItem = new TestRazorProjectItem(path);
var project = new TestRazorProjectFileSystem(new[] { projectItem });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, project);
// Act
@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var path = "/Views/Home/Index.cshtml";
var project = new TestRazorProjectFileSystem(new RazorProjectItem[] { });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, project);
// Act & Assert
@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var path = "/Views/Home/Index.cshtml";
var projectItem = new TestRazorProjectItem(path);
var project = new TestRazorProjectFileSystem(new[] { projectItem });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, project);
// Act
@ -145,7 +145,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var path = "/Views/Home/Index.cshtml";
var projectItem = new TestRazorProjectItem(path);
var project = new TestRazorProjectFileSystem(new[] { projectItem });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, project);
// Act - 1
@ -169,7 +169,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var projectItem = new TestRazorProjectItem("/Views/Home/Index.cshtml");
var project = new TestRazorProjectFileSystem(new[] { projectItem });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, project)
{
Options =
@ -193,7 +193,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var import1 = new TestRazorProjectItem("/MyImport.cshtml");
var import2 = new TestRazorProjectItem("/Views/Home/MyImport.cshtml");
var project = new TestRazorProjectFileSystem(new[] { import1, import2, projectItem });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, project)
{
Options =
@ -219,7 +219,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var import1 = new TestRazorProjectItem("/MyImport.cshtml");
var import2 = new TestRazorProjectItem("/Views/Home/MyImport.cshtml");
var project = new TestRazorProjectFileSystem(new[] { import1, import2, projectItem });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var defaultImport = RazorSourceDocument.ReadFrom(new MemoryStream(), "Default.cshtml");
var templateEngine = new RazorTemplateEngine(razorEngine, project)
{
@ -246,7 +246,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var projectItem = new TestRazorProjectItem("/Views/Home/Index.cshtml");
var project = new TestRazorProjectFileSystem(new[] { projectItem });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var defaultImport = RazorSourceDocument.ReadFrom(new MemoryStream(), "Default.cshtml");
var templateEngine = new RazorTemplateEngine(razorEngine, project)
{
@ -270,7 +270,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Arrange
var expected = new[] { "/Views/Home/MyImport.cshtml", "/Views/MyImport.cshtml", "/MyImport.cshtml" };
var project = new TestRazorProjectFileSystem();
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, project)
{
Options =
@ -294,7 +294,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var expected = new[] { "/Views/Home/MyImport.cshtml", "/Views/MyImport.cshtml", "/MyImport.cshtml" };
var projectItem = new TestRazorProjectItem("/Views/Home/Index.cshtml");
var fileSystem = new TestRazorProjectFileSystem(new[] { projectItem });
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, fileSystem)
{
Options =
@ -321,7 +321,7 @@ namespace Microsoft.AspNetCore.Razor.Language
"DefaultRazorProjectFileSystem");
var project = new DefaultRazorProjectFileSystem(testFolder);
var razorEngine = RazorEngine.Create();
var razorEngine = RazorProjectEngine.Create().Engine;
var templateEngine = new RazorTemplateEngine(razorEngine, project)
{
Options =
@ -355,6 +355,5 @@ namespace Microsoft.AspNetCore.Razor.Language
});
}
}
}

View File

@ -1,11 +1,11 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ea06819774d4f892a37cc84688446440dee29bd6"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2ceb35a784a30ab44eb8b621c9e61d2361841c63"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers_Runtime), @"default", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml")]
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
{
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"ea06819774d4f892a37cc84688446440dee29bd6", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"2ceb35a784a30ab44eb8b621c9e61d2361841c63", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers_Runtime
{
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("catchAll", new global::Microsoft.AspNetCore.Html.HtmlString("hi"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);

View File

@ -1,11 +1,11 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "00b5e01b7a405dcfde7e4d512ee930daaa1778b5"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5a02c3ec89081f6e0a8f4810e127eed40467c358"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await_Runtime), @"default", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml")]
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
{
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"00b5e01b7a405dcfde7e4d512ee930daaa1778b5", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"5a02c3ec89081f6e0a8f4810e127eed40467c358", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await_Runtime
{
#pragma warning disable 1998

View File

@ -1,4 +1,4 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "d351c0c4dc0afdbf46547fcd87692951d2e4871f"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "d5e5d28c0c504a7b0c5207a5230a5b7327ce5e09"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicImports_Runtime), @"default", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports.cshtml")]
@ -20,9 +20,9 @@ using System.Text;
#line default
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"d351c0c4dc0afdbf46547fcd87692951d2e4871f", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"8aa538f3517d6d8922adaf817015cf8a61a57046", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports0.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"ad27b5360a3a2ab427f824e417620a745c0f45de", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports1.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"d5e5d28c0c504a7b0c5207a5230a5b7327ce5e09", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"39c22940acc420eb6d46b6ff85ef6d5a2ab35fa1", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports0.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"ede697b6fb90aac312d589ae96a93289cdeb506f", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports1.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicImports_Runtime : Hello
{
#pragma warning disable 1998

View File

@ -1,11 +1,11 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e05d346bc9435e651c4c8f34515c1b5f2cff294a"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "b7372519d2a9b45537aba0e7d34309526d3014c3"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed_Runtime), @"default", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml")]
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
{
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"e05d346bc9435e651c4c8f34515c1b5f2cff294a", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"b7372519d2a9b45537aba0e7d34309526d3014c3", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed_Runtime
{
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "checkbox", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);

View File

@ -1,11 +1,11 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8479a280916bffac36ca773a941b3f9155fe4ace"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2e30c5c6e01a148ccf4ed5dd4a81939641312a17"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper_Runtime), @"default", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml")]
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
{
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"8479a280916bffac36ca773a941b3f9155fe4ace", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"2e30c5c6e01a148ccf4ed5dd4a81939641312a17", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper_Runtime
{
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "text", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);

View File

@ -1,11 +1,11 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "56c40717284b82fcb2ee9f60f09e8c6c0bda8959"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2775a5b97b6aa9fc7b162124fddb7400ec1e2472"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Runtime), @"default", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml")]
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
{
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"56c40717284b82fcb2ee9f60f09e8c6c0bda8959", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"2775a5b97b6aa9fc7b162124fddb7400ec1e2472", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Runtime
{
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data", new global::Microsoft.AspNetCore.Html.HtmlString("-delay1000"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);

View File

@ -1,11 +1,11 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ba7d8f5f5159a2389c780aa606885ef6c917a45a"
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ed55fda2b7b0b96b044fc45da658dc062479924f"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks_Runtime), @"default", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml")]
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
{
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"ba7d8f5f5159a2389c780aa606885ef6c917a45a", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"ed55fda2b7b0b96b044fc45da658dc062479924f", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml")]
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks_Runtime
{
#pragma warning disable 1998

Some files were not shown because too many files have changed in this diff Show More