Friday, February 22, 2008

.Net Framework 3.0/3.5 and LINQ

Traditional:

Troublesome areas:
Accessing data from different data sources. In particular, Database access and XML manipulation.

Database Problem:

  • we cannot programmatically interact with a database at the native language level.
  • Incorrectly referenced database fields are not detected
  • Differing data types utilized by a particular data domain, such as database or XML data types versus the native language in which the program is written. In particular, dates and times can be quite a hassle.

XML Problem:

  • XML parsing, iterating, and manipulation can be quite tedious.


Why LINQ ?:

LINQ is Microsoft’s technology to provide a language-level support mechanism for querying data of all types. These types include in-memory arrays and collections, databases, XML documents, and more…..


LINQ Category:

  • LINQ to Objects
  • LINQ to XML
  • LINQ to DataSet
  • LINQ to SQL
  • LINQ to Entities


LINQ to Objects:

Allows you to perform queries against arrays and in-memory data collections.

LINQ to XML:

Not only has Microsoft added the necessary XML libraries to work with LINQ, it has addressed other deficiencies in the standard XML DOM, thereby making it easier than ever to work with XML. Gone are the days of having to create an XmlDocument just to work with a small piece of XML.

LINQ to Dataset:

Many developers have a lot of existing code relying on DataSets. Those who do will not be left behind, nor will they need to rewrite their code to take advantage of the power of LINQ.

LINQ to SQL:

Query against Microsoft’s SQL Server database.

LINQ to Entities:

LINQ to Entities is an alternative LINQ API that is used to interface with a database. It decouples the entity object model from the physical database by injecting a logical mapping between the two.


Where is LINQ ?

With C# 3.0 and the .NET Framework 3.5