Metadata - Get Multiplicity for association ends

3 posts, 1 answers
  1. Thorsten
    Thorsten avatar
    26 posts
    Member since:
    Apr 2010

    Posted 26 Jan 2013 Link to this post

    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. Answer
    Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 30 Jan 2013 Link to this post

    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.
  3. DevCraft banner
  4. Thorsten
    Thorsten avatar
    26 posts
    Member since:
    Apr 2010

    Posted 31 Jan 2013 Link to this post

    Hi,

    thanks a lot.
    That'll help me.
Back to Top