Building Effective Web Applications with ASP .Net 3.5 - Week 2
Last week I delivered part two of a six part series of webcasts for a course I created
for my employer, titled "Building Effective Web Applications with ASP
.Net 3.5". Each session lasts two hours. Week 2 we focused on LINQ (Language Integrated Query). LINQ is a general purpose query facility to query relational data, XML data, objects/collections that allows us to query any of these data shapes in a consistent manner. LINQ query syntax resembles SQL except that the 'from' clause is in the beginning of the query, which allows the compiler to infer the type of the object.
Here are some of the benefits of using LINQ:
There are new features in C# that support LINQ including:
Local variable type inference allow the C# or VB .Net compiler to determine the type of a variable at compile time
Anonymous types allow us to create an object type on the fly.
One of the coolest features in LINQ using VB.Net is XML literals. If you have ever had the experience of creating an XML document using the DOM (Document Object Model) you know that it may be cumbersome to build. It also is difficult to query using XPath. XML literals allow us to copy an paste code into LINQ and the compiler builds the syntax to make this happen. Read on here to read a description of XML literals and how it's done in VB9. In C#, we have to build an add-in to provide this same functionality. The following link describes how to build the Paste XML as XElement addin.
My slide deck can be downloaded here. Let me know what you think!
Here are some of the benefits of using LINQ:
- You may not need to build an entire DAL (data access layer)
- It is much easier to query XML – don’t have to use Xpath
- We can work with data in a consistent way – whether it is SQL Server data, XML data, ADO .Net dataset, an object collection, or data in memory
- Offers compile time checking, autocompletion, and Intellisense
There are new features in C# that support LINQ including:
- Automatic properties
- Initializers
- Type Inference
- Anonymous types
Local variable type inference allow the C# or VB .Net compiler to determine the type of a variable at compile time
Anonymous types allow us to create an object type on the fly.
One of the coolest features in LINQ using VB.Net is XML literals. If you have ever had the experience of creating an XML document using the DOM (Document Object Model) you know that it may be cumbersome to build. It also is difficult to query using XPath. XML literals allow us to copy an paste code into LINQ and the compiler builds the syntax to make this happen. Read on here to read a description of XML literals and how it's done in VB9. In C#, we have to build an add-in to provide this same functionality. The following link describes how to build the Paste XML as XElement addin.
My slide deck can be downloaded here. Let me know what you think!

Comments