n:m entity visibility

Posts   
 
    
JohnLand
User
Posts: 3
Joined: 27-May-2006
# Posted on: 27-May-2006 20:51:36   

Hi,

I'm evaluating the demo version and I'm running into a problem. I have a standard person-role relation and I'm trying to add a new role to a person. The personentity has a personrole collection and a role collection, which is the collection of role objects assigned to a person.

The problem is that if I add a new personrole to the personentity, the personrole collection is updated (a new item created), but the role collection is not updated (no new item created). How do update the role collection without saving and reloading/refreshing the personentity?

TIA

John Landheer

sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 28-May-2006 18:15:30   

Hello John

It sounds like a m:n relations that MUST use an intermediate entity, so it has to refetch the data from the db and therefore not possible really.

But...to be sure, can you please paste the schema?

JohnLand
User
Posts: 3
Joined: 27-May-2006
# Posted on: 29-May-2006 07:49:17   

Hmm, maybe I'm not that clear. What I'm trying to say is that llblgen can make collections based on n:m relations, so if you have a person->personrole<-role relation, llblgen will make a personrole collection AND an roles collection in the personentity. So far, so good. BUT if I add a personrole entity to the person, then it would be nice if the roles collection would be updated too, so the number of items in the personrole collection is the same as the numer of items in the roles collection. I hope this is clear.

John

sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 29-May-2006 11:25:39   

Ah! yes I understand.

I am afraid the only way this can be 'automated' is by including your code in regions provided by LLBLGen.

Please search for "Generated code - Adding your own code to the generated classes" in the manual. This documents a posiblity that would be applicable to you perhaps smile .

JohnLand
User
Posts: 3
Joined: 27-May-2006
# Posted on: 29-May-2006 16:32:18   

Ok, I see. I'll try to include it in a custom template. Good practise. Thanks.

John