var paymentAttempt = _auctionContext.PaymentAttempts.Where(o => o.Id == paymentAttemptId).SingleOrDefault();
if (paymentAttempt != null)
{
paymentAttempt.PaymentAttemptStatusId = (int)PaymentAttemptStatus.Defunct;
paymentAttempt.PaymentAttemptStatus = _auctionContext.PaymentAttemptStatuses.Where(pas => pas.Id == paymentAttempt.PaymentAttemptStatusId).First();
var relevantWinningBidsTotalPrices = _auctionContext.GetWinningBidsTotalPricesForPaymentAttempt(paymentAttemptId).ToArray();
foreach (var winningBid in relevantWinningBidsTotalPrices)
{
winningBid.Locked = false;
_auctionContext.UpdateObject(winningBid);
}
_auctionContext.SaveChanges();
}
を更新していないが期待しかしpaymentAttempt
でないようwinningBid
が更新されると呼ばれます。どうしてこれなの?それは本当にイライラしています。どちらもエラーはありません。私は、EFがオブジェクトなどを追跡していないなどの問題があった場合にエラーが発生すると予想しますが、そのようなエラーは発生していません。エンティティフレームワークのSaveChanges()</p> <pre><code>_auctionContext.SaveChanges(); </code></pre><p>後のデータベースに上記のコードで
使用すると、あなたを取得するためにアタッチ変更されたエンティティをコンテキストに保存します。文脈は、あなたが何を話しているのか分かりませんでした。 – Tabish