Learn your way! Get started

LINQ Using Visual C# 2010

with experts Ken Getz, Robert Green


Course at a glance

Included in these subscriptions:

  • Dev & IT Pro Video
  • Dev & IT Pro Power Pack
  • Power Pack Plus

Release date Release date 12/27/2011
Level Level Intermediate
Runtime Runtime 9h 42m
Closed captioning Closed captioning N/A
Transcript Transcript N/A
eBooks / courseware eBooks / courseware Included
Hands-on labs Hands-on labs Included
Sample code Sample code Included
Exams Exams Included


Enterprise Solutions
Enterprise Solutions

Need reporting, custom learning tracks, or SCORM? Learn More



Course description

In this course, you will learn to use the Language Integrated Query (LINQ) to easily create complex data-independent queries. In addition, you will learn about the language features for Visual C# in Visual Studio 2010 in order to make LINQ possible. You will start by working through a quick overview of LINQ, and how it applies to working with collections of objects, retrieving data stored in SQL Server, and creating XML content. Subsequent topics introduce new LINQ-oriented language features, LINQ to Objects, LINQ to DataSets, LINQ to SQL, LINQ to XML, and LINQ to Entities. By the time you nave completed the course, you will have a good understanding of now only how to construct LINQ queries to work with data, but also how to use the features added to Visual Basic that support LINQ.

Prerequisites

This course assumes that students have familiarity with .NET in general, and with specifically with programming ADO.NET. The course makes no attempt to explain basic Visual Studio 2010 or .NET Framework concepts, and assumes that the student is at least familiar with all the concepts covered in the Introduction to Programming and Developing Applications with Visual Studio 2010 courses.

Learning Paths

This course will help you prepare for the following certification and exam:
MCSD: Windows Store Apps
70-483: Programming in C#

This course is part of the following LearnNowOnline SuccessPaths™:
Accessing Data Services for Win Dev
Accessing Data Services for Web Dev

Meet the experts

Ken Getz Ken Getz is a featured instructor for several of our Visual Studio courses. He is a Visual Basic and Visual C# expert and has been recognized multiple times as a Microsoft MVP. Ken is a seasoned instructor, successful consultant, and the author or co-author of several best-selling books. He is a frequent speaker at technical conferences like Tech-Ed, VSLive, and DevConnections and he has written for several of the industry's most-respected publications including Visual Studio Magazine, CoDe Magazine, and MSDN Magazine.

Robert Green Robert Green is a Visual Studio expert and a featured instructor for several of our Visual Basic and Visual C# courses. He is currently a Technical Evangelist in the Developer Platform and Evangelism (DPE) group at Microsoft. He has also worked for Microsoft on the Developer Tools marketing team and as Community Lead on the Visual Basic team. Robert has several years of consulting experience focused on developer training and is a frequent speaker at technology conferences including TechEd, VSLive, VSConnections, and Advisor Live.


Course outline



Module 1

LINQ Intro (46:01)
  • Introduction (01:31)
  • Data Access In the Past (01:01)
  • Data Access APIs (01:22)
  • Object/Relational Mapping (01:24)
  • But Challenges Still Remain (01:03)
  • LINQ (01:05)
  • LINQ and Visual Basic/C# (01:09)
  • LINQ and Language Features (02:58)
  • LINQ Overview (00:43)
  • LINQ Providers (04:12)
  • Structure of a LINQ Query (01:00)
  • Three Stages of a LINQ Query (00:45)
  • Demo: Numbers > 5 (03:05)
  • The Data Source (00:20)
  • XML as Data Source (00:32)
  • SQL as Data Source (01:16)
  • The Query (00:50)
  • The Query Execution (00:50)
  • Returning Multiple Values (01:08)
  • Demo: Multiple Values (04:15)
  • Using an Anonymous Type (01:34)
  • Demo: Anonymous Type (02:52)
  • Deferred Execution (00:59)
  • Demo: Deferred Execution (05:50)
  • Force Execution (01:00)
  • Demo: Forcing Execution (02:34)
  • Summary (00:28)
LINQ Examples (40:07)
  • Introduction (00:41)
  • LINQ to Objects (00:37)
  • Demo: LINQ to Objects (05:57)
  • Continuing the Investigation (01:07)
  • Extenstion Methods (01:20)
  • Demo: Extenstion Method (03:02)
  • LINQ to Group Output (00:38)
  • Demo: Grouping (03:19)
  • LINQ to SQL (01:08)
  • Linking a Class to SQL Server (00:21)
  • Creating the Class (00:08)
  • Marking Up the Class (00:31)
  • Retrieving a Collection (01:04)
  • Demo: Manually Retrieving Data (07:38)
  • Anonymous Types (00:27)
  • Demo: Anonymous Type (01:30)
  • LINQ to XML (00:57)
  • Life without LINQ to XML (00:26)
  • Using System.Xml.Linq Classes (00:41)
  • Creating Data (00:48)
  • Demo: LINQ to XML (06:55)
  • Summary (00:42)

