1

Windowsphone アプリケーション用に記述されたデータ サービスがあり、このデータ サービスに変更を保存しようとしています。これを行うには、次のように呼び出しますBeginSaveChanges

    Context.AddToMeasurements(temp);
    Context.BeginSaveChanges(SaveChangesOptions.Batch, SaveChangesComplete, Context);

この関数のコールバックは、EndSaveChanges呼び出されるとエラーを返します。

private void SaveChangesComplete(IAsyncResult result)
{
    // use a dispatcher to make sure the async void 
    // returns on the right tread.
    Deployment.Current.Dispatcher.BeginInvoke(() =>
    {

        DataServiceResponse WriteOperationResponse = null;

        Context = result.AsyncState as MeasurementEntities;

        try
        {
             WriteOperationResponse = Context.EndSaveChanges(result);
             Debug.WriteLine("Batch State:");
             Debug.WriteLine(WriteOperationResponse.BatchStatusCode);
        }
        catch (DataServiceRequestException ex)
        {

            Debug.WriteLine(ex.Message);
        }
        catch (InvalidOperationException ex)
        {
            Debug.WriteLine(ex.Message);
        }

    });        
}

endsavechanges が返すエラー:

An exception of type 'System.Data.Services.Client.DataServiceClientException' occurred in Microsoft.Data.Services.Client.WP80.DLL and wasn't handled before a managed/native boundary
An exception of type 'System.Data.Services.Client.DataServiceRequestException' occurred in Microsoft.Data.Services.Client.WP80.DLL and wasn't handled before a managed/native boundary
A first chance exception of type 'System.Data.Services.Client.DataServiceRequestException' occurred in Microsoft.Data.Services.Client.WP80.DLL
An exception of type 'System.Data.Services.Client.DataServiceRequestException' occurred in Microsoft.Data.Services.Client.WP80.DLL and wasn't handled before a managed/native boundary
An error occurred while processing this request.

これらのエラーに関するより詳細な情報を確認したいのですが、それが何を意味するのかを誰かが知っている場合は、それも評価されますが、ビジュアル スタジオ内で (データ サービスの詳細) を達成するにはどうすればよいですか?

ps、私はすでに追加しました:

config.UseVerboseErrors = true;

[ServiceBehavior(IncludeExceptionDetailInFaults = true)]

私のデータサービスに。

助けてください :)

編集:


Try コンストラクションを削除して、EndSaveChanges メソッドを実行するだけです。次のような innerExeptions を読み取ることができます。

IDENTITY_INSERT が OFF に設定されている場合、テーブル 'Measurement' の ID 列に明示的な値を挿入できません。

これはどういう意味ですか?

4

1 に答える 1