Skip to content

danp60/essential-templating

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Essential Templating

Essential Templating is a set of libraries to render templated objects (like web pages or emails).

  • Provides easy to use template engine interface with C# 5.0 async methods.
  • Unified template location (now you can use files or .resx resources).
  • Localization support.

Essential.Templating.Razor

Template engine implementation based on [RazorEngine by Antaris]

Basic usage Template is located in "Hello.cshtml" file under "Templates" directory.

@inherits Essential.Templating.Razor.Template
Hello, @ViewBag.Name!

How to render the template?

ITemplateEngine engine = new RazorTemplateEngineBuilder()
                .FindTemplatesInDirectory("Templates")
                .CacheExpiresIn(TimeSpan.FromSeconds(20))
                .UseSharedCache()
                .Build();
string template = engine.Render(path: "Hello.cshtml", viewBag: new {Name = "John"});

What will we get as a result? Hello, John!

Essential.Templating.Razor.Email

Render razor pages as emails. See more at wiki.

To be continued... [RazorEngine by Antaris]:https://github.com/Antaris/RazorEngine

About

A set of templating libraries.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published