Enigmatry.Entry.TemplatingEngine.Razor 10.2.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Enigmatry.Entry.TemplatingEngine.Razor --version 10.2.2
                    
NuGet\Install-Package Enigmatry.Entry.TemplatingEngine.Razor -Version 10.2.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Enigmatry.Entry.TemplatingEngine.Razor" Version="10.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Enigmatry.Entry.TemplatingEngine.Razor" Version="10.2.2" />
                    
Directory.Packages.props
<PackageReference Include="Enigmatry.Entry.TemplatingEngine.Razor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Enigmatry.Entry.TemplatingEngine.Razor --version 10.2.2
                    
#r "nuget: Enigmatry.Entry.TemplatingEngine.Razor, 10.2.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Enigmatry.Entry.TemplatingEngine.Razor@10.2.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Enigmatry.Entry.TemplatingEngine.Razor&version=10.2.2
                    
Install as a Cake Addin
#tool nuget:?package=Enigmatry.Entry.TemplatingEngine.Razor&version=10.2.2
                    
Install as a Cake Tool

Razor Templating Engine

A templating engine library that uses the Razor view engine to generate content from templates.

Intended Usage

Use this library when you need to generate dynamic content from templates using the familiar Razor syntax, such as for email templates, document generation, or dynamic content rendering.

Installation

Add the package to your project:

dotnet add package Enigmatry.Entry.TemplatingEngine.Razor

Usage Example

using Enigmatry.Entry.TemplatingEngine;
using Microsoft.Extensions.DependencyInjection;

// In a non-DI environment, you would need to manually set up the service provider:
var services = new ServiceCollection();
services.AddRazorPages();
services.AddMvc();
services.AddEntryTemplatingEngine();
var serviceProvider = services.BuildServiceProvider();
var templateEngine = serviceProvider.GetRequiredService<ITemplatingEngine>();

// Define a model
var model = new EmailModel
{
    Username = "John",
    ActivationLink = "https://example.com/activate?token=abc123"
};

// Render a template from a file
string emailContent = await templateEngine.RenderFromFileAsync("EmailTemplates/WelcomeEmail", model);

// You can also pass view bag data if needed
var viewBag = new Dictionary<string, object>
{
    { "CurrentDate", DateTime.Now }
};
string emailContent = await templateEngine.RenderFromFileAsync("EmailTemplates/WelcomeEmail", model, viewBag);

Dependency Injection Example

Register the template engine in your application's service collection:

using Enigmatry.Entry.TemplatingEngine;

public void ConfigureServices(IServiceCollection services)
{
    // Register Razor pages and MVC components needed by the template engine
    services.AddRazorPages();
    services.AddMvc();
    
    // Register the templating engine
    services.AddEntryTemplatingEngine();
}

Then inject and use the template engine in your services:

using Enigmatry.Entry.TemplatingEngine;
using System.Collections.Generic;
using System.Threading.Tasks;

public class EmailService
{
    private readonly ITemplatingEngine _templateEngine;
    
    public EmailService(ITemplatingEngine templateEngine)
    {
        _templateEngine = templateEngine;
    }
    
    public async Task<string> GenerateWelcomeEmail(string username, string activationLink)
    {
        var model = new EmailModel
        {
            Username = username,
            ActivationLink = activationLink
        };
        return await _templateEngine.RenderFromFileAsync("Emails/Welcome", model);
    }
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.2.3 96 6/1/2026
10.2.3-preview.4 48 6/1/2026
10.2.2 114 4/27/2026
10.2.1-preview.1 60 4/27/2026
10.1.0 106 4/16/2026
10.0.1 175 5/19/2026
10.0.1-preview.2 58 4/16/2026
10.0.0 121 4/2/2026
9.6.0 109 3/18/2026
9.5.0 556 1/26/2026
9.4.0 1,485 12/22/2025
9.3.1-preview.3 253 12/18/2025
9.3.1-preview.1 513 11/25/2025
9.3.0 565 11/10/2025
9.2.0 731 9/24/2025
9.1.1-preview.5 229 8/8/2025
9.1.1-preview.4 153 6/27/2025
8.3.1-preview.1 157 12/24/2025
8.3.0 198 12/23/2025
8.2.0 282 9/24/2025
Loading failed