This question is locked. New answers and comments are not allowed.
Attached is a cropped version of my Entity Data Model. You'll see that the main table (for this particular case) is the "Check". I have two "foreign" tables, "Consumer" and "VeterinaryClinic". Each of those two tables both reference the "Contact" table. My objective is to have a GridView show certain linked columns from all four tables for each "Check" record on one row (no gridview hierarchies). AND, I don't want to perform a database call on each row bound event.
I assumed I could use the LINQ ".Include" statements to load information from the two foreign tables. But, if you look at my XAML below, the GridViewDataColumn property DataMemberBinding
I guess I could always create a custom function in the Domain Service that returns an object that only performs the joins once on server-side and then returns that full list. However, I would think there's a more efficient way?
My DomainService call:
My Xaml:
Thanks,
Joshua
I assumed I could use the LINQ ".Include" statements to load information from the two foreign tables. But, if you look at my XAML below, the GridViewDataColumn property DataMemberBinding
="{Binding Consumer.ContactId}" doesn't return anything. How do I accomplish this? Does lazy loading affect this (btw, I've tried it with lazy loading enabled and disabled to no avail)? Also, how do I accomplish the addition of the referenced "Contact" for each row?I guess I could always create a custom function in the Domain Service that returns an object that only performs the joins once on server-side and then returns that full list. However, I would think there's a more efficient way?
My DomainService call:
public IQueryable<Check> GetChecks() { return this.ObjectContext.Checks .Include("Consumer") .Include("VeterinaryClinic"); } My Xaml:
<riaControls:DomainDataSource AutoLoad="True" Height="0" Width="0" Name="checksDataSource" QueryName="GetChecks"> <riaControls:DomainDataSource.DomainContext> <bbmbiz:BBMBizDomainContext /> </riaControls:DomainDataSource.DomainContext> </riaControls:DomainDataSource> <telerik:RadGridView Name="rgvChecks" HorizontalAlignment="Left" VerticalAlignment="Top" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed" CanUserDeleteRows="False" ShowInsertRow="False" CanUserReorderColumns="False" CanUserResizeColumns="True" AutoGenerateColumns="False" CanUserFreezeColumns="True" ItemsSource="{Binding ElementName=checksDataSource, Path=Data}" IsBusy="{Binding IsBusy, ElementName=checksDataSource}" Width="800" RowEditEnded="rgvChecks_RowEditEnded"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding ConsumerId}" Header="Consumer ID" UniqueName="ConsumerID" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Consumer.ContactId}" Header="Contact ID" UniqueName="ContactID" /> </telerik:RadGridView.Columns> </telerik:RadGridView> Thanks,
Joshua