Module 2

Language Extensions (13:02)
  • Introduction (00:33)
  • LINQ and Languages (00:43)
  • The Sample Application (00:48)
  • Demo: Without New Features (03:02)
  • Implict Type Delcarations (00:32)
  • Demo: With New Features (02:29)
  • Object Initializers (00:29)
  • Constructors to the Rescue (00:55)
  • Demo: Object Initializers (02:43)
  • Summary (00:43)
Lambda Expressions And More (42:11)
  • Introduction (00:33)
  • Lambda Overview (01:14)
  • Using Delegates (01:08)
  • Demo: Delegates (03:09)
  • Predicate Delegate Type (01:13)
  • Demo: Predicate Delegate (02:07)
  • Using Anonymous Methods (00:37)
  • Anonymous Methods (00:48)
  • Demo: Anonymous Methods (01:57)
  • Using Lambda Expressions (01:10)
  • Demo: Lambda Expressions (06:24)
  • Lambda and Delegates (00:55)
  • Lambda and Sorting (00:44)
  • Func Delegate Type (00:46)
  • Demo: Func Declaration (03:07)
  • Extension Methods (00:55)
  • Creating Extension Methods (01:08)
  • Demo: Extension Method (03:50)
  • Chaining Operations (00:57)
  • Demo: Chaining Operations (04:06)
  • Extension vs. Built-In Methods (01:21)
  • Anonymous Types (00:31)
  • Demo: Anonymous Types (02:27)
  • Summary (00:52)

Module 3

LINQ And Collections (25:09)
  • Introduction (00:45)
  • What Can You Query? (00:31)
  • Arrays (00:14)
  • Different Types of Objects (00:17)
  • Arrays of Different Types (01:07)
  • Using the Let Keyword (00:29)
  • Using the OfType Method (01:31)
  • Demo: Query an Array (03:43)
  • Generic Lists (00:31)
  • Extension Methods (00:27)
  • Query Sytax vs. Functional (02:02)
  • Generic Dictionaries (00:33)
  • Demo: Lists and Dictionaries (05:26)
  • Strings (00:24)
  • Non-Generic Collections (01:46)
  • Demo: Strings & Non-Generic (04:35)
  • Summary (00:42)
LINQ Extension Methods (17:16)
  • Introduction (01:10)
  • Working with Data (00:52)
  • Demo: Setup (02:13)
  • Creating Sequences (00:25)
  • Selecting Sequences (00:54)
  • Retrieving a Single Element (02:43)
  • Demo: Creating Sequences (01:52)
  • Demo: Selecting Sequences (01:44)
  • Demo: Single Elements (04:24)
  • Summary (00:55)
More LINQ Extension Methods (35:37)
  • Introduction (00:35)
  • Filtering Sequences (01:10)
  • Demo: Filtering (01:55)
  • Ordering Sequences (00:32)
  • Verifying Sequences (01:29)
  • Demo: Ordering & Verifying (07:16)
  • Converting Sequences (00:46)
  • Positioning within Sequences (00:43)
  • Demo: Converting & Positioning (06:06)
  • Calculating Sequences (00:52)
  • Demo: Calculating (03:18)
  • More Complex Calculations (00:18)
  • Sample Calculation (01:18)
  • Demo: Aggregate Methods (05:29)
  • Set Operations (00:46)
  • Demo: Set Operations (02:23)
  • Summary (00:31)

Module 4

Mapping Data To Objects (19:08)
  • Introduction (01:10)
  • LINQ to SQL (00:55)
  • Mapping Data to Objects (01:10)
  • DataContext Class (01:05)
  • Entity Class (00:42)
  • Relationships (01:50)
  • Create an Object Model (00:52)
  • Demo: O/R designer (10:56)
  • Summary (00:23)
Querying Data (26:39)
  • Introduction (00:25)
  • Querying with LINQ to SQL (01:05)
  • Generated SQL Statements (01:42)
  • Simple Queries (01:30)
  • Using Scaler Functions (00:52)
  • Using Aggregate Functions (00:45)
  • Demo: Simple Queries (07:01)
  • Demo: Scaler Functions (02:45)
  • Demo: Aggregate Functions (02:38)
  • Querying Related Tables (01:59)
  • Demo: Related Tables (05:32)
  • Summary (00:20)
More Querying Data (24:17)
  • Introduction (00:26)
  • Lambda Expressions (01:17)
  • Extension Methods (00:51)
  • Demo: Lambda Expressions (04:35)
  • Demo: Extension Methods (02:34)
  • Grouping (00:59)
  • Joins (01:19)
  • Demo: Grouping (05:54)
  • Demo: Joins (05:49)
  • Summary (00:30)
