Jr., Joseph C. Rattz1590597893, 9781590597897
Table of contents :
Prelims……Page 1
Contents at a Glance……Page 7
Contents……Page 9
About the Author……Page 19
About the Technical Reviewer……Page 21
Acknowledgments……Page 23
A Paradigm Shift……Page 27
Query XML……Page 28
Query a SQL Server Database……Page 29
LINQ Is About Data Queries……Page 30
LINQ to Entities……Page 31
LINQ Is Not Just for Queries……Page 32
Use the var Keyword When Confused……Page 35
Use the Cast or OfType Operators for Legacy Collections……Page 36
Prefer the OfType Operator to the Cast Operator……Page 37
Don’t Assume a Query Is Bug-Free……Page 38
Use the DataContext Log……Page 39
Summary……Page 40
Lambda Expressions……Page 43
Using Named Methods……Page 44
Using Anonymous Methods……Page 45
Using Lambda Expressions……Page 46
Expression Trees……Page 48
Keyword var, Object Initialization, and Anonymous Types……Page 49
The Implicitly Typed Local Variable Keyword var……Page 50
Object and Collection Initialization Expressions……Page 51
Anonymous Types……Page 53
Instance (Object) vs. Static (Class) Methods Recap……Page 54
The Problem Solved by Extension Methods……Page 55
The Solution……Page 56
Extension Method Declarations and Invocations……Page 57
Partial Methods……Page 58
A Partial Method Example……Page 59
The Rules……Page 60
Query Expressions……Page 61
Query Expression Grammar……Page 62
Query Expression Translation……Page 64
Summary……Page 74
LINQ to Objects Overview……Page 77
IEnumerable, Sequences, and the Standard Query Operators……Page 78
Returning IEnumerable, Yielding, and Deferred Queries……Page 79
Func Delegates……Page 82
The Standard Query Operators Alphabetical Cross-Reference……Page 83
Summary……Page 85
Common Classes……Page 87
Where……Page 89
Projection……Page 91
Select……Page 92
SelectMany……Page 97
Partitioning……Page 100
Take……Page 101
TakeWhile……Page 103
Skip……Page 104
SkipWhile……Page 105
Concat……Page 107
OrderBy……Page 110
OrderByDescending……Page 115
ThenBy……Page 119
ThenByDescending……Page 122
Reverse……Page 125
Join……Page 126
GroupJoin……Page 128
GroupBy……Page 130
Set……Page 135
Distinct……Page 136
Union……Page 137
Intersect……Page 138
Except……Page 139
Cast……Page 141
OfType……Page 143
AsEnumerable……Page 145
Element……Page 147
DefaultIfEmpty……Page 148
Range……Page 152
Repeat……Page 153
Empty……Page 154
Summary……Page 155
Common Classes……Page 157
ToArray……Page 160
ToList……Page 162
ToDictionary……Page 164
ToLookup……Page 168
SequenceEqual……Page 172
First……Page 175
FirstOrDefault……Page 177
Last……Page 179
LastOrDefault……Page 180
Single……Page 182
SingleOrDefault……Page 184
ElementAt……Page 186
ElementAtOrDefault……Page 187
Any……Page 188
All……Page 190
Contains……Page 191
Count……Page 194
LongCount……Page 195
Sum……Page 197
Min……Page 198
Max……Page 200
Average……Page 203
Aggregate……Page 205
Summary……Page 207
LINQ to XML Introduction……Page 211
Cheating the W3C DOM XML API……Page 214
Summary……Page 216
Significant API Design Enhancements……Page 217
XML Tree Construction Simplified with Functional Construction……Page 218
Document Centricity Eliminated in Favor of Element Centricity……Page 220
Names, Namespaces, and Prefixes……Page 221
Node Value Extraction……Page 224
The LINQ to XML Object Model……Page 226
Deferred Query Execution, Node Removal, and the Halloween Problem……Page 227
Creating Elements with XElement……Page 230
Creating Attributes with XAttribute……Page 232
Creating Comments with XComment……Page 233
Creating Declarations with XDeclaration……Page 234
Creating Document Types with XDocumentType……Page 235
Creating Documents with XDocument……Page 236
Creating Names with XName……Page 237
Creating Processing Instructions with XProcessingInstruction……Page 238
Creating Streaming Elements with XStreamingElement……Page 240
Creating Text with XText……Page 241
Saving with XDocument.Save()……Page 242
Saving with XElement.Save()……Page 243
Loading with XDocument.Load()……Page 244
Loading with XElement.Load()……Page 246
Parsing with XDocument.Parse() or XElement.Parse()……Page 247
XML Traversal……Page 248
Backward with XNode.PreviousNode……Page 249
Up to Document with XObject.Document……Page 250
Up with XObject.Parent……Page 251
Down with XContainer.Nodes()……Page 252
Down with XContainer.Elements()……Page 256
Down with XContainer.Element()……Page 257
Up Recursively with XNode.Ancestors()……Page 258
Up Recursively with XElement.AncestorsAndSelf()……Page 259
Down Recursively with XContainer.Descendants()……Page 260
Down Recursively with XElement.DescendantsAndSelf()……Page 261
Forward with XNode.NodesAfterSelf()……Page 262
Forward with XNode.ElementsAfterSelf()……Page 263
Backward with XNode.NodesBeforeSelf()……Page 264
Backward with XNode.ElementsBeforeSelf()……Page 265
Adding Nodes……Page 266
XContainer.AddFirst()……Page 267
XNode.AddBeforeSelf()……Page 268
XNode.AddAfterSelf()……Page 270
XNode.Remove()……Page 271
IEnumerable.Remove()……Page 272
Updating Nodes……Page 273
XElement.Value on XElement Objects, XText.Value on XText Objects, and XComment.Value on XComment Objects……Page 274
XDocumentType.Name, XDocumentType.PublicId, XDocumentType.SystemId, and XDocumentType.InternalSubset on XDocumentType Objects……Page 275
XElement.ReplaceAll()……Page 276
XElement.SetElementValue() on Child XElement Objects……Page 277
Forward with XElement.FirstAttribute……Page 279
Backward with XAttribute.PreviousAttribute……Page 280
XElement.Attribute()……Page 281
Adding Attributes……Page 282
Deleting Attributes……Page 283
Updating Attributes……Page 285
XElement.SetAttributeValue()……Page 286
Accessing Annotations with XObject.Annotation() or XObject.Annotations()……Page 287
Annotations Example……Page 288
XML Events……Page 291
A Couple of Event Examples……Page 292
Summary……Page 296
Introduction to LINQ to XML Operators……Page 297
Examples……Page 298
Examples……Page 302
Prototypes……Page 304
Examples……Page 305
Examples……Page 307
Examples……Page 308
Examples……Page 310
Examples……Page 312
Elements……Page 314
Examples……Page 315
Examples……Page 317
Nodes……Page 318
Examples……Page 319
Examples……Page 320
Summary……Page 323
Queries……Page 325
No Reaching……Page 326
A Complex Query……Page 328
Transformations……Page 333
Transformations Using XSLT……Page 334
Transformations Using Functional Construction……Page 336
Suppressing Node Construction with null……Page 338
Handling Multiple Peer Nodes While Remaining Flat……Page 341
Prototypes……Page 344
Obtaining an XML Schema……Page 345
Examples……Page 346
Prototypes……Page 358
Summary……Page 359
LINQ to DataSet Operators……Page 363
Common Code for the Examples……Page 364
DataRow Set Operators……Page 365
Examples……Page 366
Except……Page 369
Examples……Page 370
Intersect……Page 371
Examples……Page 372
Union……Page 373
Examples……Page 374
Examples……Page 376
DataRow Field Operators……Page 377
Prototypes……Page 381
Examples……Page 382
Prototypes……Page 386
Examples……Page 387
Examples……Page 389
Prototypes……Page 390
Examples……Page 391
Summary……Page 395
Typed DataSets……Page 397
Putting It All Together……Page 399
Summary……Page 402
LINQ to SQL Introduction……Page 405
Introducing LINQ to SQL……Page 406
The DataContext……Page 407
Associations……Page 408
Concurrency Conflict Resolution……Page 409
Generating the Northwind Entity Classes……Page 410
Generating the Northwind XML Mapping File……Page 411
GetStringFromDb()……Page 412
ExecuteStatementInDb()……Page 413
Summary……Page 414
Use the DataContext.Log Property……Page 415
SQLMetal……Page 417
Working with DBML Intermediate Files……Page 422
Creating Your LINQ to SQL Classes File……Page 424
Connecting the DataContext to the Database……Page 425
Adding an Entity Class……Page 426
Editing the Entity Class Model……Page 429
Adding Objects to the Entity Class Model……Page 430
Overriding the Insert, Update, and Delete Methods……Page 431
Summary……Page 437
Using the LINQ to SQL API……Page 439
Inserts……Page 440
Inserting Attached Entity Objects……Page 443
Queries……Page 444
Exceptions to the Norm……Page 445
Associations……Page 447
Joins……Page 458
Deferred Query Execution……Page 462
The SQL IN Statement with the Contains Operator……Page 466
Updating Associated Classes……Page 467
Deletes……Page 470
Deleting Relationships……Page 472
Overriding the Insert Method……Page 473
Example……Page 474
SQL Translation……Page 477
Summary……Page 479
Creating Entity Classes……Page 481
Writing Entity Classes By Hand……Page 482
Entity Class Attributes and Attribute Properties……Page 495
XML External Mapping File Schema……Page 508
Projecting into Entity Classes vs. Nonentity Classes……Page 509
Prefer Object Initialization to Parameterized Construction When Projecting……Page 510
Extending Entity Classes with Partial Methods……Page 514
Entity……Page 516
HasLoadedOrAssignedValue……Page 517
Table……Page 518
GetParameterValue……Page 519
IMultipleResults……Page 520
Summary……Page 521
[Your]DataContext Class……Page 523
The DataContext Class……Page 524
Identity Tracking……Page 527
Change Tracking……Page 531
Change Processing……Page 532
Prototypes……Page 533
Examples……Page 534
Examples……Page 545
DatabaseExists()……Page 551
CreateDatabase()……Page 552
Examples……Page 553
CreateMethodCallQuery()……Page 554
Examples……Page 555
Prototypes……Page 556
Examples……Page 557
Prototypes……Page 558
Examples……Page 559
Examples……Page 560
Prototypes……Page 561
Examples……Page 562
Examples……Page 568
Prototypes……Page 569
Examples……Page 570
Prototypes……Page 571
Examples……Page 572
Prototypes……Page 573
Examples……Page 574
Summary……Page 579
Concurrency Conflicts……Page 581
Conflict Detection……Page 582
Conflict Resolution……Page 585
Pessimistic Concurrency……Page 592
An Alternative Approach for Middle Tiers and Servers……Page 594
Summary……Page 596
Database Views……Page 597
Entity Class Inheritance……Page 599
Transactions……Page 604
Summary……Page 606
Index……Page 609
Reviews
There are no reviews yet.