0

Silverlight 4 Ria プロジェクトのサーバー側に、期間 (月) に基づいて多数の異なるアイテムを返す Linq クエリがあります。

私が得ている問題は、クライアントのコールバックが発生してデータが破損し、サーバーから返されたすべてのアイテムがコレクション内の最後のアイテムの複製である場合です。

サーバーコール

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

サーバーとLinqPadでLinqクエリが正しいことを確認しました。

何か案は??

編集: Fiddler RAW 応答

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��@����

フィル

4

2 に答える 2

0

まず、Fiddler を使用して生のサーバー応答が正しいかどうかを確認します。

于 2011-06-30T10:50:34.850 に答える
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
于 2011-06-30T14:53:46.997 に答える