From 97a3fbdc359b2d6055b9dc64c8065af1dcf82855 Mon Sep 17 00:00:00 2001 From: Soundar Anbalagan Date: Sun, 13 Nov 2022 20:46:56 +0530 Subject: [PATCH] - Bumped version to 1.9.0-rc.1 - Updated README --- README.md | 10 ++++++++-- src/Razor.Templating.Core/Razor.Templating.Core.csproj | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a7e7391..8351d28 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This project makes use of [Razor SDK](https://docs.microsoft.com/en-us/aspnet/co | | .NET Core 3.0 | .NET Core 3.1 | .NET 5 | .NET 6 | |------------------|---------------|---------------|---------|--------------| -| Preferred Version| v1.6.0 | v1.6.0 | v1.6.0 | 1.8.0 | +| Preferred Version| v1.6.0 | v1.6.0 | v1.6.0 | 1.9.0-rc.1 | | Console | ✓ | ✓ | ✓ | ✓ | | Api | ✓ | ✓ | ✓ | ✓ | | Mvc | ✓ | ✓ | ✓ | ✓ | @@ -54,7 +54,7 @@ dotnet add package Razor.Templating.Core ``` ##### Using Package Reference .csproj ```bash - + ``` ## Simple Usage: @@ -79,6 +79,12 @@ var html = await RazorTemplateEngine.RenderAsync("/Views/ExampleView.cshtml", mo ``` Before applying this code, follow this article for sample implementation: https://medium.com/@soundaranbu/render-razor-view-cshtml-to-string-in-net-core-7d125f32c79 + +## Render View Without Layout +In case if there's a need to render a view without layout, use `RenderParitalAsync()` method. +```cs +var html = await RazorTemplateEngine.RenderPartialAsync("/Views/ExampleView.cshtml", model, viewDataOrViewBag); +``` ## Razor Views in Library Razor view files(.cshtml) can be organized in a separate shared Razor Class Libary(RCL). Sample library can be found [here](https://github.com/soundaranbu/RazorTemplating/tree/master/examples/Templates/ExampleAppRazorTemplates) diff --git a/src/Razor.Templating.Core/Razor.Templating.Core.csproj b/src/Razor.Templating.Core/Razor.Templating.Core.csproj index 0405e91..fd1c8c6 100644 --- a/src/Razor.Templating.Core/Razor.Templating.Core.csproj +++ b/src/Razor.Templating.Core/Razor.Templating.Core.csproj @@ -12,13 +12,13 @@ https://github.com/soundaranbu/RazorTemplating Soundar Anbalagan - 1.8.0 + 1.9.0-rc.1 git razor-templating,html-templatingrazor,render,dotnet-core,core,template-engine,email,emails,razor-view-to-string-renderer, razor-view-engine icon.png README.md - - Added IRazorTemplateEngine interface that can be used for constructor dependency injection instead of using a static class. + - Added `RenderPartialAsync` method to render views without layout Enable