diff --git a/src/docs/reference/core/Razor/README.md b/src/docs/reference/core/Razor/README.md index 24ad6e5bce9..fe4c9f85319 100644 --- a/src/docs/reference/core/Razor/README.md +++ b/src/docs/reference/core/Razor/README.md @@ -44,7 +44,9 @@ Many extensions methods are available in Razor with `@Orchard`. If you want to use an extension method in a view, you can inject an `IOrchardHelper` named `Orchard` at the top of your file: ```csharp -@inject OrchardCore.IOrchardHelper Orchard +// You can also put this into a _ViewImports.cshtml file so it's applied to all templates. +@using OrchardCore +@inject IOrchardHelper Orchard ``` In `OrchardCore.DisplayManagement.Razor`, there is a RazorPage that already has a public property `Orchard` that you can use to call an extension method or the current `HttpContext`. @@ -52,6 +54,7 @@ In `OrchardCore.DisplayManagement.Razor`, there is a RazorPage that already has If you want to use an Orchard helper in a controller, you can inject an instance in the constructor: ```csharp +using OrchardCore; private IOrchardHelper _orchard; public MyClass(IOrchardHelper orchard)