RazorEngine.NetCore.ZuLiang 2.2.3.6

Fork from https://github.com/hermanho/RazorEngine, But Fixed Bug that Razor string does not support @using and @inherits and @functions and @section, etc.

Install-Package RazorEngine.NetCore.ZuLiang -Version 2.2.3.6
dotnet add package RazorEngine.NetCore.ZuLiang --version 2.2.3.6
<PackageReference Include="RazorEngine.NetCore.ZuLiang" Version="2.2.3.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RazorEngine.NetCore.ZuLiang --version 2.2.3.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
string template = @"
        @using RazorEngine.NetCore.ConsoleTest
        @inherits RazorEngine.Templating.TemplateBase<UserQueryCondition>
        @{
            string name = ""Admin"";
        }
        @functions
        {
            public string GetUserName(string name)
            {
                return ""Greate "" + name;
            }
            public string GetCurrentTime()
            {
                return DateTime.Now.ToString(""yyyy-MM-dd HH:mm:ss"");
            }
        }
        Hello @Model.Name, welcome to RazorEngine! @GetUserName(name) , Current Time: @GetCurrentTime()
    ";
var result = Engine.Razor.RunCompile(template, "templateKey", null, new UserQueryCondition
{
    Name = "World, perfect !"
});
Console.WriteLine("Template: {0}{0}\t{1}", Environment.NewLine, template);
Console.WriteLine("{0}{0}{0}", Environment.NewLine);
Console.WriteLine("Result: {0}{0}\t{1}", Environment.NewLine, result);
string template = @"
        @using RazorEngine.NetCore.ConsoleTest
        @inherits RazorEngine.Templating.TemplateBase<UserQueryCondition>
        @{
            string name = ""Admin"";
        }
        @functions
        {
            public string GetUserName(string name)
            {
                return ""Greate "" + name;
            }
            public string GetCurrentTime()
            {
                return DateTime.Now.ToString(""yyyy-MM-dd HH:mm:ss"");
            }
        }
        Hello @Model.Name, welcome to RazorEngine! @GetUserName(name) , Current Time: @GetCurrentTime()
    ";
var result = Engine.Razor.RunCompile(template, "templateKey", null, new UserQueryCondition
{
    Name = "World, perfect !"
});
Console.WriteLine("Template: {0}{0}\t{1}", Environment.NewLine, template);
Console.WriteLine("{0}{0}{0}", Environment.NewLine);
Console.WriteLine("Result: {0}{0}\t{1}", Environment.NewLine, result);

NuGet packages (1)

Showing the top 1 NuGet packages that depend on RazorEngine.NetCore.ZuLiang:

Package Downloads
SealReportLibrary.NETCore
.NET Core distribution of the Seal Report Library.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on RazorEngine.NetCore.ZuLiang:

Repository Stars
ariacom/Seal-Report
Open Database Reporting Tool (.Net)

Version History

Version Downloads Last updated
2.2.3.6 3,132 9/19/2019
2.2.3.5 1,281 5/17/2019
2.2.3.1 198 5/17/2019
2.2.3 209 5/16/2019