Adding Association to Sub-Class

3 posts, 1 answers
  1. Jamie
    Jamie avatar
    2 posts
    Member since:
    Aug 2012

    Posted 23 Jul 2012 Link to this post

    Hi,

    I currently have a vertical hierarchy for three classes a -> b -> c. The hierarchy seems to model correctly using vertical inheritance, a primary 'ID' property added to (a). When I want to add an association for a separate table (lets call it d!) to an inherited table (in this case b) I can't reference the primary ID field in the drop down list of the association editor - all the local properties for b are listed, but none from a, specifically not the primary key that I need.

    From earlier posts, it appears that this ought to be possible, but I can't see an obvious mechanism. Am I missing something here?!

    Thanks,

    J.
  2. Answer
    Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 25 Jul 2012 Link to this post

    Hello Jamie,

    If you just choose 'Default' in this case, you should be able to proceed without problems during runtime. The OpenAccess runtime automatically finds the primary key property of the corresponding class and relates the foreign key of "d"  to that primary key. The other way to achieve more precise definition during design time would be, if you have your tables defined, to use the relational view of the association editor where you could chose the correct column of the "b" table. That is however, not necessary for scenarios where you have a single id field declared in the base class.

    Kind regards,
    Zoran
    the Telerik team
    OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
  3. DevCraft banner
  4. Jamie
    Jamie avatar
    2 posts
    Member since:
    Aug 2012

    Posted 26 Jul 2012 Link to this post

    Hi Zoran,

    Ah, I see - I had wondered how the 'Default' option actually works, thanks for explaining! And I see what you mean about the relational editor as well, that makes sense.

    Thanks for your help and prompt response.

    Thanks,

    J.
Back to Top