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 400 | Next

Scott Klein

"Professional LINQ"

Contacts
where con.LastName.StartsWith("K")
group con.FirstName by new { last = con.LastName, middle = con.MiddleName} ;
foreach (var grp in conQuery)
{
listBox1.Items.Add(grp.Key);
foreach (var listing in grp)
{
listBox1.Items.Add(listing);
}
}
Very slick.
Read-Only Data
If you don??™t plan to modify the data, you can get a pretty good performance increase by telling the
DataContext that you want the data returned as read-only, so this last section will discuss working with
read-only data.
To get read-only data, set the ObjectTrackingEnabled property to false. ObjectTrackingEnabled tells
the framework to track the original value. Setting it to false means that the framework doesn??™t need to
track changes, which provides a performance increase.
The following example shows how to disable object tracking by setting the ObjectTrackingEnabled
property to false.
255
Part III: LINQ to SQL
AdventureWorks db = new AdventureWorks("Integrated Security=sspi");
db.ObjectTracking = false;
var conQuery =
from con in db.Contacts
where con.


Pages:
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6