Retrieving Related (Read-Only) Data using OpenAccessLinqDataSource

3 posts, 0 answers
  1. Tayonee
    Tayonee avatar
    52 posts
    Member since:
    Nov 2006

    Posted 21 Apr 2015 Link to this post

    I am using a OpenAccessLinqDataSource control, and have created a RadGrid used to edit it's contents. That table/element has several Foreign Keys in it, and I would like to retrieve select data from the related tables for Read-Only display in the grid. Is there any way to do this?

     I can't seem to find any relevant discussions or documentation on this but I could have sworn I did it using some sort of custom LINQ query in the Data Source configuration wizard a while back.

    What am I missing here?

  2. Tayonee
    Tayonee avatar
    52 posts
    Member since:
    Nov 2006

    Posted 22 Apr 2015 Link to this post

    I have found an answer to this original question in this Help article: http://docs.telerik.com/data-access/developers-guide/asp.net-development/working-with-openaccesslinqdatasource/developer-guide-oalinqdatasource-working-related-data. However, once I convert my datasource GroupBy statement as described therein, I now find that UPDATE statements no longer work. 

    I tested the updates on the converted query BEFORE I added any related columns to it, just so I could incrementally test the proposed solution. 

    Is there any way to still do UPDATES within my grid with this custom GroupBy statement?

  3. DevCraft banner
  4. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 24 Apr 2015 Link to this post

    Hello Mike,

    The article you found contains the two possible options for implementing the display of related entities. The usage of grouping is the first one of them. The second one, here, is the one that I recommend you and it involves the usage of two datasources. The workflow is described in details in the article, so to this message I am attaching a sample that shows the implementation and the outcome. It is configured to allow automatic updates through the datasource consumed by the grid, and utilizes the Northwind database (you need to make it available on your side).

    On the side, the reason why the automatic updates are disabled when you use grouping through the datasource is that the result is actually a projection and does not consume the real persistent type. In such cases Data Access does not support change tracking.

    I hope this helps. Let us know how the things on your side are.

    Regards,
    Doroteya
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
Back to Top