IMvcRazorHost Interface

Specifies the contracts for a Razor host that parses Razor files and generates C# code.

Namespace
Microsoft.AspNetCore.Mvc.Razor
Assemblies
  • Microsoft.AspNetCore.Mvc.Razor.Host

Syntax

public interface IMvcRazorHost
interface Microsoft.AspNetCore.Mvc.Razor.IMvcRazorHost

Properties

Microsoft.AspNetCore.Mvc.Razor.IMvcRazorHost.DefaultNamespace

Represent the namespace the main entry class in the view.

Return type:System.String
string DefaultNamespace { get; }

Methods

GenerateCode(System.String, System.IO.Stream)

Parses and generates the contents of a Razor file represented by <em>inputStream</em>.

Arguments:
  • rootRelativePath (System.String) – The path of the relative to the root of the application. Used to generate line pragmas and calculate the class name of the generated type.
  • inputStream (System.IO.Stream) – A System.IO.Stream that represents the Razor contents.
Return type:

Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults

Returns:

A Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults instance that represents the results of code generation.

GeneratorResults GenerateCode(string rootRelativePath, Stream inputStream)