Reverse mapping issue/question child and parent tables swapped around

Thread is closed for posting
2 posts, 0 answers
  1. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 14 Apr 2010 Link to this post

    My mistake, I had forgotten to tick the one to many box

    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

  2. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    Posted 15 Apr 2010 Link to this post

    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.

    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.
Back to Top