Custom properties/methods and regeneration

Posts   
 
    
wvnoort
User
Posts: 96
Joined: 06-Jan-2005
# Posted on: 13-Jan-2005 15:07:12   

I've been searching through the forum for methods to cope with the regeneration problem. I started using derived entity classes, but that does not solve all problems. See this thread:

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=1874

Instead of following the suggestion in the above thread, I'm trying a different approach. I'm building extra taskperformers to make a copy of the previous generated source and to merge the copy with the regenerated source. I changed the templates to add markers where the custom code should be merged.

What do you think, pro's/con's? Are there problems I wil run into with this approach?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 13-Jan-2005 15:37:35   

You tried include templates to get the same result? Each class has a pre-defined include template ID which you can bind to a file of your own using a custom templateset config, and the template is then merged into the standard template at generation time. I'm not sure if they're suitable for your needs of course.

Frans Bouma | Lead developer LLBLGen Pro
wvnoort
User
Posts: 96
Joined: 06-Jan-2005
# Posted on: 13-Jan-2005 16:10:47   

As I understand the documentation, the include template ID points to a single file. That single file will be merged in every generated source. For every entity I will need to write the logic that is specific for the entity as:

<[If StringValueEquals CurrentEntityName "Order"]> // your code for the Order entity <[EndIf]>

Following this scenario I will end up with a very large include template. Also, I don't have intellisense.

In fact, I'm looking for a substitute for partial classes and will switch to that as soon as possible.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 13-Jan-2005 17:07:16   

That's indeed a downside to this. For now (till the custom code in generated code merge facility is build in, which is planned) that's the option you have besides generating a subclass in where you add the logic you want.

(edit) I just got an idea how to fix a big 'entity include' template which is included in all teh entities. You can include templates in include templates. So if you add code like:

<[If StringValueEquals CurrentEntityName "Order"]> <# OrderEntityInclude #> <[EndIf]>

etc.

in the include template you include in the entity class, you can maintain the code per-entity in an include template for the time being, and you don't have to add it to one big master include template. In the above example, you bind OrderEntityInclude to the actual file with the additional order code.

Frans Bouma | Lead developer LLBLGen Pro
wvnoort
User
Posts: 96
Joined: 06-Jan-2005
# Posted on: 13-Jan-2005 17:28:42   

That still does not give me the intellisense.

I think I stick to my approach for the moment. However, I'm looking forward to that planned custom code in generated code merge facility.