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

[Solved] Q3 RIA DomainDataSource Issue

6 Answers 169 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris
Top achievements
Rank 1
Chris asked on 24 Nov 2010, 04:50 PM
Hi,

I have today upgraded from Q2 SP2 to Q3 of Telerik. The only issue I have discovered so far is with binding a DataPager/GridView to a DomainDataSource control. This was working perfectly fine prior to the upgrade, but now errors are returned for every property that is being bound to the grid (AutoGenerateColumns is set to false) stating "Property ... does not belong to type Entity". I know that Entity is the base type, but before the grid was able to correctly bind to the properties of the entity object by deriving the correct type from the server-side call:

XAML below:

<riaControls:DomainDataSource x:Name="fraudJobRulesDataSource" AutoLoad="True" QueryName="GetFraudJobRuleResultsQuery" PageSize="20" LoadedData="fraudJobRulesDataSource_LoadedData">
                                <riaControls:DomainDataSource.QueryParameters>
                                    <riaControls:Parameter ParameterName="fraudJobInstanceSUID" Value="{Binding SelectedInstance.InstanceItemSUID}" />
                                </riaControls:DomainDataSource.QueryParameters>
  
                                <riaControls:DomainDataSource.DomainContext>
                                    <Web2:FraudJobContext />
                                </riaControls:DomainDataSource.DomainContext>
                            </riaControls:DomainDataSource>
  
<Controls:RadDataPager x:Name="FraudJobRulesPagerData" Source="{Binding DataView, ElementName=fraudJobRulesDataSource}" Margin="3,0,0,0" PageSize="20" DisplayMode="All"  IsTotalItemCountFixed="True" BorderBrush="{StaticResource BorderBrush1}" BorderThickness="1" Background="{StaticResource BackgroundBrush5}"/>

Any ideas why this would now be an issue? Any ideas how I can correct this issue?

Regards,
Chris

6 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 25 Nov 2010, 12:01 PM
Hi Chris,

Could you please send us some more information. We have noticed that you have attached to the LoadedData event. What are you doing inside it.

Is it possible to send us the complete XAML and code-behind or even better -- a small dummy sample project, so we can recreate this on our end, reproduce it and see what is going on.

Any additional information you consider important would be welcome.

Thanks in advance.

Kind regards,
Ross
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Chris
Top achievements
Rank 1
answered on 25 Nov 2010, 01:27 PM
Thanx Ross,

Sample solution is not easily possible due to the complexity of the application, however further detail provided below:

User Control XAML:

