Programming C# Extended Features (PCEF) – Outline

Detailed Course Outline

Introduction

  • Existing data-access technologies
  • Generic and nongeneric collections

Harnessing C# Language Features

Language shortcuts

  • Applying auto-implemented properties
  • Benefiting from implied-type declaration

Streamlining program logic

  • Instantiating entity objects
  • Simplifying construction with object initialisers

Employing Extension Methods for Middle-Tier Data Manipulation

Filtering and ordering data with lambda expressions

  • Comparing delegates and lambda expressions
  • Calling Count, Reverse, Union, Except and other extension methods

Applying extended features

  • Making code more flexible with delegates
  • Parameterising delegates and lambda expressions
  • Streamlining code with Func<T,R> generic delegates

Leveraging LINQ Query Keywords

Syntax and semantics

  • Coding LINQ queries
  • Ordering data and objects
  • Filtering with from, where, orderby and group

Iterating collections

  • Interfacing between C# and LINQ using IEnumerable<T>
  • Issuing queries on entity and spatial types

Attaching to Databases via the Entity Framework

Comparing ADO.NET with LINQ

  • DataSet objects vs. generic lists
  • SqlDataReader vs. IEnumerable<T>
  • Implementing accessors to separate the data tier

Connecting to and reading from a database

  • Establishing an ObjectContext and DbContext objects
  • Correlating entity classes and data tables
  • Executing stored procedures and table-valued functions

The Object Relational Designer tool

  • Mapping data tables to entity classes (table-first) and object models to database tables (code-first)
  • Inheriting with many-per-table and table-per-type (TPT)

Updating a database

  • Inserting, updating and deleting data
  • Error handling and exceptions
  • Committing and rolling back transactions

Enumerations and Generic Classes

Examining enum

  • Comparing IEnumerable<T> and IEnumerator<T>
  • Generating dynamic enumeration
  • The yield keyword

Writing generic classes

  • Reducing duplicate classes
  • Implementing a generic fast enumerator

Processing Data with LINQ Queries

Manipulating data

  • Combining and aggregating similar data with group
  • Performing inner, outer and group joins
  • Generating data subsets with the into clause

Advanced LINQ techniques

  • Creating anonymous query results
  • Retrieving composite views using nested from clauses
  • Issuing LINQ geographic/geometric queries on spatial types

Applying LINQ to XML

Processing XML

  • Loading XML dynamically via the web
  • Creating and saving XElement content
  • Parsing documents, elements and attributes
  • Walking an XML document using LINQ