模板引擎的.NET环境 [英] template engine for .NET environment
问题描述
我试图找到一个模板引擎在.NET环境中使用。它将被用来生成将被发送到成千上万的人的消息/电子邮件/通知,所以性能绝对是这里的关键要求之一。其他的一些要求是:
I am trying to find a template engine to use in .NET environment. It would be used to generate messages/email/notifications that would be sent out to thousands of people, so performance is definitely one of the key requirements here. Some of the other requirements are:
- 访问 C#对象在运行时:如
- Access C# objects at runtime : e.g.
来:其中; userObj.Name>
- 支持的条件并控制流
- Support conditionals and control flow
来:其中; (userObj.Name)== NULL? userObj.LastName:userObj.Name>
- 嵌套模板
- Nested templates
< renderHeader()>
\\身体
< renderFooter()>
- 预解析模板:创建一个预做它可以重复使用,不需要重新加载每次渲染需要处理的模板对象
- 从网址 加载图像通过指定变量图像图标
- Pre-parsed templates: Create a pre-processed template object which can be reused and not be required to reload every time rendering needs to be done
- load images from URL by specifying variable to image icon
IMG = LT; userObj.pictureURL>
- 所见即所得的编辑器:模板引擎将使用双方的开发者和非工程师,因此编辑将是非常不错的!
- WYSIWYG editor: The template engine will be used by both devs and non-engineers, so an editor would be really nice to have!
我要求什么了工作建议为你,如果你可以建议我的东西,将适合该法案。
I am asking for recommendations on what has worked out for you and if you can suggest me something that would fit the bill.
我会继续更新这个职位,因为我取得进步。
I'll keep updating this post as I make progress.
推荐答案
您可以看看 DotLiquid 。它满足你的大部分要求:
You could have a look at DotLiquid. It satisfies most of your requirements:
- Access to C# objects at runtime (through the use of drops)
- Liquid language supports conditionals and loops
- Nested templates (either through includes or template inheritance)
Template
objects can be cached and reused- WYSIWYG editor (not production ready, but it's a start)
这篇关于模板引擎的.NET环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!