sql - only update 1 column with linq -
I am using linq to obtain a line from a table in the database. Now I only update 1 column. Then I update it back into the database.
It goes well, many times in addition to any other process / thread / user that has changed any of the other areas from the case I get an exception (optimistic concurrency), let me see this Since then, since the last time I received the object with the linak, the values have been changed since then.
Since I'm only interested in 1 column, can I just tell Lincoln to update this column and ignore others? (And warned me that this is a column actually changed)
R
You can solve your concurrency issues by locating and catching one:
(on top db = new MyDataContext ()) using {var row = db. MyTable.Single (X = & gt; x.Id == TableID); // Getting the Line Row Column = column NewValue; // Try the new value {db.SubmitChanges (); } Hold (symbolic flexion) {db.ChangeConflicts.ResolveAll (refresh mode.cip change); Db.SubmitChanges (); }}
With all the changes made by the other users / processes / threads, the merge will be made on other columns that will remain made for their customer items.
In your case, only your columns will change.
Recommended article:
Comments
Post a Comment