Skip to content

Releases: toddams/RazorLight

1.1.0

01 May 09:23
Compare
Choose a tag to compare
  • Fixed bug with Configuration.Namespace not applied to the template
  • Downgrade dependency on Codeanalysis.CSharp to 1.3.0 to avoid nuget version conflicts with ASP.NET MVC

1.0.1

14 Apr 17:41
Compare
Choose a tag to compare

What's new

  • #49 TemplateCompilationException now includes line and column number where an error occured
  • #46 Added new overload for Parse() method. Now you can set a PreCenderCallback for each page individually. (Before you could only add callbacks to IEngineConfiguration that are applied for each page)

Bug fixes

  • Fix #47 (ExpandoObject as model type throws RuntimeBinderException)

1.0.0

05 Apr 13:51
Compare
Choose a tag to compare

What's new:

  • Update nuget packages to 1.1
  • Minor bug fixes

1.0.0-rc2

20 Feb 08:51
Compare
Choose a tag to compare
1.0.0-rc2 Pre-release
Pre-release

What's new:

  • Project migrated to MSBuild / *.csproj
  • For the convenience, compilation errors are now shown in Exception Message. No need to inspect CompilationErrors.
  • EngineFactory now returns IRazorLightEngine (was RazorLightEngine)
  • Minor bug fixes

1.0.0-rc1

13 Oct 13:19
Compare
Choose a tag to compare
1.0.0-rc1 Pre-release
Pre-release

Out first Release Candidate!

This release comes out with some improvements and refactorings. We are planning to roll up a stable version soon

  • ParseString() is extracted to an extension method (under RazorLight.Extensions namespace)
  • PreRenderCallbacks moved to IEngineConfiguration
  • While searching for Layout file - instead of InvalidOperationException - RazorLightException is thrown
  • No more AggregateExceptions. I'm erasing annoying AggregateExceptions from code. Please, open an issue If you see it again somewhere

1.0.0-beta6

27 Sep 16:38
Compare
Choose a tag to compare
1.0.0-beta6 Pre-release
Pre-release

This small release brings fixed for #15 and #18

1.0.0-beta5

31 Aug 15:41
Compare
Choose a tag to compare
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)

1.0.0-beta4

27 Aug 17:40
Compare
Choose a tag to compare
1.0.0-beta4 Pre-release
Pre-release

This release brings you Include feature

Example

@model MyProject.TestViewModel
<div>
    Hello @Model.Title
</div>

@{ await IncludeAsync("SomeView.cshtml", Model); }

First argument takes a key of the template to resolve, second argument is a model of the view (can be null)

1.0.0-beta3

12 Aug 17:15
Compare
Choose a tag to compare
1.0.0-beta3 Pre-release
Pre-release

New features

  • Use Raw() method to output model value without encoding ( #7 )

Changes

  • Fix #5
  • Rename PageCacheItem and PageCacheResult to PageLookupItem and PageLookupResult
  • Removed IMemoryCache from DefaultPageLookup
  • Added new IPageFactory with caching - CachingPageFactory
  • PageLookupResult default constructor removed. Use PageLookupResult.Failed instead

1.0.0-beta2

11 Aug 06:57
Compare
Choose a tag to compare
1.0.0-beta2 Pre-release
Pre-release

Changes

  • Pass ITemplateConfiguration to EngineFactory #3
IEngineConfiguration config = EngineConfiguration.Default;
config.Namespaces.Add("My.Custom.Namespace");
var engine = EngineFactory.CreatePhysical("root/folder", config);
  • Pass a ViewBag to Parse method. #4

Note: Viewbag is accessible both from the template page and it's layout.

Code

var model = new MyModel()
{
    Title = "Test"
};

//create a dynamic viewbag
dynamic viewBag = new ExpandoObject();
viewBag.DataForLayoutPage = "Hello world";

string result = engine.Parse("key", model, viewBag);

Template

@model MyViewModel

@{
    Layout = "layout_key";
}

<div>Hello @ViewBag.Title</div>