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

Retrieving Related (Read-Only) Data using OpenAccessLinqDataSource

2 Answers 28 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.
Tayonee
Top achievements
Rank 1
Tayonee asked on 21 Apr 2015, 11:54 PM

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 Answers, 1 is accepted

Sort by
0
Tayonee
Top achievements
Rank 1
answered on 22 Apr 2015, 09:40 PM

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?

0
Doroteya
Telerik team
answered on 24 Apr 2015, 11:03 AM
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.
 
Tags
General Discussions
Asked by
Tayonee
Top achievements
Rank 1
Answers by
Tayonee
Top achievements
Rank 1
Doroteya
Telerik team
Share this question
or