Lately I've grown fond of the NVelocity template engine - useful for things like email templates, more complex user friendly error messages etc. Pretty much anywhere where String.Format
and string concatenations seem like not the best way to complete the task at hand.
Due to some lack of samples and not a clear indication in the documentation on how to load and handle templates with NVelocity, I've put toghether this little sample application which coveres most of the methods how to load templates from various resources: embedded resources, files and in memory strings. You can, however, roll out your own implementation of the resource loader, but that is a subject for a future post. In the sample application, the different resource loading methods are implemented in the IMessageBuilder implementations.
NVelocity sample Visual Studio 2008 console application
Mihkel
0 comments:
Post a Comment