This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I'm wondering where I can find documentation on the specifications in the Fields.vm file. I'd like to experiment with something other than CamelCase, but don't know what my options are for the the $Inflector object. |
|
|
The $Inflector object provides only a very few utility methods that we need for our own templates. It currently provides four camel-case helpers (the one you've found plus some variants for associations), and a method named Collection which basically pluralises an entity's name, so I don't think you'd find it very helpful for non-camel-case conventions. The good news is that the NVelocity engine is capable of calling arbitrary .NET code, so you can easily write your own string transformation code in C# to do what you want. The bad news is that as far as I can tell (and I admit I haven't researched this thoroughly, so I may be missing something), NVelocity doesn't provide a way to import DLLs through the template. It seems that only the host (the LightSpeed designer) can inject external objects. If you're interested in investigating this approach, we can look at providing an extensibility mechanism for you to inject your own DLLs / objects that you can then reference through your own template variables. Let us know if this is something that you'd be interested in following up. (You might also want to do a bit more digging in the NVelocity docs or mailing list to see if they do provide a means to declare external objects or include inline C# code in the template, which would avoid the need for a LightSpeed-side extensibility mechanism.) |
|
|
Thanks Ivan for your fast and clear answer. We generally use the convention that private fields are named "mVariable" (where 'm' not '_' is prefixed, followed by Pascal not Camel). I know, a lot of people don't care for that, but that's what we did. I was able to mostly get the template working because 'm' can easily be prefixed in front of the variable name (without the help of the $Inflector), but I hit a few snags with automatic create/update time tracking that I didn't dig into any further. I'm not going to worry too much about coding standards for generated code. Thanks again. Derek |
|