retrivenewly inserted record ID with Linq2SQL
Posted
by devmania
on Stack Overflow
See other posts from Stack Overflow
or by devmania
Published on 2010-03-15T20:45:54Z
Indexed on
2010/03/15
20:49 UTC
Read the original article
Hit count: 290
hi,
i am using the following
private BlogDataContext db = new BlogDataContext ();
article.Created = DateTime.UtcNow;
article.Modified = DateTime.UtcNow;
db.Articles.InsertOnSubmit(article);
db.SubmitChanges( );
int id = article.Id;
i am wondering is this save, i mean will it give me the Id of the article user inserted or will there be case of concurrences if another user update the article in fraction of second of second after this user ?
thanks in advanced.
© Stack Overflow or respective owner