How to Handle Relationships?

3 posts, 1 answers
  1. Mulham
    Mulham avatar
    5 posts
    Member since:
    Mar 2007

    Posted 06 Jun 2011 Link to this post

    Hello,
    I was following the quickstart of building silverlight application using WCF RIA Services. But then I got stuck at the handling relationship section. The example mentioned there is perfectly understood when I work with reversed-engineered model...but what if the scenario of the Product-Category classes were just like the one here (Forward Mapping).

    If I tried the code in the handling relationship section: [Association("Category", "CategoryId", "CategoryId")] 
    Then, compiling the silverlight application will give the following error:
    Error 12 Association named 'Category' defined on entity type 'Product' is invalid: ThisKey property named 'CategoryID' cannot be found.

    This of course makes sense since there's no CategoryId property defined in the Product class in the forward mapping model just like the case of the reverse mapping scenario. How do I go around this problem?

    Thanks :)
  2. Mulham
    Mulham avatar
    5 posts
    Member since:
    Mar 2007

    Posted 06 Jun 2011 Link to this post

    Hello again,

    I figured it out :) I have to explicitly define the foreign key in the Product class...in other words, I have to add the CategoryId property to the Product class.

    thanks :)
  3. DevCraft banner
  4. Answer
    PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 08 Jun 2011 Link to this post

    Hello Mulham,

     Indeed this should solve your problem. We are happy that you have managed to solve your problem. Please do not hesitate to contact us back should you have any further problems.

    All the best,
    Petar
    the Telerik team
    Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
Back to Top