<UserControl x:Class="InboxModule.Views.FraudJobViewer"
                           xmlns:grid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"    
                           xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
                           xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
                           xmlns:gridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
                           xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
                           xmlns:telerikChart="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting"
                           xmlns:telerikCharting="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
                           xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
                           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                           xmlns:Base="clr-namespace:Insurer.Analytics.Common.Base;assembly=Insurer.Analytics.Common" 
                           xmlns:CommonControls="clr-namespace:Insurer.Analytics.Common.CommonControls;assembly=Insurer.Analytics.Common"
                           xmlns:Commands="clr-namespace:Insurer.Analytics.SharedResources.Commands;assembly=Insurer.Analytics.SharedResources"                           
                           xmlns:telerikRibbonBar="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonBar"
                           xmlns:Converters="clr-namespace:Insurer.Analytics.Common.Converters;assembly=Insurer.Analytics.Common"
                           xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Data"
                           xmlns:telerikDocking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
                           xmlns:Controls1="clr-namespace:Insurer.Analytics.SharedResources.Controls;assembly=Insurer.Analytics.SharedResources" 
                           xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" 
                           xmlns:Web2="clr-namespace:Insurer.Analytics.Web;assembly=Insurer.Analytics.Common"
                           xmlns:telerikSchema="http://schemas.telerik.com/2008/xaml/presentation">
  
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Insurer.Analytics.SharedResources;component/ResourceDictionary.xaml" />
                <ResourceDictionary>
                    <Converters:StatusIconConverter x:Key="StatusIconConverter" />
                    <Converters:ReadUnreadImageConverter x:Key="ReadUnreadImageConverter" />
                    <Converters:IsLatestImageConverter x:Key="IsLatestImageConverter" />
                    <Converters:ArchivedItemImageConverter x:Key="ArchivedItemImageConverter" />
                    <Converters:FormatConverter x:Key="FormatConverter" />
                    <Converters:BoolToOpacityConverter x:Key="ArchivedImageOpacityConverter" TrueValue="0.4" FalseValue="1" />
                    <Converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"  TrueValue="Visible" FalseValue="Collapsed"/>
                    <Converters:BoolToVisibilityConverter x:Key="InverseVisiblityConverter" TrueValue="Collapsed" FalseValue="Visible" />
                    <Converters:WeakCommandBindingConverter x:Key="WeakCommandBindingConverter" />
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
  
    <Grid x:Name="LayoutRoot" Background="{StaticResource LayoutRootBackground}">
        <telerikDocking:RadDocking x:Name="DockFraudJob" Margin="0,51,0,0" Width="1220" MaxWidth="1220" Height="655" RootCompassStyle="{StaticResource RadCompass_HideOuter}" BorderThickness="0" Padding="0,0,0,10" HasDocumentHost="False" telerikDocking:RadDocking.SerializationTag="DockFraudJob">
            <telerikDocking:RadSplitContainer InitialPosition="DockedTop" telerikDocking:RadDocking.SerializationTag="Splitter">
                <telerikDocking:RadPaneGroup x:Name="GroupFraudJobs" telerikDocking:RadDocking.SerializationTag="GroupFraudJobs" MinHeight="50" MinWidth="50" telerikDocking:ProportionalStackPanel.RelativeSize="100,100">
                    <telerikDocking:RadPane x:Name="PaneGridJobs" telerikDocking:RadDocking.SerializationTag="PaneGridJobs" Title="Fraud Job" Header="Fraud Job" CanUserClose="False" CanUserPin="True" CanFloat="True" MinHeight="50" MinWidth="50" CanDockInDocumentHost="False">
                        <Grid Margin="3">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
  
                            <riaControls:DomainDataSource x:Name="fraudJobResultsDataSource" AutoLoad="True" LoadSize="20" QueryName="GetFraudJobResultsQuery" LoadedData="fraudJobResultsDataSource_LoadedData">
                                <riaControls:DomainDataSource.QueryParameters>
                                    <riaControls:Parameter ParameterName="fraudJobInstanceSUID" Value="{Binding SelectedInstance.InstanceItemSUID}" />
                                </riaControls:DomainDataSource.QueryParameters>
  
                                <riaControls:DomainDataSource.DomainContext>
                                    <Web2:FraudJobContext />
                                </riaControls:DomainDataSource.DomainContext>
                            </riaControls:DomainDataSource>
  
                            <Controls1:GridViewToolbar x:Name="ToolbarJobs" Grid.Row="0" Margin="0,0,0,3" />
  
                            <grid:RadGridView  x:Name="FraudJobResultsGrid" VerticalAlignment="Top" 
                                               Grid.Row="1"
                                               AutoGenerateColumns="False" RowIndicatorVisibility="Collapsed"
                                               ColumnWidth="*" IsReadOnly="True"
                                               MaxHeight="610" Background="White"
                                               SelectedItem="{Binding FraudJobResult, Mode=TwoWay}"
                                               ItemsSource="{Binding DataView, ElementName=fraudJobResultsDataSource}"
                                               ElementExporting="GridView_ElementExporting"
                                               EnableColumnVirtualization="True" EnableRowVirtualization="True" DataLoadMode="Asynchronous"
                                               ClipboardCopyMode="Header,Default" ClipboardPasteMode="None" SelectionMode="Extended" SelectionUnit="Cell">
                                <grid:RadGridView.Columns>
                                    <grid:GridViewToggleRowDetailsColumn />
                                    <grid:GridViewDataColumn Header="Key Value" DataMemberBinding="{Binding PKColumnValue}"  ShowDistinctFilters="True" />
                                    <grid:GridViewDataColumn Header="Sum Score" DataMemberBinding="{Binding SumScore}" ShowDistinctFilters="True" />
                                    <grid:GridViewDataColumn Header="Avg Score" DataMemberBinding="{Binding AverageScore}"  ShowDistinctFilters="True" />
                                    <grid:GridViewDataColumn Header="Count Matches" DataMemberBinding="{Binding CountOfMatches}"  ShowDistinctFilters="True" />
                                </grid:RadGridView.Columns>
  
                                <grid:RadGridView.RowDetailsTemplate>
                                    <DataTemplate>
                                        <grid:RadGridView x:Name="FraudJobResultRuleResultsGrid" RowIndicatorVisibility="Collapsed"
                                                            AutoGenerateColumns="False" IsReadOnly="True"
                                                            ShowGroupPanel="False" Background="White" Margin="30,0,0,0"
                                                            ItemsSource="{Binding FraudJobRuleResults}" GridLinesVisibility="{Binding Path=GridLinesVisibility, ElementName=FraudJobResultsGrid}"
                                                            ElementExporting="GridView_ElementExporting" 
                                                            ClipboardCopyMode="Header,Default" ClipboardPasteMode="None" SelectionMode="Extended" SelectionUnit="Cell">
                                            <grid:RadGridView.Columns>
                                                <grid:GridViewDataColumn Header="Rule Name" DataMemberBinding="{Binding FraudRuleName}" ShowDistinctFilters="False"  />
                                                <grid:GridViewDataColumn Header="Score" DataMemberBinding="{Binding Score}" ShowDistinctFilters="False" />
                                                <grid:GridViewDataColumn Header="Weighting" DataMemberBinding="{Binding Weighting}" ShowDistinctFilters="False" />
                                                <grid:GridViewDataColumn Header="Weighted Score" DataMemberBinding="{Binding WeightedScore}" ShowDistinctFilters="False" />
                                            </grid:RadGridView.Columns>
                                        </grid:RadGridView>
                                    </DataTemplate>
                                </grid:RadGridView.RowDetailsTemplate>
                            </grid:RadGridView>
                        </Grid>
                    </telerikDocking:RadPane>
                </telerikDocking:RadPaneGroup>
  
                <telerikDocking:RadPaneGroup x:Name="GroupFraudRules" telerikDocking:RadDocking.SerializationTag="GroupFraudRules" MinHeight="50" MinWidth="50" telerikDocking:ProportionalStackPanel.RelativeSize="100,100">
                    <telerikDocking:RadPane x:Name="PaneGridRules" telerikDocking:RadDocking.SerializationTag="PaneGridRules" Title="Fraud Rules" Header="Fraud Rules" CanUserClose="False" CanUserPin="True" CanFloat="True" MinHeight="50" MinWidth="50" CanDockInDocumentHost="False">
                        <Grid Margin="3">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
  
                            <riaControls:DomainDataSource x:Name="fraudJobRulesDataSource" AutoLoad="True" LoadSize="20" QueryName="GetFraudJobRuleResultsQuery" LoadedData="fraudJobRulesDataSource_LoadedData">
                                <riaControls:DomainDataSource.QueryParameters>
                                    <riaControls:Parameter ParameterName="fraudJobInstanceSUID" Value="{Binding SelectedInstance.InstanceItemSUID}" />
                                </riaControls:DomainDataSource.QueryParameters>
  
                                <riaControls:DomainDataSource.DomainContext>
                                    <Web2:FraudJobContext />
                                </riaControls:DomainDataSource.DomainContext>
                            </riaControls:DomainDataSource>
  
                            <Controls1:GridViewToolbar x:Name="ToolbarRules" Grid.Row="0" Margin="0,0,0,3" />
  
                            <grid:RadGridView x:Name="FraudJobRulesGrid" VerticalAlignment="Top"
                                              AutoGenerateColumns="False"
                                              Grid.Row="1"
                                              MaxHeight="610" IsReadOnly="True"
                                              ColumnWidth="*" Background="White"
                                              ShowGroupPanel="True" RowIndicatorVisibility="Collapsed"
                                              ItemsSource="{Binding Data, ElementName=fraudJobRulesDataSource}"
                                              ElementExporting="GridView_ElementExporting"
                                              EnableColumnVirtualization="True" EnableRowVirtualization="True" DataLoadMode="Asynchronous"
                                              ClipboardCopyMode="Header,Default" ClipboardPasteMode="None" SelectionMode="Extended" SelectionUnit="Cell">
                                <grid:RadGridView.Columns>
                                    <grid:GridViewDataColumn Header="Key Value"  DataMemberBinding="{Binding PKColumnValue}"  ShowDistinctFilters="True"  />
                                    <grid:GridViewDataColumn Header="Rule Name"  DataMemberBinding="{Binding FraudRuleName}"  ShowDistinctFilters="True"  />
                                    <grid:GridViewDataColumn Header="Score"  DataMemberBinding="{Binding Score}" ShowDistinctFilters="True" />
                                    <grid:GridViewDataColumn Header="Weighting"  DataMemberBinding="{Binding Weighting}" ShowDistinctFilters="True" />
                                    <grid:GridViewDataColumn Header="Weighted Score"  DataMemberBinding="{Binding WeightedScore}" ShowDistinctFilters="True" />
                                </grid:RadGridView.Columns>
                            </grid:RadGridView>
                        </Grid>
                    </telerikDocking:RadPane>
                </telerikDocking:RadPaneGroup>
            </telerikDocking:RadSplitContainer>
        </telerikDocking:RadDocking>
    </Grid>
