Joseph C. Rattz
This book demonstrates the overwhelming majority of LINQ operators and protoypes, it is a veritable treasury of LINQ examples.
LINQ is the project name for a set of extensions to the .NET Framework that provide a generic approach to querying data from different data sources. LINQ will premier in Visual Studio 2008, and will become the next must–have skill for .NET developers. For more information about LINQ, you can check out the author’s portal at www.linqdev.com.
Pro LINQ: Language Integrated Query in C# 2008 is all about code.
Literally, this book starts with code and ends with code. In most books, the author shows the simplest example demonstrating how to use a method, but they so rarely show how to use the more complex prototypes. Pro LINQ: Language Integrated Query in C# 2008 is different. Demonstrating the overwhelming majority of LINQ operators and protoypes, it is a veritable treasury of LINQ examples.
Rather than obscure the relevant LINQ principles in code examples by focusing on a demonstration application you have no interest in writing, Pro LINQ: Language Integrated Query in C# 2008 cuts right to the chase of each LINQ operator, method, or class. However, where complexity is necessary to truly demonstrate an issue, the examples are right there in the thick of it. For example, code samples demonstrating how to handle concurrency conflicts actually create concurrency conflicts so you can step through the code and see them unfold.
Most books tell you about the simple stuff, while few books warn you of the pitfalls. Where Pro LINQ: Language Integrated Query in C# 2008 returns your investment is in the hours, and sometimes days, spent by the author determining why something may not work as expected. Sometimes this results in an innocent looking paragraph that may take you a minute to read and understand, but took days to research and explain.
Face it, most technical books while informative, are dull. LINQ need not be dull. Written with a sense of humor, Pro LINQ: Language Integrated Query in C# 2008 will attempt to entertain you on your journey through the wonderland of LINQ and C# 2008.
What you’ll learn
Who is this book for?
This book is written for the proficient C# developer, but you do not need to be up on all the latest C# features to understand the material. When you finish this book, you will be up on all the latest C# features.
Joseph C. Rattz, Jr., unknowingly began his career in software development in 1990 when a friend asked him for assistance writing an ANSI text editor named ANSI Master for the Commodore Amiga. A hangman game (The Gallows) soon followed. From these compiled Basic programs, he moved on to programming in C for more speed and power. Joe then developed applications that were sold to JumpDisk, an Amiga disk magazine, as well as Amiga World magazine. Due to developing in a small town on a fairly isolated platform, Joe learned all the wrong ways to write code. It was while trying to upgrade his poorly written applications that he gained respect for the importance of easily maintainable code. It was love at first sight when Joe spotted a source–level debugger in use for the first time.
Two years later, Joe obtained his first software development opportunity at Policy Management Systems Corporation as an entry–level programmer developing a client/server insurance application for OS/2 and Presentation Manager. Through the years, he added C++, Unix, Java, ASP, ASP.NET, C#, HTML, DHTML, and XML to his skill set while developing applications for SCT, DocuCorp, IBM and the Atlanta Committee for the Olympic Games, CheckFree, NCR, EDS, Delta Technology, Radiant Systems, and the Genuine Parts Company. Joe enjoys the creative aspects of user interface design, and he appreciates the discipline necessary for server–side development. But, given his druthers, his favorite development pastime is debugging code.
Joe can be found working for the Genuine Parts Company—the parent company of NAPA—in the Automotive Parts Group Information Systems department, where he works on his baby, the Storefront web site. This site for NAPA provides the stores a view into their accounts and data on a network of AS/400s.
What is in this book
About the Author About the Technical Reviewer Acknowledgments
PART 1 Pro LINQ: Language Integrated Query in C# 2008
CHAPTER 1 Hello LINQ
A Paradigm Shift Query XML Query a SQL Server Database Introduction LINQ Is About Data Queries Components How to Obtain LINQ LINQ Is Not Just for Queries Tips to Get You Started Use the var Keyword When Confused Use the Cast or OfType Operators for Legacy Collections Prefer the OfType Operator to the Cast Operator Don’t Assume a Query Is Bug-Free Take Advantage of Deferred Queries Use the DataContext Log Use the LINQ Forum Summary
CHAPTER 2 C# 3.0 Language Enhancements for LINQ
New C# 3.0 Language Additions Lambda Expressions Expression Trees Keyword var, Object Initialization, and Anonymous Types Extension Methods Partial Methods Query Expressions Summary
PART 2 LINQ to Objects
CHAPTER 3 LINQ to Objects Introduction
LINQ to Objects Overview IEnumerable<T>, Sequences, and the Standard Query Operators Returning IEnumerable<T>, Yielding, and Deferred Queries Func Delegates The Standard Query Operators Alphabetical Cross-Reference Summary CHAPTER 4 Deferred Operators Referenced Namespaces Referenced Assemblies Common Classes The Deferred Operators by Purpose Restriction Projection Partitioning Concatenation Ordering Join Grouping Set Conversion Element Generation Summary
CHAPTER 5 Nondeferred Operators
Referenced Namespaces Common Classes The Nondeferred Operators by Purpose Conversion Equality Element Quantifiers Aggregate Summary PART 3 LINQ to XMLCHAPTER 6 LINQ to XML Introduction
Introduction Cheating the W3C DOM XML API Summary
CHAPTER 7 The LINQ to XML API
Referenced Namespaces Significant API Design Enhancements XML Tree Construction Simplified with Functional Construction Document Centricity Eliminated in Favor of Element Centricity Names, Namespaces, and Prefixes Node Value Extraction The LINQ to XML Object Model Deferred Query Execution, Node Removal, and the Halloween Problem XML Creation Creating Elements with XElement Creating Attributes with XAttribute Creating Comments with XComment Creating Containers with XContainer Creating Declarations with XDeclaration Creating Document Types with XDocumentType Creating Documents with XDocument Creating Names with XName Creating Namespaces with XNamespace Creating Nodes with XNode Creating Processing Instructions with XProcessingInstruction Creating Streaming Elements with XStreamingElement Creating Text with XText Creating CData with XCData XML Output Saving with XDocument.Save() Saving with XElement.Save() XML Input Loading with XDocument.Load() Loading with XElement.Load() Parsing with XDocument.Parse() or XElement.Parse() XML Traversal Traversal Properties Traversal Methods XML Modification Adding Nodes Deleting Nodes Updating Nodes XElement.SetElementValue() on Child XElement Objects XML Attributes Attribute Creation Attribute Traversal Attribute Modification XML Annotations Adding Annotations with XObject.AddAnnotation() Accessing Annotations with XObject.Annotation() or XObject.Annotations() Removing Annotations with XObject.RemoveAnnotations() Annotations Example XML Events XObject.Changing XObject.Changed A Couple of Event Examples Trick or Treat, or Undefined? Summary
CHAPTER 8 LINQ to XML Operators
Introduction to LINQ to XML Operators Ancestors Prototypes Examples AncestorsAndSelf Prototypes Examples Attributes Prototypes Examples DescendantNodes Prototypes Examples DescendantNodesAndSelf Prototypes Examples Descendants Prototypes Examples DescendantsAndSelf Prototypes Examples Elements Prototypes Examples InDocumentOrder Prototypes Examples Nodes Prototypes Examples Remove Prototypes Examples Summary
CHAPTER 9 Additional XML Capabilities
Referenced Namespaces Queries No Reaching A Complex Query Transformations Transformations Using XSLT Transformations Using Functional Construction TipsValidation The Extension Methods Prototypes Obtaining an XML Schema Examples XPath Prototypes Examples Summary
PART 4 LINQ to DataSet
CHAPTER 10 LINQ to DataSet Operators
Assembly References Referenced Namespaces Common Code for the Examples DataRow Set Operators Distinct Except Intersect Union SequenceEqual DataRow Field Operators Field<T> SetField<T> DataTable Operators AsEnumerable CopyToDataTable<DataRow>Summary
CHAPTER 11 Additional DataSet Capabilities
Required Namespaces Typed DataSets Putting It All Together Summary
PART 5 LINQ to SQL
CHAPTER 12 LINQ to SQL Introduction
Introducing LINQ to SQL The DataContext Entity Classes Associations Concurrency Conflict Detection Concurrency Conflict Resolution Prerequisites for Running the Examples Obtaining the Appropriate Version of the Northwind Database Generating the Northwind Entity Classes Generating the Northwind XML Mapping File Using the LINQ to SQL API IQueryable<T> Some Common Methods GetStringFromDb() ExecuteStatementInDb()Summary
CHAPTER 13 LINQ to SQL Tips and Tools
Introduction to LINQ to SQL Tips and ToolsTips Use the DataContext.Log Property Use the GetChangeSet() Method Consider Using Partial Classes or Mapping Files Consider Using Partial Methods Tools SQLMetal The Object Relational Designer Use SQLMetal and the O/R Designer Together Summary
CHAPTER 14 LINQ to SQL Database Operations
Prerequisites for Running the Examples Some Common Methods Using the LINQ to SQL API Standard Database Operations Inserts Queries Updates Deletes Overriding Database Modification Statements Overriding the Insert Method Overriding the Update Method Overriding the Delete Method Example Overriding in the Object Relational Designer Considerations SQL Translation Summary
CHAPTER 15 LINQ to SQL Entity Classes
Prerequisites for Running the Examples Entity Classes Creating Entity Classes XML External Mapping File Schema Projecting into Entity Classes vs. Nonentity Classes Extending Entity Classes with Partial Methods Important System.Data.Linq API Classes EntitySet<T> EntityRef<T> Table<T> IExecuteResult ISingleResult<T> IMultipleResultsSummary
CHAPTER 16 The DataContext
Prerequisites for Running the Examples Some Common Methods Using the LINQ to SQL API [Your]DataContext Class The DataContext Class Primary Purposes DataContext() and [Your]DataContext() SubmitChanges() DatabaseExists() CreateDatabase() DeleteDatabase() CreateMethodCallQuery() ExecuteQuery() Translate() ExecuteCommand() ExecuteMethodCall() GetCommand() GetChangeSet() GetTable() Refresh()Summary
CHAPTER 17 Concurrency Conflicts
Prerequisites for Running the Examples Some Common Methods Using the LINQ to SQL API Concurrency Conflicts Optimistic Concurrency Pessimistic Concurrency An Alternative Approach for Middle Tiers and Servers Summary
CHAPTER 18 Additional SQL Capabilities
Prerequisites for Running the Examples Using the LINQ to SQL API Using the LINQ to XML APIDatabase Views Entity Class Inheritance Transactions Summary
Mindcracker Network accepts no liability for providing the customer with the hard copy of the book purchased. Mindcracker is not responsible for any dispute relating to the above. All eBooks listed in this section are in "PDF" Format. Contact [email protected] for further assistant.
Unlock unlimited ebook downloads. Share it on your social profile.