About template syntax references

Posts   
 
    
xc_lw2000
User
Posts: 48
Joined: 12-Dec-2006
# Posted on: 15-Mar-2011 04:55:56   

I'm creating a custom template,but it confused me a long time about the syntax.I want convert a [EntityFieldName] to upper case,which key word to use? ex:


     swich(key.ToUpper())
     {
       <[Foreach EntityField CrLf]>
               case "<[EntityFieldName]>":
                   //some c# code
        <[NextForeach]>     
     }  

I hope the generated code like bellow:


     swich(key.ToUpper())
     {
               case "ENTITYFIELD1":
                   //some c# code
               case "ENTITYFIELD2":
                   //some c# code
                
     } 

Maybe I will encounter other requirements,does the llbl supply some syntax references,like chm,pdf and so on?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 15-Mar-2011 06:38:24   

Here is the syntax reference. You can also download the chm from the LLBLGen Customer Area.

Unfortunately, there is no upper case modifier, just a CamelCase. You have workaround this by doing either of these:

a. Modify your generated code:

<[Foreach EntityField CrLf]>
if (key.ToUpper() == "<[EntityFieldName]>".ToUpper())
{
   // some c# code
}
<[NextForeach]>
if (key.ToUpper() == "EntityField1".ToUpper())
{
   // some c# code
}
generated code:

if (key.ToUpper() == "EntityField2".ToUpper())
{
   // some c# code
}

Not sure, but I think you still can tweak to use the switch. That is just approximate code occurs to me.

b. Use Lpt engine which is more powerful, you can do almost anything you want with templates.

David Elizondo | LLBLGen Support Team