SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 416 | Next

Scott Klein

"Professional LINQ"

The DataContext class has a Refresh method that refreshes the object state with the
original data in the database. The enumeration tells Refresh what to do in case of a conflict.
RefreshMode has three values:
??‘ KeepChanges??”Tells Refresh to keep the current changed values in the object but updates the
other values with the data from the database.
??‘ KeepCurrentValues??”Tells Refresh to replace the current object values with values from the
database.
??‘ OverwriteCurrentValues??”Tells Refresh to override all of the current object values with the
values from the database.
An example from earlier in the chapter illustrates the use of RefreshMode as well as the ConflictMode
enumeration and ChangeConflictException class. The highlighted lines point out the pertinent code.
265
Part III: LINQ to SQL
try
{
var conQuery =
from con in db.Contacts
where con.FirstName == "Scott"
select con;
// there are 15 Scott??™s in the table, so 15 changes should be made
foreach (Contact cont in conQuery)
{
cont.MiddleName = "L";
cont.NameStyle = 1;
}
db.


Pages:
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6