<UserControl>

I am not performing any processing in the LoadedData event handlers, this was simpy for debugging pruposes to see what was coming back from the RIA service call. All entity data appears to be correct and the underlying entity objects are showing as the correct type:

Code-behind:

private void fraudJobResultsDataSource_LoadedData(object sender, LoadedDataEventArgs e)
        {
        }
  
        private void fraudJobRulesDataSource_LoadedData(object sender, LoadedDataEventArgs e)
        {
        }

Service Method:

public IQueryable<FraudJobRuleResult> GetFraudJobRuleResults(string fraudJobInstanceSUID, out int resultsCount)
        {
            ConnectionStringHelper.Initialise(ConfigSupport.ConnectionString, ConfigSupport.DatabaseType, CurrentUser.SUID, ConfigSupport.EnvironmentString, ConfigSupport.DefaultCulture);
  
            List<FraudJobRuleResult> results = new List<FraudJobRuleResult>();
            try
            {
                var fraudJobInstance = GetFraudJobInstance(fraudJobInstanceSUID);
                foreach (DataRow drRule in fraudJobInstance.FraudJobRuleResults.Data.Rows)
                {
                    var fjrr = new FraudJobRuleResult
                    {
                        Key = Guid.NewGuid(),
                        FraudJobSUID = (string)drRule["FraudJobSUID"],
                        FraudRuleName = (string)drRule["FraudRuleName"],
                        FraudRuleSUID = (string)drRule["FraudRuleSUID"],
                        PKColumnValue = (string)drRule["PKColumnValue"],
                        Score = (int)drRule["Score"],
                        WeightedScore = (double)drRule["WeightedScore"],
                        Weighting = (double)drRule["Weighting"]
                    };
  
                    results.Add(fjrr);
  
                }
            }
            catch (Exception)
            {
                resultsCount = 0;
                return results.AsQueryable();
            }
  
            resultsCount = results.Count;
            var queryableResults = results.AsQueryable();
            return queryableResults;
        }

