Open timmyse2 opened 3 months ago
Add col timestamp or rowVersion or LastUpdateDateimte for 並行處理-異動衝突 (p359 <EF實務精要>)
樂觀鎖定 p148
DB使用rowversion, model加入ETimestamp屬性 (時間戳記)
public byte[] ETimestamp {get; set;}
在更新操作中,檢查 RowVersion 欄位以確保沒有其他交易在此期間修改過記錄。如果檢查失敗, 則拋出並發異常,讓使用者知道有其他人修改了這條記錄。