Select relation tables of MyGeneration

Gentle.NET Forum

Select relation tables of MyGeneration

Postby fravelgue on Fri Sep 09, 2005 10:58 am

Hi mates,

I´m novice in MyGeneration and and Gentle.NET template. And I have many doubts. But, my first question is does this template use Select relation tables options of MyGeneration.

Regards and thx in advance,
Fran,
fravelgue
Lurker
 
Posts: 7
Joined: Fri Sep 09, 2005 10:52 am
Location: Sevilla, Spain

Postby angelo on Fri Sep 09, 2005 9:36 pm

But, my first question is does this template use Select relation tables options of MyGeneration.


Not sure if I understand your question, but I'll give it a shot anyway...

The current version of the template as found in teh MyGen distribution and
on the Template library requires users to select tables that implement n:m relationships between other tables.

A new release is due end this month, which will eliminate user involvement in this and automatically generate the relations.

Does that answer your question?

Angelo
Vision without action is a daydream, action without vision is a nightmare...
User avatar
angelo
Major General
 
Posts: 159
Joined: Mon Jul 12, 2004 8:17 pm
Location: Best, The Netherlands

Re:

Postby fravelgue on Thu Sep 15, 2005 2:09 pm

angelo wrote:Template library requires users to select tables that implement n:m relationships between other tables.

Angelo


Hi Angelo,

If I have n:m relation, do i have to select 'intermediary table' in Select tables and/or Select relation tables?

I hoped if i select 'intermediary table' in Select relation tables, the i will not see this table in properties of class.

Thx in advance,
Fran,
fravelgue
Lurker
 
Posts: 7
Joined: Fri Sep 09, 2005 10:52 am
Location: Sevilla, Spain

Postby angelo on Thu Sep 15, 2005 5:46 pm

Hey there,

right now you have to do the following:

1 Select the table(s) for which you want to generate code in 'Select tables'
2 Select any n:m relation tables that are related to the selected tables in
'Select relation tables'
3 Generate your code.

You will now find n:m relations in your generated code, with names like

A::GetReferringXusingY, where A is your table, X is an n:m related table,
and Y is the relation table you selected in 'select relation tables'

In the upcoming version you will no longer need to specify the relation tables.

Angelo
Vision without action is a daydream, action without vision is a nightmare...
User avatar
angelo
Major General
 
Posts: 159
Joined: Mon Jul 12, 2004 8:17 pm
Location: Best, The Netherlands

Postby angelo on Thu Sep 15, 2005 5:47 pm

Ooops, forgot one detail:

Make sure all tables are selected in only one of the columns. It's no use
generating a business entity for a relation table or specifying a data table as a relation table. It only breaks the generated code.

Angelo
Vision without action is a daydream, action without vision is a nightmare...
User avatar
angelo
Major General
 
Posts: 159
Joined: Mon Jul 12, 2004 8:17 pm
Location: Best, The Netherlands

Re:

Postby fravelgue on Fri Sep 16, 2005 9:14 am

Sorry Angelo,

But if i do step by step your post, i don´t get relation tables entity. I get the funcion , referenced...Using...(), for example,

referencedPermissionUsingUserPermission()

But i don´t get UserPermission class.

:(
Fran,
fravelgue
Lurker
 
Posts: 7
Joined: Fri Sep 09, 2005 10:52 am
Location: Sevilla, Spain

Postby angelo on Fri Sep 16, 2005 6:42 pm

Ok, that means you really did follow the instruction. Point is that if you use the referringXusingY method, you don't need the UserPermission class. You can get all related User from the Permission class and all related Permissions from the User class.

If you want the UserPermission class anyway, select it in the 'Select tables' column despite what i said earlier.

Angelo
Vision without action is a daydream, action without vision is a nightmare...
User avatar
angelo
Major General
 
Posts: 159
Joined: Mon Jul 12, 2004 8:17 pm
Location: Best, The Netherlands

Re:

Postby fravelgue on Mon Sep 19, 2005 10:54 am

Hi Angelo,

Sorry Angelo, but i don´t know what i´m doing wrong. But i get this genered code, for this functions:

public IList referencedPermissionUsingRolPermission()
{
return new GentleList( typeof(Permission), this, typeof(RolPermission));
}

public IList referencedUserUsingUserRol()
{
return new GentleList( typeof(User), this, typeof(UserRol));
}

This functions refernce to RolPermissions class but those classes don´t exist.

thx
Fran,
fravelgue
Lurker
 
Posts: 7
Joined: Fri Sep 09, 2005 10:52 am
Location: Sevilla, Spain

Postby angelo on Mon Sep 19, 2005 1:31 pm

Hi Fran,

My mistake - I guess I got you confused because I mixed up two different situations (I'll spare the details).

For your situation:

Select tables: select User, Permission and RolPermission
Relation tables: select UserPermission

(In case I got the names wrong: select all tables mentioned in the
generated code)
That should do the trick, and ignore all my previous posts on this.
As said, in the next version (3 weeks from now) the 'Relation tables'
will be gone, and replaced by an automated mechanism.

Angelo
Vision without action is a daydream, action without vision is a nightmare...
User avatar
angelo
Major General
 
Posts: 159
Joined: Mon Jul 12, 2004 8:17 pm
Location: Best, The Netherlands


Return to Gentle.NET

Who is online

Users browsing this forum: No registered users and 0 guests

cron