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 am looking at ways to customize the code generation logic so it's a better match to our code but have a few questions:
1. I was able to use the existing syntax to figure how to do most of the things I want, but is there a language reference I can use to see what the full capabilities of the generator are?
2. for-example the following line from FieldProperties.vm:
$Translator.TranslateMethodAttributes($field.PropertyAttributes) $Translator.TranslateType($field.DataType, $field.AllowNulls) $field.Name
This will generate the signature of the property in the entity. My questions here is: is there a way to figure out if $field.DataType is an Entity, a collection of Entities, or just a primitive?
3. You seem to start the generation with Base.vm which means that there is always one file created, is there a way to override that and have it generate more than one files?
Thanks in advance!
|
|
|
Not sure why my post came out unformatted like that...
|
|
|
ok. I figured out question number 2. Now I just need a way to generate two files instead of one. Thanks!
|
|
|
1. The language is Velocity Template Language (specifically as implemented by NVelocity). Check the Velocity documentation for full information about this. However, we don't currently have documentation for the API / object model which we expose to the templates. We'll look at putting something together on this but for the time being please do ask if you have any questions. You can also use the Visual Studio Object Browser to look at the classes in Mindscape.LightSpeed.Generator.Model, which contains the object model for entities, fields, and associations. 2. A field always represents a primitive field. So field.DataType will be a primitive data type (one of the values you see in the Data Type drop-down in the designer). An entity or a collection of entities is instead represented by a Relationship -- see Relationships.vm for how this gets used and how to distinguish the cases. 3. This cannot easily be done using Visual Studio due to an architectural limitation of VS custom tools. Sorry. The lsgen command line tool generates one file per entity, so you could run that against your model; but this will still always start from a single Base.vm file, it will just rerun it against one entity at a time. |
|