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

Reverse mapping issue/question child and parent tables swapped around

1 Answer 43 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alex
Top achievements
Rank 1
Alex asked on 14 Apr 2010, 05:22 AM
*resolved*
My mistake, I had forgotten to tick the one to many box
*resolved*



Hi (sorry if this is in the wrong forum thread),

I'm just starting and I'm experimenting with SQL and open access and I *think* that the default reverse mapping is doing my parent/child tables incorrectly (or perhaps I'm wrong)?


What I've done is the following:
I've made a table called CashSale(parent table) and CashSale_Item(child table)
CashSale has a primary key "receipt"
CashSale_Item has two primary keys "receipt" + "line", I've set this CashSale_Item's "receipt" as a foreign key to the primary key CashSale "receipt"

Q1: Have I set this up correctly? (I think I have? but I'm a newbie so...)


Ok now I reverse map tables with Open Access (just the default settings)
And it auto generates CashSale as a child of CashSale_Item (i.e. I can CashSale_Item.CashSale, instead of the opposite)
Q2: How can I make it reverse map the other way around? What have I done wrong?



(I've just been following the Reverse Mapping (database -> objects) from the open access made easy pdf)
Open Access v 2010.1.310.2





-I am aware that I can just change the generated classes and remove get/set cashsale from Cashsale_item, and add get/set cashsale_items to cashsale buttttt if it is auto generating it that way then I'm not to sure if I've set up my PK-FK's correctly

1 Answer, 1 is accepted

Sort by
0
Damyan Bogoev
Telerik team
answered on 15 Apr 2010, 12:15 PM
Hello Alexander Sun,

 1. Yes, you set up the database correctly.

2. The classes are generated correctly. The CashSale field generated within the CashSale_Item class is a reference to the parent class from. You could see the generated IList of CashSale_Item in the parent class. This is the right way for creating a one-to-many mapping.

I recommend you reading the following help article “One-to-many Mapping” for a reference.

Hope that helps.

Regards,
Damyan Bogoev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Alex
Top achievements
Rank 1
Answers by
Damyan Bogoev
Telerik team
Share this question
or