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

OpenAccessDataSource with asp.net RadComboBox

2 Answers 49 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Elvis
Top achievements
Rank 2
Elvis asked on 17 Jun 2011, 09:13 PM
I created the following classes through the domain model:

Customer
-CustomerId int
-Description: string
-Orders: IList <Order>

Order
OrderId-int
-OrderDate: DateTime
-Customer: Customer

I have a RadGrid that is connected to a OpenAccessDataSource to data search of the Order class, and created a template for edit/insert of this data grid. The question is how to configure a RadCombobox in this template to edit the column Customer. I set the DataSourceID property to another OpenAccessDataSource seeking Customer data, DataTextField to Description and DataValueField for CustomerId. The doubt is how to turn the property Order->Customer to the ComboBox, because it is an object and do not have the integer foreign key in the Order class CustomerId.
I believe it is a basic question, but researched a lot and could not understand.

grateful for the attention
Elvis

2 Answers, 1 is accepted

Sort by
0
Elvis
Top achievements
Rank 1
answered on 20 Jun 2011, 01:07 PM
I got around the problem by assigning the value via code, saving time, but did not like the solution.
I did a test with the old version (forward / reverse mapping) and found that I can add the foreign key in the Order class CustomerId, and solved the problem perfectly.
Does this not possible with the new version (domain model)?
I am still in the evaluation phase of Open Access before purchasing it and adopts it in development. I would be very grateful if someone can help.
0
Damyan Bogoev
Telerik team
answered on 20 Jun 2011, 03:05 PM
Hi Elvis,

I am afraid that you should add a CustomeId property within the Order class in order to achieve that goal. Otherwise the OpenAccessDataSource will be not able to retrieve the correct Customer instance per given Order instance, it will not prepare correct queries for the delete, insert and update operations neither.
You could add a new property to an existing persistent capable class by doing the following steps:
1.    Select the class from the visual designer;
2.    Right-click on the class and select the Add | Property option;
Now you should edit the association between the Customer and Order classes:
1.    Select the association;
2.    Open the Association editor and configure the association using the Customer.CustomerId and Order.CustomerId properties;
3.    Save the diagram;
You could find a sample application attached that uses the modified domain model.
Hope that helps. If any other questions arise, do not hesitate to contact us back.

Regards,
Damyan Bogoev
the Telerik team
Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
Tags
Design Time (Visual Designer & Tools)
Asked by
Elvis
Top achievements
Rank 2
Answers by
Elvis
Top achievements
Rank 1
Damyan Bogoev
Telerik team
Share this question
or