1.0.0-beta5
Pre-release
Pre-release
Full .NET Support arrived!
- Now you can use RazorLight with a Full .NET Framework v4.5.1 and higher
ASP.NET MVC Core integration
New package brings ASP.NET MVC Core integration which allows you to inject services into your templates via built in Dependency Injection container
-
Add package
Install-Package RazorLight.MVC
-
Add RazorLight services in Startup.cs
public void ConfigureServices(IServiceCollection services)
{
....
services.AddRazorLight("/Views"); // <- This one
....
}
- Retreive IRazorLightEngine instance from controller constructor
private readonly IRazorLightEngine engine;
public HomeController(IRazorLightEngine engine)
{
this.engine = engine;
}
- Inject services to your templates
@inject MyProject.TestViewModel myModel
Small fixes
@include now works in Layout and ViewStart pages as well (#12)