Set an order on @inject to run behind @namespace
The problem is that @inject uses the type name, and @namespace can change it. Setting an explicit order makes sure that these things happen in a sensible sequence.
This commit is contained in:
parent
3b31e977b2
commit
c0e3519bc3
|
|
@ -22,6 +22,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
||||||
|
|
||||||
internal class Pass : RazorIRPassBase, IRazorDirectiveClassifierPass
|
internal class Pass : RazorIRPassBase, IRazorDirectiveClassifierPass
|
||||||
{
|
{
|
||||||
|
// Runs after the @model and @namespace directives
|
||||||
|
public override int Order => 10;
|
||||||
|
|
||||||
public override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIRNode irDocument)
|
public override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIRNode irDocument)
|
||||||
{
|
{
|
||||||
var visitor = new Visitor();
|
var visitor = new Visitor();
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ global::System.Object __typeHelper = nameof(Test.Namespace);
|
||||||
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
||||||
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
|
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
|
||||||
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
||||||
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace_cshtml> Html { get; private set; }
|
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<PageWithNamespace_Page> Html { get; private set; }
|
||||||
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<PageWithNamespace_Page> ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<PageWithNamespace_Page>)PageContext?.ViewData;
|
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<PageWithNamespace_Page> ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<PageWithNamespace_Page>)PageContext?.ViewData;
|
||||||
public PageWithNamespace_Page Model => ViewData.Model;
|
public PageWithNamespace_Page Model => ViewData.Model;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace Test.Namespace
|
||||||
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
||||||
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
|
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
|
||||||
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
||||||
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace_cshtml> Html { get; private set; }
|
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<PageWithNamespace_Page> Html { get; private set; }
|
||||||
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<PageWithNamespace_Page> ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<PageWithNamespace_Page>)PageContext?.ViewData;
|
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<PageWithNamespace_Page> ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<PageWithNamespace_Page>)PageContext?.ViewData;
|
||||||
public PageWithNamespace_Page Model => ViewData.Model;
|
public PageWithNamespace_Page Model => ViewData.Model;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue