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

[Solved] Using Generic Collections

1 Answer 135 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.
Brandon
Top achievements
Rank 1
Brandon asked on 16 Feb 2009, 06:45 PM
I have Customer and and Order tables in my database.  The Order table points back to the Customer table via a field called CustomerId.  Wanting the ability to access Order objects through the Customer object, I added a collection to the Customer object:

partial public class Customer 
    private IList<Order> orders; 
    public IList<Order> Orders 
    { 
        get 
        { 
            if (orders == null
                orders = new List<Order>(); 
            return orders;  
        } 
    } 

Now, OpenAccess keeps adding a new switchboard table to my database, 'Customer_Orders' to tie Customer and Order together.  This is not what I want, however.  My Order table already has a CustomerId field.  I want OpenAccess to use the existing CustomerId field to find the Order objects belonging to a specific Customer.  Is this possible?

1 Answer, 1 is accepted

Sort by
0
Brandon
Top achievements
Rank 1
answered on 16 Feb 2009, 07:09 PM
I found the solution.  In the Reverse Mapping wizard, under the Advanced view, I selected Order.  The order contained a reference called Customer.  I clicked on it and selected "Create one-to-many list."
Tags
General Discussions
Asked by
Brandon
Top achievements
Rank 1
Answers by
Brandon
Top achievements
Rank 1
Share this question
or