C C T B H P N

Lecture #8 - Language INtegrated Query (LINQ)

Web Resourses:

UML XML, HTML Code Project Microsoft Developer's Network XML Sells Brothers C# Corner Mono Project Performance Counters

Content:

This lecture is an introduction to Language INtegrated Query. Today we review extension methods and lambdas, essential facilities for LINQ. Then we cover the most important ideas and syntax used when programming with LINQ.

The class text covers LINQ in chapters 8, 9, and 10.
Lambdas, which LINQ uses, are covered in class text 143 - 146 and 337 - 342.
  1. The Syllabus describes topics to be covered, reading material for you to digest before coming to class, and due dates for the assigned projects.
  2. Projects:

    Project #1, Project #2, Project #3, Project #4, Project2HelpF2018 Submitting Projects
  3. XML Tutorials

  4. XML Presentations and Demo Code:

    XML Sample, XML Sample Parse Tree XML Presentation, ppt XDocument - Create and Parse XML XmlHelp from earlier Help Session
    Shows how to parse a TestRequest, e.g., a non-trivial XML document. XML Demonstration Code
    This demonstrates XmlDocument, an earlier version of an XML document class.
    We won't discuss, but I left it here because you may encounter its use in C# code. XSLT Demonstration
    XSLT is a transformation language that we will discuss very briefly, but won't use in our demos and projects. XML Details Presentation
    This is a detailed XML presentation that was developed by a consultant for Microsoft.
  5. LINQ Presentation and Demos:

    IEnumerable<T> interface - MSDN link
    IQueryable<T> interface - MSDN link
    XDocument class - MSDN
    LINQ Presentation, pptx LINQ Query Examples from presentation
    Extension Methods - used by LINQ
    Lambda Capture
    LINQ Queries on Collections
    This solution contains examples of:
    • Queries on an array of ints - illustrates query syntax
    • Queries to sort an array of structs with different order specifications
    • Queries on XML, extracting various kinds of information
    • Binding XML data to a listbox in a WPF application. We won't look at this yet.
    Create XML with XDocument
    This isn't Linq, but uses some of the same .Net classes
    LINQ to SQL Example
    This solution contains:
    • Console application that programmatically creates and populates an SqlServer database
      and makes Linq queries to view its contents.
    • WPF GUI application that binds to the data in the database created by the console application,
      using a Linq query to fetch a subset of the stored information.
  6. LINQ Tutorials:

  7. LINQ to SQL Tutorials:

  8. Uses for XML
  9. Evaluating code projects - Cyclomatic Complexity, Size, Manual and Maintenance Pages, demonstration of requirements
  10. XSLT Tutorials

    XSLT is a transformation language, usually used to transform XML into HTML. We will not discuss XSLT nor use it in this course, but you should know that it exists and may find need for it in your professional work.
    XSLT Demonstration
    htmlLite - basics, zvon - complete tutorial, W3C - thorough and formal, XSL Tricks, TopXML, Michael Kay's overview, Google XSL links
  11. Mono Project
  12. Software Architecture: