Code Region Formats

Posts   
 
    
basik
User
Posts: 123
Joined: 20-Aug-2012
# Posted on: 13-Aug-2014 18:54:52   

No doubt this one has been covered. I can't figure out to console my OCD tendencies for comments to be indented correctly.

Please find attached an example of the format of code regions in a custom LPT template

I've fixed the first class here and left the second as it comes out of the code generator.



// Partial Class BaseCurrencyEntityDto
    public partial class BaseCurrencyEntityDto : BaseDto 
    {
        //Add customisations between the the START and END tags
        // __LLBLGENPRO_USER_CODE_REGION_START BaseCurrencyEntityCustomCode 
        // __LLBLGENPRO_USER_CODE_REGION_END                                                                                                                                                                    
    }
    
    // Partial Class ClassificationEntityDto
    public partial class ClassificationEntityDto : BaseDto 
    {
        //Add customisations between the the START and END tags
                                                                    // __LLBLGENPRO_USER_CODE_REGION_START ClassificationEntityCustomCode 
        // __LLBLGENPRO_USER_CODE_REGION_END                                                                                                                                                                    
    }

Template code which produces that indent for the second partial class


        //Add customisations between the the START and END tags
    <%=DotNetTemplateEngine.GetUserCodeRegion(entityName + "CustomCode", "//")%>

Any tips would be appreciated. Thank you.

Attachments
Filename File size Added on Approval
CodeSectionFormats.jpg 69,984 13-Aug-2014 18:54.59 Approved
Walaa avatar
Walaa
Support Team
Posts: 14986
Joined: 21-Aug-2005
# Posted on: 13-Aug-2014 21:28:27   

Which LLBLGen's version/Designer release date are you using?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 14-Aug-2014 10:04:26   

Place the <%=DotNetTemplateEngine.GetUserCodeRegion(entityName + "CustomCode", "//")%>

at the start of the line, not with indentation in your template.

Frans Bouma | Lead developer LLBLGen Pro
basik
User
Posts: 123
Joined: 20-Aug-2012
# Posted on: 14-Aug-2014 10:04:35   

Sorry, that would be LLBLGenPro 4.2 Aug 6th Build

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 14-Aug-2014 10:11:20   

Please see my post simple_smile

Frans Bouma | Lead developer LLBLGen Pro
basik
User
Posts: 123
Joined: 20-Aug-2012
# Posted on: 14-Aug-2014 10:15:20   

Otis wrote:

Place the <%=DotNetTemplateEngine.GetUserCodeRegion(entityName + "CustomCode", "//")%>

at the start of the line, not with indentation in your template.

That aligns the comments nicely and results in this.



    // Partial Class BaseCurrencyEntityDto
    public partial class BaseCurrencyEntityDto : BaseDto 
    {
        //Add customisations between the the START and END tags
    // __LLBLGENPRO_USER_CODE_REGION_START BaseCurrencyEntityCustomCode 
    // __LLBLGENPRO_USER_CODE_REGION_END 
    
    }

Ideally the **//Add ** should align which in this case would need a tab or 4 spaces for the code region templates. I tried this <%=DotNetTemplateEngine.GetUserCodeRegion(entityName + "CustomCode", "\t//")%> which gives the desired result


    // Partial Class BaseCurrencyEntityDto
    public partial class BaseCurrencyEntityDto : BaseDto 
    {
        //Add customisations between the the START and END tags
        // __LLBLGENPRO_USER_CODE_REGION_START BaseCurrencyEntityCustomCode 
        // __LLBLGENPRO_USER_CODE_REGION_END    
    }