Is the NVelocity project dead? Are there alternati

2019-02-16 04:13发布

I'm looking for a template engine for .NET/C# to generate email notifications in my application. I read about NVelocity in the past and think it would fit my needs, but it seems this project is dead.

Would you still recommended to use NVelocity for that purpose or can you suggest any alternatives?

Note: I found some other templating engines, but these are mostly "view-engines" for ASP.NET MVC (Brail, NHaml, etc.). But I think these are not what I'm looking for.

10条回答
2楼-- · 2019-02-16 04:49

I agree with Simon; http://www.stringtemplate.org/ is excellent, very well designed and is being actively maintained.

查看更多
做个烂人
3楼-- · 2019-02-16 04:50

I would recommend using XSLT for templating. Yes, it requires a little more time to learn the technology, but then you have much more flexible template solution than anything else.

查看更多
贪生不怕死
4楼-- · 2019-02-16 04:51

I don't see a reason not to use NVelocity (the Castle project fork). It's stable and your specific needs (email templates) are probably not as complex as the ones from other projects which use NVelocity, so you shouldn't expect any problems.

查看更多
Fickle 薄情
5楼-- · 2019-02-16 04:51

There's nothing wrong with NVelocity except that it's hard to find the most updated version of the project. Google typically turns up the old sourceforge link as the first hit, and the codeplex link is the next most common. The place to get it is from Castle as Pervez Choudhury mentioned. We use the Castle version of NVelocity at work, and it's great.

There's another option that emerged in the years since this question was first asked, and that is Microsoft's T4. Most people think of T4 as a pre-compilation generator as that was how it was first release, but actually you can now use it to generate a generator class and do dynamic generation at runtime. It's called a preprocessed T4 template, and you can read more about it here. The advantage is that it's already built into Visual Studio so you don't need to do anything special to get going.

查看更多
▲ chillily
6楼-- · 2019-02-16 04:51

As NVelocity seems to have died (again), I would suggest DotLiquid. Cannot say much for now as I'm still evaluating it, but it sure looks promising (and builds as MonoTouch/MonoDroid library for what I'm concerned).

UPDATE [11 Jun 2012]

The constraint of having "safe" classes/collections as models may be a major source of headaches. When evaluating this engine, you may want to start from this point.

查看更多
聊天终结者
7楼-- · 2019-02-16 05:02

The Castle Project forked the project and have been maintaining it, and most recently released version 1.1.1 on 10 December 2010. More details can be found at the Castle Projects NVelocity site. They have also made a number of improvements to it, details of which can be found on their NVelocity improvements page. The project looks like it is now dead and in MonoRail 3, it has been replaced by Castle Blade which is based off Razor.

If you are looking for an alternative, then I would suggest the Razor view engine from ASP.Net MVC3 or the Spark View Engine.

The open source project RazorEngine allows you to use the the Razor View engine outside of ASP.Net MVC or Web Pages so you can use it to generate templated emails.

查看更多
登录 后发表回答