Modifying Data (25:47)
  • Introduction (00:35)
  • Overview (01:32)
  • Demo: Modifying Data (02:39)
  • Demo: Add a Customer (03:28)
  • Demo: Delete a Customer (04:03)
  • Stored Procedures (01:05)
  • Demo: Stored Procedures (06:42)
  • Demo: Configure Behavior (03:50)
  • Summary (01:50)

Module 5

LINQ to SQL Advanced Features (47:42)
  • Introduction (00:42)
  • Deferred Execution (00:49)
  • Deferred Loading (02:45)
  • Read Only Queries (00:36)
  • Compiled Queries (00:46)
  • Direct Execution of Queries (00:53)
  • Demo: Deferred Loading (05:41)
  • Demo: Compiled Queries (06:34)
  • Transactions (02:06)
  • Cascading Deletes (00:50)
  • Tracking Changes (01:29)
  • Creating Databases (01:27)
  • Demo: Transactions (12:46)
  • Data Validation (01:38)
  • Demo: Data Validation (07:48)
  • Summary (00:44)
LINQ to SQL Applications (29:45)
  • Introduction (00:31)
  • Overview (00:54)
  • Web Application (00:28)
  • LinqDataSource Control (01:19)
  • Demo: Win App (15:00)
  • Demo: Web App (10:50)
  • Summary (00:41)

Module 6

Querying Data (33:20)
  • Introduction (00:37)
  • DataSets (01:39)
  • Working with Data (01:22)
  • LINQ to DataSet (01:00)
  • Querying on DataSet (00:35)
  • Untyped DataSets (01:28)
  • Typed DataSets (01:01)
  • Demo: Querying Data (16:48)
  • Filter, Sort and Find (00:51)
  • DataViews (00:37)
  • Demo: DataViews (06:49)
  • Summary (00:29)
Data Binding (20:39)
  • Introduction (00:33)
  • Overview (00:34)
  • ToList (00:39)
  • CopyToDataTable (00:54)
  • AsDataView (01:04)
  • Demo: Data Binding (16:30)
  • Summary (00:22)

Module 7

Creating XML (28:18)
  • Introduction (00:41)
  • What About XML? (00:52)
  • Visual Basic vs C# (01:37)
  • Creating XML Content (00:31)
  • Using XMLDocument (01:16)
  • Demo: XMLDocument (02:01)
  • XML Content Using LINQ (01:12)
  • Demo: Using LINQ (03:21)
  • Traversing XML (00:35)
  • Methods (01:20)
  • Demo: Traverse (02:45)
  • Axis Methods (02:33)
  • Updating XML Content (01:06)
  • Demo: Updating Content (03:03)
  • Verifying with Schema (01:26)
  • Demo: Validating Schema (03:18)
  • Summary (00:33)
Querying XML (19:04)
  • Introduction (00:43)
  • Querying XML Content (00:25)
  • Demo: Query XML with LINQ (01:52)
  • Anonymous Types (00:32)
  • Demo: Anonymous Type (02:22)
  • Extension Methods (00:51)
  • Demo: The Any Method (02:32)
  • Lambda Expressions (00:36)
  • Demo: Lambda Expression (01:41)
  • Transforming XML (00:52)
  • Perfoming the Transformation (01:05)
  • Demo: Transforming XML (04:31)
  • Summary (00:57)

Module 8

Entity Data Model (25:33)
  • Introduction (00:44)
  • Entity Framework (00:40)
  • Entity Data Model (03:23)
  • Framework Components (01:21)
  • ObjectContext Class (01:11)
  • Entity Class (00:35)
  • Relationships (01:05)
  • Create an EDM (00:29)
  • Demo: Create an EDM (15:01)
  • Summary (01:00)
Querying Data (38:07)
  • Introduction (00:24)
  • Overview (00:37)
  • Viewing SQL (00:56)
  • Simple Queries (00:44)
  • Scalar Functions (00:15)
  • Aggregate Functions (00:29)
  • Demo: Simple Queries (06:31)
  • Demo: Aggregate Functions (02:29)
  • Related Entities (01:22)
  • Lambda Expressions (01:18)
  • Demo: Related Tables (07:55)
  • Demo: Lambda Expressions (04:28)
  • Grouping (00:52)
  • Joins (01:17)
  • Demo: Grouping (04:26)
  • Demo: Joins (03:16)
  • Summary (00:40)
Modifing Data (24:59)
  • Introduction (00:36)
  • Overview (01:23)
  • Demo: Modifying Data (02:02)
  • Demo: Add a Customer (02:21)
  • Demo: Delete a Customer (04:59)
  • Stored Procedures (01:04)
  • Demo: Stored Procedures (11:48)
  • Summary (00:42)