Given this LINQ to SQL:
using (var db = Database.Context)
{
var root = (from post in db.Post
where post.Id == rootPostId
select post).Single();
root.LastActivityUtc = DateTime.UtcNow;
db.SubmitChanges();
}
What will happen if the same record is concurrently being changed by another call to the same method (where this code lives) with the same rootPostId? Will an exception be thrown?
In such an event--concurrency conflict--I'd like to handle it by simple discarding the change so that just one update to LastActivityUtc is submitted instead of both, which will probably have the same value anyway.