From the course: .NET Essentials: LINQ for Databases

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use query expression syntax

Use query expression syntax - .NET Tutorial

From the course: .NET Essentials: LINQ for Databases

Start my 1-month free trial

Use query expression syntax

- [Instructor] The query expression syntax is favored by many. It looks like SQL. And that is appealing to a segment of developers. Let's look at the basic structure of a query expression. So I am going to be querying two different data sources. The Shippers DB set and the Territories DB set. And what I'm showing you here is a query expression which is called the pass through query. It will return all the rows and the columns from the table, the underlying table. So this is the same as calling select star from table name in SQL. So the anatomy of a query expression is you always have to have a variable. So I'm declaring a variable here which is the potential query. And then all query expressions start with the keyword from and they end with either select or a group by. So my examples today are ending with select. That's the minimum you need, from and select. And then you need two other parts. You need the in keyword…

Contents