Dynamic typedlist with user defined relation

Posts   
 
    
rparkins
User
Posts: 66
Joined: 04-May-2005
# Posted on: 21-Jul-2008 11:48:36   

Hi,

I must have a brain block as I cant see a way round doing this. I have been creating dynamic typed lists for a while now relying on the relationship types defined in the entity objects but have a slightly different angle on this and I cant figure rage I am using self servicing version 2.5 final

So I have a table (say a logging table) that doesn;t have relations to any other table BUT has a reason key and a reason type which effectively detail the type of log entry and what object key created it. For example a log entry row is created by a quote table with entry key 109897 and another log entry is created by an invoice entry with entry key 23213.

So here's my problem, obviously these tables have no relation at all so how do I go about telling the dynamic list that they do have a relationship? I have checked the documentation and cant seem to find it, is this possible? (I am sure it is as you can do this in the designer) so please can anyone point me in the right direction

Many thanks as always

Richard

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 21-Jul-2008 15:47:01   

You will get a good hint if you check these predefined relations in the generated code.

eg.

relations.Add(new EntityRelation(CustomerFields.Id, OrderFields.CustomerId, RelationType.OneToMany));
rparkins
User
Posts: 66
Joined: 04-May-2005
# Posted on: 21-Jul-2008 16:21:20   

Jeez so close to this I didn;t think...

Many thanks

Richard

Walaa wrote:

You will get a good hint if you check these predefined relations in the generated code.

eg.

relations.Add(new EntityRelation(CustomerFields.Id, OrderFields.CustomerId, RelationType.OneToMany));