Migrating code generated using old templates

Posts   
 
    
WilliamB
User
Posts: 17
Joined: 10-Feb-2022
# Posted on: 09-Mar-2022 18:52:19   

Hello there,

I have the following code inside a old template I inherited and has been used with LLBLGen version 3.5.

EntityInclude.template

protected override void OnInitializing()
{
            base.OnInitializing();

            // Set the Name
            this.SetName("<[CurrentEntityName]>");
}

I am using LLBLGen v5.8 to generate but the method **SetName **is no longer available in **EntityCore **class. I can find it in https://www.llblgen.com/documentation/5.3/ReferenceManuals/LLBLGenProRTF/html/8275DDE2.htm but I cannot find for version 5.4 onwards. Quick review on the Migrating your code, did not help either.

How can I reproduce this functionality?

Thanks in advance.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 10-Mar-2022 09:54:49   

EntityInclude.template is a template we ship, so you have to migrate the changes that were made to that template to the current one, as it's not compatible (we refactored it a lot). I have the feeling the changes made were to get rid of the 'Entity' suffix? If you check the current EntityInclude.template template, you'll see the name is set at line 66.

Frans Bouma | Lead developer LLBLGen Pro
WilliamB
User
Posts: 17
Joined: 10-Feb-2022
# Posted on: 10-Mar-2022 14:04:57   

Thank you again, Otis.

I went to line 66 (C:\Program Files (x86)\Solutions Design\LLBLGen Pro v5.8\Frameworks\LLBLGen Pro\Templates\SharedTemplates\Net3.5\C#\entityInclude.template) and found the following. lines[63 -66]

public static <[CurrentEntityName]>Entity FetchPolymorphicUsingUC<[Foreach UniqueConstraintEntityField]><[EntityFieldName]><[NextForeach]>(ITransaction transactionToUse, <[Foreach UniqueConstraintEntityField Comma]><[If GenerateAsNullableType]>Nullable<<[TypeOfField]>><[Else]><[TypeOfField]><[EndIf]> <[CaseCamel EntityFieldName]><[NextForeach]>, Context contextToUse)
        {
            return FetchPolymorphicUsingUC<[Foreach UniqueConstraintEntityField]><[EntityFieldName]><[NextForeach]>(transactionToUse, <[Foreach UniqueConstraintEntityField Comma]><[CaseCamel EntityFieldName]><[NextForeach]>, contextToUse, null);
        }

Probably I am looking into the wrong file?

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 11-Mar-2022 07:50:44   

I believe Otis meant entity.template or entityBase.template. Where you can see a call to SetEntityCoreInfo method with the first parameter being the entity name as such:

SetEntityCoreInfo("<[CurrentEntityName]>Entity",...
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 11-Mar-2022 10:10:28   

Yes sorry my bad flushed I looked at the wrong file

Frans Bouma | Lead developer LLBLGen Pro