Enigmatry.Entry.TemplatingEngine.Razor 9.1.1-preview.5

This is a prerelease version of Enigmatry.Entry.TemplatingEngine.Razor.
dotnet add package Enigmatry.Entry.TemplatingEngine.Razor --version 9.1.1-preview.5
                    
NuGet\Install-Package Enigmatry.Entry.TemplatingEngine.Razor -Version 9.1.1-preview.5
                    
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="9.1.1-preview.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Enigmatry.Entry.TemplatingEngine.Razor" Version="9.1.1-preview.5" />
                    
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 9.1.1-preview.5
                    
#r "nuget: Enigmatry.Entry.TemplatingEngine.Razor, 9.1.1-preview.5"
                    
#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@9.1.1-preview.5
                    
#: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=9.1.1-preview.5&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Enigmatry.Entry.TemplatingEngine.Razor&version=9.1.1-preview.5&prerelease
                    
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 net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
9.1.1-preview.5 176 8/8/2025
9.1.1-preview.4 94 6/27/2025
9.1.1-preview.3 133 6/4/2025
9.1.0 624 6/3/2025
9.0.1-preview.8 132 5/26/2025
9.0.1-preview.7 211 5/13/2025
9.0.1-preview.6 104 5/9/2025
9.0.1-preview.5 126 5/7/2025
9.0.1-preview.4 124 4/30/2025
9.0.1-preview.2 130 4/1/2025
9.0.0 124 2/26/2025
8.1.1-preview.3 127 5/7/2025
8.1.1-preview.1 131 4/1/2025
8.1.0 112 2/19/2025
8.0.1-preview.4 76 2/7/2025
8.0.1-preview.2 68 1/15/2025
8.0.0 220 11/27/2024
3.4.6-preview.10 71 11/27/2024
3.4.3 115 10/22/2024
3.4.2 116 10/11/2024
3.4.1 121 10/9/2024
3.4.0 111 10/9/2024
3.3.2 128 8/28/2024
3.3.2-preview.7 76 8/27/2024
3.3.1 140 7/16/2024
3.3.1-preview.4 73 7/12/2024
3.3.0 140 6/20/2024
3.2.1-preview.4 75 6/17/2024