Table name to namespace

Posts   
 
    
cloude1080
User
Posts: 4
Joined: 24-Jan-2007
# Posted on: 16-Sep-2007 07:15:50   

Hi,

I am trying to make LLBL to generate entity's namespace based on table name. Basically, we have a 3rd party system that use naming convention like this.

COM_table1, COM_table2, CMS_table3, CMS_table4, etc...

Is there a way to make LLBL generate entities so that those tables above would become: Com.Table1Entity , Cms.Table3Entity instead of ComTable1Entity ?

Many thanks. Steve

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39863
Joined: 17-Aug-2003
# Posted on: 17-Sep-2007 11:40:11   

That's not possible at the moment. Namespace separation has been requested a couple of times, but it wasn't really solvable. The thing is that the code generated is more than just the entity classes. So if you divide up the set of entities in groups, the code generated for these classes also has to be split up into groups, e.g. relation classes, collection classes (if you're using selfservicing), factories etc.

This effectively comes down to generating code per group in a separate project which has the downside of not having the relations between the groups.

So the code in the templates has to be re-organized to support this, and currently that's not possible: it has to have a group of 'shared code' and then for each group the code for that group in a separate namespace. Though if two entities A and B have a relation and A is in namespace X and B is in namespace Y, the relation A-B is in namespace X and the relation B-A is in namespace Y. This can be cumbersome, both in usage and in the underlying code.

Frans Bouma | Lead developer LLBLGen Pro
cloude1080
User
Posts: 4
Joined: 24-Jan-2007
# Posted on: 17-Sep-2007 11:47:43   

Otis wrote:

That's not possible at the moment. Namespace separation has been requested a couple of times, but it wasn't really solvable. The thing is that the code generated is more than just the entity classes. So if you divide up the set of entities in groups, the code generated for these classes also has to be split up into groups, e.g. relation classes, collection classes (if you're using selfservicing), factories etc.

This effectively comes down to generating code per group in a separate project which has the downside of not having the relations between the groups.

So the code in the templates has to be re-organized to support this, and currently that's not possible: it has to have a group of 'shared code' and then for each group the code for that group in a separate namespace. Though if two entities A and B have a relation and A is in namespace X and B is in namespace Y, the relation A-B is in namespace X and the relation B-A is in namespace Y. This can be cumbersome, both in usage and in the underlying code.

Hi Otis, thanks for explaining everything to me. After all, putting all entities in the same namespace does make sense.

Many thanks.