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

How to Handle Relationships?

2 Answers 53 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mulham
Top achievements
Rank 2
Mulham asked on 06 Jun 2011, 06:31 PM
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 Answers, 1 is accepted

Sort by
0
Mulham
Top achievements
Rank 2
answered on 06 Jun 2011, 07:36 PM
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 :)
0
Accepted
PetarP
Telerik team
answered on 08 Jun 2011, 02:41 PM
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.
Tags
Getting Started
Asked by
Mulham
Top achievements
Rank 2
Answers by
Mulham
Top achievements
Rank 2
PetarP
Telerik team
Share this question
or