0

我在Silverlight 4 Ria项目的服务器端有一个Linq查询,该项目根据时间段(月)返回许多不同的项目。从服务器到客户端的Ria数据损坏

我得到的问题是当客户端回调触发数据已损坏,从服务器返回的所有项目都是集合中最后一项的副本。

服务器调用

Public Function GetBusinessHeadCountHistory(ByVal businessUnit As String) As IEnumerable(Of EngineeringHeadCountBusinessHistory) 
     Return From t In ObjectContext.tblTimes 
        Join h In ObjectContext.tblEngineeringDashboard_CADMachinesCounts On t.ID Equals h.TimeID 
        Join b In ObjectContext.tblEngineeringDashboard_Business On h.BusinessID Equals b.ID 
          Where b.BusinessUnit = businessUnit 
          Order By t.Period 
          Select New EngineeringHeadCountBusinessHistory With {.Month = t.Period, .BusinessUnit = b.BusinessUnit, .HeadCount = h.Count} 
End Function 

客户端回调

Public Property EngineeringBusinessHistoryCount As ReadOnlyObservableCollection(Of EngineeringHeadCountBusinessHistory) 
    Get 
     Return _engineeringBusinessHistoryCount 
    End Get 
    Set(ByVal value As ReadOnlyObservableCollection(Of EngineeringHeadCountBusinessHistory)) 
     _engineeringBusinessHistoryCount = value 
     IsBusinessCountBusy = False 
     RaisePropertyChanged("ChildReportTitle") 
     RaisePropertyChanged("EngineeringBusinessHistoryCount") 
    End Set 
End Property 

我已经证实,LINQ查询是从服务器和LinqPad正确的。

任何想法??

编辑:提琴手RAW repsonse

HTTP/1.1 200 OK 
Cache-Control: no-cache 
Pragma: no-cache 
Content-Length: 1738 
Content-Type: application/msbin1 
Expires: -1 
Server: Microsoft-IIS/6.0 
MicrosoftOfficeWebServer: 5.0_Pub 
X-Powered-By: ASP.NET 
X-AspNet-Version: 4.0.30319 
Date: Thu, 30 Jun 2011 11:08:47 GMT 

@#GetBusinessHeadCountHistoryResponsehttp://tempuri.org/@!GetBusinessHeadCountHistoryResult aDomainServices i)http://www.w3.org/2001/XMLSchema-instance^ 
TotalCount�^ 
RootResults b<http://schemas.datacontract.org/2004/07/EngineeringDashboard_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�_Month����~�X�_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�_Month��@���p�_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�_Month��@DE��_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�_Month���hE��_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�_Month���w`ض�_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�_Month��@E�4��_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�_Month����{���_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount� _Month���x�#��_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount� _Month��@F��_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount� _Month�����/�_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�"_Month���y�nG�_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�"_Month�����_�_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�"_Month�����]w�_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�$_Month���z���_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�$_Month��� 
����_#EngineeringHeadCountBusinessHistory_BusinessUnit� 
skid-steer_ HeadCount�$_Month��@���� 

菲尔

回答

0

问题在于POCO类Key注释位于非唯一字段。我已将其更改为独特的Month属性,现在按预期工作。

奇怪的错误,但...

Imports System.ComponentModel.DataAnnotations 
Imports System.Runtime.Serialization 

Public Class EngineeringHeadBUHistory 

    '<Key()> 
    '<DataMember()> _ 
    'Property BusinessUnit As String 
    <Key()> 
    <DataMember()> 
    Property Month As Date 
    <DataMember()> _ 
    Property HeadCount As Integer 

End Class 
0

首先,使用Fiddler请检查是否原始服务器的响应是正确的OT没有。

+0

貌似有来自提琴手一些差异 –

相关问题