Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I solved this issue by changing the update approach by following the answer in <a href="https://stackoverflow.com/questions/11189688/linq-to-sql-updating-without-refresh-when-updatecheck-never?lq=1">LINQ to SQL: Updating without Refresh when “UpdateCheck = Never”</a></p> <p>UpdateCheck is set as Never for the Duration column</p> <pre><code> public void UpdateAccount() { //Used value from previous select DateTime previousDateTime = new DateTime(2012, 6, 26, 11, 14, 15, 327); int prevDuration = 0; RepositoryLayer.Account accEntity = new RepositoryLayer.Account(); accEntity.AccountNumber = 1; //Primary Key accEntity.ModifiedTime = previousDateTime; //Concurrency column //accEntity.Duration = prevDuration; accountRepository.UpdateChangesByAttach(accEntity); //Values to be modified after Attach accEntity.AccountType = "WIN-WIN"; accEntity.ModifiedTime = DateTime.Now; try { accountRepository.SubmitChanges(); } catch(System.Data.Linq.ChangeConflictException e) { throw new Exception(e.Message); } } public virtual void UpdateChangesByAttach(T entity) { if (Context.GetTable&lt;T&gt;().GetOriginalEntityState(entity) == null) { //If it is not already attached Context.GetTable&lt;T&gt;().Attach(entity); } } </code></pre> <p>Generated SQL</p> <pre><code>UPDATE [dbo].[Account] SET [AccountType] = @p2, [ModifiedTime] = @p3 WHERE ([AccountNumber] = @p0) AND ([ModifiedTime] = @p1) -- @p0: Input Int (Size = -1; Prec = 0; Scale = 0) [1] -- @p1: Input DateTime (Size = -1; Prec = 0; Scale = 0) [6/26/2012 11:14:15 AM] -- @p2: Input NChar (Size = 10; Prec = 0; Scale = 0) [WIN-WIN] -- @p3: Input DateTime (Size = -1; Prec = 0; Scale = 0) [6/26/2012 11:16:29 AM] </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload