This repository has been archived by the owner on Jan 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Implementing a View Engine
Nathan Armstrong edited this page Apr 6, 2017
·
8 revisions
This page will contain implementation advice for view engines
- Name the engine xxxViewEngine, where xxx is the name of the parser, such as Razor, Spark and so on
- The only public methods on a view engine should be those of the IViewEngine interface
- View engines are singletons, do not store state in them
- If you add dependencies to your engine, add a default ctor with default configuration
- Make use of the view cache on the render context that is passed into the IViewEngine.RenderView method - but make sure that the item you cache does not contain state that could end up being reused between multiple requests
- The initialize method is called when the view engine is created and all views that the engine can render will be passed in, along with the view cache
- If possible, integrate support for csrf (cross-site request forgery). Nancy comes with built in support but the engine needs to make use of it
« Part 10. Razor — Documentation overview — Part 11. View location conventions »
- Introduction
- Exploring the Nancy module
- Routing
- Taking a look at the DynamicDictionary
- Async
- View Engines
- Using Models
- Managing static content
- Authentication
- Lifecycle of a Nancy Application
- Bootstrapper
- Adding a custom FavIcon
- Diagnostics
- Generating a custom error page
- Localization
- SSL Behind Proxy
- Testing your application
- The cryptography helpers
- Validation
- Hosting Nancy with ASP.NET
- Hosting Nancy with WCF
- Hosting Nancy with Azure
- Hosting Nancy with Suave.IO
- Hosting Nancy with OWIN
- Hosting Nancy with Umbraco
- Hosting Nancy with Nginx on Ubuntu
- Hosting Nancy with FastCgi
- Self Hosting Nancy
- Implementing a Host
- Accessing the client certificate when using SSL
- Running Nancy on your Raspberry Pi
- Running Nancy with ASP.NET Core 3.1