How much overhead does 'Update Check' have for LINQ UPDATES

后端 未结 5 1140
温柔的废话
温柔的废话 2020-12-14 11:09

I have a simple row that I edit using LINQ. It has about 30 columns, including a primary key numeric sequence.

When an UPDATE is performed through LINQ, the UPDATE s

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 11:47

    We ran into this early on Stack Overflow. Every LINQ to SQL update verifies that the underlying fields haven't changed before writing an update. In other words, every update is "update the record only if this field equals, and this field equals, and this field equals"..

    We decided most of the time we didn't care about pessimistic updates, and the only field that the update needs to check is the Id field.

    So, what we did was set UpdateCheck="never" for every field except the Id in the dbml mapping file, like so:

    
      
      
      
    

    I don't know if there is a way to do this programmatically or on the fly.

提交回复
热议问题