Can't generating a 1-many relationship with forward mapping

2 posts, 0 answers
  1. Simon
    Simon avatar
    5 posts
    Member since:
    Jul 2010

    Posted 15 Jul 2010 Link to this post

    I'm trying to do forward mapping with a 1-many relationship (the classic primary key-foreign key scenario).  However, when I try it, I find that Open Access gives me the two entity tables in the database, plus an intermediate linking table - what I'd expect if I was modelling a many-many relationship but not a 1-many relationship.   How do I get forward mapping to give me the correct table structure in this situation?

    In more detail, if it's needed:

    My classes look like this:
    public class Country
        public IList<AdminDistrict> AdminDistricts { get; set; }
        // other properties etc. commented out
    public class AdminDistrict
        public Country Country { get; set; }
        // other properties etc. commented out

    The tabes I get are:

    dbo.country_admin_district  <-- relationships go through here. But I shouldn't need this for a 1-many relationship

  2. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 15 Jul 2010 Link to this post

    Hi Simon,

    I don't know if you use the Visual Desginer for doing you forward mapping or the "old" wizards.

    Either case the should be an option in the mapping details for the owner of the collection (for example the Order class in the classic Order->OrderLine) where you can turn off join-table generation and use inverse fields instead. I think OA uses a join table by default.

    In the "old" forward mapping wizard it is represented visually by a checkbox that indicates whether to use a join table or not.


  3. DevCraft banner
Back to Top