UserCodeRegion in entityUsingEntityBase

Posts   
 
    
BertS
User
Posts: 89
Joined: 28-Jul-2005
# Posted on: 05-Sep-2005 10:05:11   

Hi,

In my custom_entityUsingEntityBase.template, I've included:

<[ UserCodeRegion "CustomEntityValidationCode" ]>' __LLBLGENPRO_USER_CODE_REGION_START <[UserCodeRegionName]>
' __LLBLGENPRO_USER_CODE_REGION_END<[ EndUserCodeRegion ]>

This creates (as far as I can see) a correct UserCodeRegion.

When I generate the code with SelfServicing, two class scenario Full/Safe, the existing entities are not replaced, which is correct. But when I run SelfServicing, two class scenario Full, then I should expect that the code that is written between the start/end comments is saved. Problem is that the whole file seems to be overwritten, and the UserCode has gone...

Am I doing anything wrong?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 05-Sep-2005 10:28:11   

Place the ' __LLBLGENPRO_USER_CODE_REGION_START "CustomEntityValidationCode" on a new line, below the <[UserCodeRegion tag. Also replace <[UserCodeRegionName]> with "CustomEntityValidationCode" if that's not working.

Frans Bouma | Lead developer LLBLGen Pro
BertS
User
Posts: 89
Joined: 28-Jul-2005
# Posted on: 05-Sep-2005 10:47:23   

Hi Frans,

The probleem seems to be the variable in the comment. When I replace <[UserCodeRegionName]> with a fixed string, it's working correct.

Now, I'm also using <[UserCodeRegion EntityFieldName "Custom)$VALUE)FieldValidation"]> In that case, I'd like to use the <[UserCodeRegionName]> in the starting comment. But it seems now that I cannot do that.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 05-Sep-2005 12:09:15   

BertS wrote:

Hi Frans,

The probleem seems to be the variable in the comment. When I replace <[UserCodeRegionName]> with a fixed string, it's working correct.

Yes, the <[UserCodeRegionName]> statement is used to retrieve the name which is generated in the <[UserCodeRegion statement when you use a macro.

Now, I'm also using <[UserCodeRegion EntityFieldName "Custom)$VALUE)FieldValidation"]> In that case, I'd like to use the <[UserCodeRegionName]> in the starting comment. But it seems now that I cannot do that.

Hmm. It might be the ')' typo. Straight from the templates:


            <[ UserCodeRegion CurrentEntityName "CreateNew($VALUE)" ]>
            ' __LLBLGENPRO_USER_CODE_REGION_START <[ UserCodeRegionName ]>
            ' __LLBLGENPRO_USER_CODE_REGION_END
            <[ EndUserCodeRegion ]>     

which works ok.

Frans Bouma | Lead developer LLBLGen Pro
BertS
User
Posts: 89
Joined: 28-Jul-2005
# Posted on: 05-Sep-2005 12:50:56   

No, it's not the typo, because I found the problem in the first example (without macro).

But no worry, it works fine now (even with the start comment on the same line as the UserCodeRegion-statement).

thanx

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 06-Sep-2005 10:36:52   

Hmm, it still should work... I'll do some testing simple_smile

Frans Bouma | Lead developer LLBLGen Pro