emit code per EntityRelation (not per entity)

Posts   
 
    
oki
User
Posts: 27
Joined: 12-Sep-2007
# Posted on: 23-Dec-2008 17:58:23   

Hello together, is it possible to generate a sourcecode-files for each EntityRelation?

Something like the shipped CodeEmitter with EmitType="allRelationsOfAllEntities" :

Foreach EntityRelation 
   Perform CodeEmitter (Entity, EntityRelation) 
loop 
Walaa avatar
Walaa
Support Team
Posts: 14987
Joined: 21-Aug-2005
# Posted on: 24-Dec-2008 08:19:51   

There are already code generated for each relation so the capability is there, but would you please explain what you are trying to do in more details.

Also it would give you a good head start to check the SDK documentation, shippped inside the SDK package. (Downloadable from the site).

oki
User
Posts: 27
Joined: 12-Sep-2007
# Posted on: 29-Dec-2008 16:03:34   

Thanks for your quick reply and pointing me to the SDK documentation!

I've started to read the SDK doc and investigated the CodeEmitter.cs ... ... but, why should I reinvent the wheel or get in trouble with my own emitter when moving to a new llblgen version?

Based on the ASP.NET 2.0 GUI generator templates for each entity were generated custom web-controls. (list<entity>.asx, edit<entity>.ascx, search<entity>.ascx and viewRelatedTo<entity>.ascx). This works well, if you have a 'simple' ER-Model with few tables and fewer relations.

I like to generate for each entity relation a custom web-control.

Afterwards I can click together the final webpages reusing these custom controls. (be more flexible in design of the pages, permissions, user roles, etc.)

Maybe anyone had solved a similar task. Create a single sourcecode file for

  • each Entity Relation of a Entity, each mapped database Field of a Entity, each Sub-type of a Entity, each custom property of a Entity
  • each mapped field of a typed List, each entity of a typed List, each custom property of a typed List, ...
  • each mapped field of a typed View, each entityof a typed View, each custom property of a typed View, ...
  • ...

This is like a cascaded loop:


   for each Object of a EmitType do a
   { 
          for each listed property (Relation, Custom Property, mapped field) 
          {
                 execute a Task (e.g. Perform Code Emitter).
          }
    }

Walaa avatar
Walaa
Support Team
Posts: 14987
Joined: 21-Aug-2005
# Posted on: 29-Dec-2008 16:17:38   

why should I reinvent the wheel or get in trouble with my own emitter when moving to a new llblgen version?

So what exactly is your request here? simple_smile

I like to generate for each entity relation a custom web-control.

Afterwards I can click together the final webpages reusing these custom controls. (be more flexible in design of the pages, permissions, user roles, etc.)

Maybe anyone had solved a similar task. Create a single sourcecode file for

each Entity Relation of a Entity, each mapped database Field of a Entity, each Sub-type of a Entity, each custom property of a Entity each mapped field of a typed List, each entity of a typed List, each custom property of a typed List, ... each mapped field of a typed View, each entityof a typed View, each custom property of a typed View, ... ...

Waw those would be too much of files to generate. Anyway as far as I know, you'll have to deal with Task performars and templates if you want to generate files for each relation....etc. Please check the SDK on Task Performars.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39771
Joined: 17-Aug-2003
# Posted on: 30-Dec-2008 10:59:27   

For code generation, it's not really useful to generate per relation a file, as that would probably mean thousands of files in an averagely large project.

Instead, you should focus on generating files per entities. Take a look at our ASP.NET example templates for example, which generate a database editor for ASP.NET from an llblgen pro project. These templates generate controls per entity which are then used to edit related data for example, so you can re-use editors/controls and keep things small.

Frans Bouma | Lead developer LLBLGen Pro