Detect if a relation between two entities is 0..1 to many or 1 to many

Posts   
 
    
chrissie
User
Posts: 84
Joined: 05-Oct-2010
# Posted on: 14-Feb-2011 17:51:02   

Hi,

How can i detect in a template if a relation between two entities is a 0..1 to many relation ( which also means that the correspondent navigation object can be null ) or a 1 to many ( which also means that the correspondent object must not be null -> a validator is generated automatically )? I already checked the RelationInfo class in the core assembly reference documentation but did not see any possibility.

thanx in advance

regards

chris

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 15-Feb-2011 00:36:20   

What LLBLGen version are you using? What template system (TDL, lpt)?

BTW, These are the relation types you can use:

Undefined (The relation type is undefined. ) OneToOne (A 1:1 relationship ) OneToMany (A 1:n relationship ) ManyToMany (A m:n relationship ) ManyToOne (A m:1 relationship )

So, if you are using lpt, I think you must check the RelationshipType property of the relation and then you can check the fk fields in the other end (pk or fk, depending) to check the IsOptional property of the FieldElement.

David Elizondo | LLBLGen Support Team
chrissie
User
Posts: 84
Joined: 05-Oct-2010
# Posted on: 16-Feb-2011 17:33:17   

hi daelmo,

thanx for your answer. i checked it out, works well.

regards

chris