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

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

1 Answer 47 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Simon
Top achievements
Rank 1
Simon asked on 15 Jul 2010, 10:04 AM
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:
[Telerik.OpenAccess.Persistent()]
public class Country
{
    public IList<AdminDistrict> AdminDistricts { get; set; }
    // other properties etc. commented out
}
[Telerik.OpenAccess.Persistent()]
public class AdminDistrict
{
    public Country Country { get; set; }
    // other properties etc. commented out
}

The tabes I get are:

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



1 Answer, 1 is accepted

Sort by
0
IT-Als
Top achievements
Rank 1
answered on 15 Jul 2010, 01:09 PM
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.

Regards

Henrik
Tags
Databases and Data Types
Asked by
Simon
Top achievements
Rank 1
Answers by
IT-Als
Top achievements
Rank 1
Share this question
or