/// <summary> /// Added the middlware that creates and disposes a <see cref="IRenderEngine"/> for each request /// </summary> /// <param name="app">The application.</param> public static void UseJsEngine( this AppBuilder app #if !DOTNETCORE , IRenderEngineFactory renderEngineFactory #endif ) { #if !DOTNETCORE app.Use <RenderEngineMiddleware>(renderEngineFactory); #else app.UseMiddleware <RenderEngineMiddleware>(); #endif }
/// <summary> /// Initializes a new instance of the <see cref="RenderEngineMiddleware"/> class. /// </summary> /// <param name="next">The next.</param> /// <param name="renderEngineFactory">The render engine factory.</param> public RenderEngineMiddleware(RequestDelegate next, IRenderEngineFactory renderEngineFactory) { _next = next; _renderEngineFactory = renderEngineFactory; }
public MvcApplication() { _renderEngineFactor = new SingletonRenderEngineFactory(new NodeRenderEngineBuilder(null, new Options <NodeRenderEngineOptions>(new NodeRenderEngineOptions()))); BeginRequest += OnBeginRequest; EndRequest += OnEndRequest; }