OpenAccessDataSource with RadComboBox

Thread is closed for posting
3 posts, 0 answers
  1. Elvis
    Elvis avatar
    2 posts
    Member since:
    Jun 2011

    Posted 17 Jun 2011 Link to this post

    I created the following classes through the domain model:

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

    -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
  2. Elvis
    Elvis avatar
    1 posts
    Member since:
    Mar 2011

    Posted 20 Jun 2011 Link to this post

    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.
  3. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    Posted 20 Jun 2011 Link to this post

    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.

    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.
Back to Top