This is a migrated thread and some comments may be shown as answers.

Metadata - Get Multiplicity for association ends

2 Answers 18 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Thorsten
Top achievements
Rank 1
Thorsten asked on 26 Jan 2013, 10:54 AM
Hi,

I'm trying to get the multiplicity of both ends for a MetaNavigationMember.
If the association has both ends, then its no problem:
var source = navigationMember.Multiplicity;
var target = navigationMember.GetOppositeMember().Multiplicity;

But if the opposite end is not available, then the only thing thats left is the association type.
The question now is how these types should be interpreted:

        Reference = ManyToZeroOne/ManyToOne ?
        PolymorphicReference  = ManyToZeroOne/ManyToOne ?
        Collection  = ManyToMany ?
        OneToMany  = OneToMany
        OneToManyJointable = OneToMany
        ManyToManyJointable = ManyToMany
        DictionaryJointable = ManyToMany ?
        StructReference  = ManyToZeroOne/ManyToOne ?
        OneToOne, = OneToOne/ZeroOneToOne/OneZeroToOne

Thanks in advance.

Kind regards,

Thorsten

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander
Telerik team
answered on 30 Jan 2013, 05:05 PM
Hello Thorsten,

You are on the right track, I will try to shed some more light on the different options and when they are used:

  •         Reference    = This is used for 1:N associations with no target (collection) end. The multiplicity of the source end is One or ZeroOne (if the foreign key is nullable).
  •         PolymorphicReference     = Same as above but also applies for references to interfaces or class hierarchies.
  •         Collection     = Used for 1:N associations with no source (reference) end. The multiplicity of the target end is Many.
  •         OneToMany     = Used for 1:N associations with two ends. The source is One/ ZeroOne and the target is Many.
  •         OneToManyJointable    = Used for M:N associations with only one end (collection). The multiplicity of the source end is Many.
  •         ManyToManyJointable    = Used for M:N associations with two ends. Both ends have multiplicity Many.
  •         DictionaryJointable    = Used for one-sided dictionary associations. The multiplicity of the only source end is Many.
  •         StructReference     = This is not supported at the moment, so you can ignore it.
  •         OneToOne,    = OneToOne/ZeroOneToOne/OneZeroToOne - This is used for OneToOne associations with one or two ends. The source end is always One while the Target is ZeroOrOne.

Hope that helps.

Greetings,
Alexander
the Telerik team
Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
0
Thorsten
Top achievements
Rank 1
answered on 31 Jan 2013, 08:21 AM
Hi,

thanks a lot.
That'll help me.
Tags
Development (API, general questions)
Asked by
Thorsten
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Thorsten
Top achievements
Rank 1
Share this question
or