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

One to Many Relation

3 Answers 115 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bernard
Top achievements
Rank 2
Bernard asked on 11 Mar 2009, 01:46 PM
Hi,

I'm starting with Open Access ORM and i'm making some experiment to try to understand how to work efficiently with it.  But it's not clear at all.

Let say i have a class Customer and a class CustomerContact.  There can be many CustomerContact for a customer.  So in the reverse engeneer wizard i selected both class and went to the client reference into CustomerContact class to check the one to many relation.

When i add Customer it work fine.  If i add a CustomerContact to the CustomerContact collection from Customer it does not work.  I have to reference and existing Customer before adding it to the collection??? 


Honestly, the fact of adding the CustomerContact to this collection should be enough to associte them.  Am i missing something?

Another Question is What is the best way to create those relation?  In visual studio ado net we have a nested relation that work fine?  There is nothing like this in ORM?  When i try to add Customer as datasource, i see contact but like a field, not like a nested table

 

3 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 11 Mar 2009, 02:33 PM
Are you commiting the transaction?
0
Bernard
Top achievements
Rank 2
answered on 11 Mar 2009, 03:17 PM
Yes i do commit the transaction.
If i add only a customer it's fine.
if i try to add a customercontact to the contact list of the new customer it hang on the commit
saying the the idclient of the customercontact need to be set.
so to solve it i need to refer the customer object to which i add the contact before adding it to the list
then the commit work fine.

Why do i have to do this?  Juste add the contact to the customer should work no?
I Have checked the CRUD example with Telerik OpenAccess ORM and i see that it work like i want, why my reverse engeneering does not work....   If there was clear documentation it would help a lot.    I spend more time searching for answer thant producing anything.

0
Accepted
Alexander
Telerik team
answered on 12 Mar 2009, 04:35 PM
Hi Bernard,

Although you have reverse mapped your classes you can still use some of the Forward mapping wizard options. Open the wizard and select the CustomerContact collection from the treeview on the left. Enable the "Manage collection" checkbox and you will have this reference automatically set in the CustomerContact object.

Regards,
Alexander
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Getting Started
Asked by
Bernard
Top achievements
Rank 2
Answers by
Chris
Top achievements
Rank 1
Bernard
Top achievements
Rank 2
Alexander
Telerik team
Share this question
or