Metadata:

public class FraudJobRuleResult
    {
        [Key]
        public Guid Key { get; set; }
  
        [DataMember]
        public string FraudJobSUID { get;set; }
  
        [DataMember]
        public string FraudRuleName { get; set; }
  
        [DataMember]
        public string FraudRuleSUID { get; set; }
  
        [DataMember]
        public string PKColumnValue { get; set; }
  
        [DataMember]
        public int Score { get; set; }
  
        [DataMember]
        public double WeightedScore { get; set; }
  
        [DataMember]
        public double Weighting { get; set; }
    }

Since posting I have noticed some very strange behaviour with this implementation. I debugged the service call within the LoadedData event handler and was inspecting the returned object entites for around 1-2 minutes before running the system through The grids were then fully populated with data?

I have attached 2 images, one showing the error recieved, which is displayed for each bound column, and the second is the resulting grid contianing no data.

Any help you could provide on this would be much appreciated.

Kind Regards,
Chris
0
Rossen Hristov
Telerik team
answered on 25 Nov 2010, 02:01 PM
Hello Chris,

We are currently trying to reproduce this issue with our own sample app. Unfortunately, up until now we can't manage to reproduce it. While we are trying this on our end, can you try some things on your end:

1. Try turning off the Asynchronous mode of the grid.
2. Try replacing the grid with a plain old ItemControl or the MS DataGrid.

We are looking forward to hearing from you. We will contact you if we manage to reproduce this behavior.

Best wishes,
Ross
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Chris
Top achievements
Rank 1
answered on 25 Nov 2010, 04:24 PM
Hi Ross,

Turning off asynchronous DataLoadMode has fixed the problem. Is this a known issue and something that could be fixed in a future release? It is a really nice feature to have and provides a much better user experience.

Thanx,
Chris
0
Rossen Hristov
Telerik team
answered on 25 Nov 2010, 04:31 PM
Hello Chris,

While we will definitely investigate this issue, let me explain something else.

In fact, this feature was designed for use when you have huge amounts of in-memory data. It has no meaning when your grid is bound to something which is asynchronous in the first place, which is your case.

You have a PageSize of 20 which means that at every given time RadGridView will be bound to at most 20 items which are on the client. All of the other items are on the server and are not part of RadGridView.ItemsSource. You absolutely don't need to make your grid Asynchronous. It will not speed up anything for you -- its WCF RIA that does this job for you.

I hope this makes sense.

Greetings,
Ross
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Chris
Top achievements
Rank 1
answered on 25 Nov 2010, 04:40 PM
Understood Ross, thanx for the clarification.
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Chris
Top achievements
Rank 1
Share this question
or