1

SPA アプリケーションで Breeze.js をデータサービスとして使用していますが、ストアド プロシージャを使用して SQL データベース内のエンティティの一部を削除したいと考えています。

データベース内のストアド プロシージャをクライアントに呼び出させることができましたが、まだいくつかの問題があります。

Breeze コントローラでストアド プロシージャを呼び出すメソッドは次のようになります。

[HttpGet]
    [ActionName("deletecustomer")]
    public object DeleteCustomer([FromUri] string customerName)
    {
        string query = "sp_delete_customer @CustomerName";
        SqlParameter CustomerName = new SqlParameter("@CustomerName", customerName);
        var result = _dataContext.Context.Database.SqlQuery<Customer>(query, CustomerName);
        return result;
    }

私は風マネージャーからそれを呼び出しています:

 var deleteCustomer = function (customerName) {
        var query = EntityQuery.from('DeleteCustomer')
               .withParameters({ customerName: customerName });

        return manager.executeQuery(query)
            .then(querySucceeded)
            .fail(queryFailed);
}

問題は、私がまだ受け取っていることですInternal Server Error

{"$id":"1","$type":"System.Web.Http.HttpError,System.Web.Http",
"Message":"Anerrorhasoccurred.",
"ExceptionMessage":"The'ObjectContent`1'typefailedtoserializetheresponsebodyforcontenttype'application/json;charset=utf-8'.",
"ExceptionType":"System.InvalidOperationException","StackTrace":null,
"ExceptionMessage":"Thedatareaderisincompatiblewiththespecified'NotosDB.Data.Customer'.Amemberofthetype,'CustomerID',doesnothaveacorrespondingcolumninthedatareaderwiththesamename.","
....

編集: Code First 開発を使用しています。

JSONのシリアライゼーション/デシリアライゼーションに関係していることは理解しましたが、正確には何が問題なのですか?

4

1 に答える 1