RazorEngine.NetCore.ZuLiang
2.2.3.1
Fork from https://github.com/hermanho/RazorEngine, But Fixed Bug that Razor string does not support @using and @inherits and @functions and @section, etc.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
Install-Package RazorEngine.NetCore.ZuLiang -Version 2.2.3.1
dotnet add package RazorEngine.NetCore.ZuLiang --version 2.2.3.1
<PackageReference Include="RazorEngine.NetCore.ZuLiang" Version="2.2.3.1" />
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.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RazorEngine.NetCore.ZuLiang, 2.2.3.1"
For F# scripts that support #r syntax, copy this into the source code to reference the package.
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);
Dependencies
-
.NETFramework 4.6.1
- Microsoft.AspNetCore.Razor (>= 2.2.0)
- Microsoft.AspNetCore.Razor.Language (>= 2.2.0)
- Microsoft.AspNetCore.Razor.Runtime (>= 2.2.0)
- Microsoft.CodeAnalysis.CSharp (>= 2.8.0)
- Microsoft.CSharp (>= 4.5.0)
- System.Reflection.Emit (>= 4.3.0)
- System.Security.Permissions (>= 4.5.0)
-
.NETStandard 2.0
- Microsoft.AspNetCore.Razor (>= 2.2.0)
- Microsoft.AspNetCore.Razor.Language (>= 2.2.0)
- Microsoft.AspNetCore.Razor.Runtime (>= 2.2.0)
- Microsoft.CodeAnalysis.CSharp (>= 2.8.0)
- Microsoft.CSharp (>= 4.5.0)
- System.Reflection.Emit (>= 4.3.0)
- System.Security.Permissions (>= 4.5.0)
Used By
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)
|