LINQ to SQL - Language Integrated Query

LINQ to SQL is a component of .NET Framework version 3.5 that provides a run-time infrastructure for managing relational data as objects.

In LINQ to SQL, the data model of a relational database is mapped to an object model expressed in the programming language of the developer. When the application runs, LINQ to SQL translates into SQL the language-integrated queries in the object model and sends them to the database for execution. When the database returns the results, LINQ to SQL translates them back to objects that you can work with in your own programming language.

C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\
sqlmetal.exe - Command-line Code Generation Tool
From a database, generate source code and mapping attributes or a mapping file.

sqlmetal /code:"northwind.cs" /language:csharp /server:localhost /database:Northwind /user:name /Password:*** /pluralize

Step 1: From a database, generate an intermediate database markup language (.dbml) file for customization.
Step 2: From a .dbml file, generate code and mapping attributes or a mapping file.

sqlmetal /dbml:"northwind.dbml" /language:csharp /server:localhost /database:Northwind /user:name /Password:*** /pluralize
sqlmetal /language:csharp "northwind.dbml"

C# Example

// Northwind inherits from System.Data.Linq.DataContext.
// Northwind nw = new Northwind(@"northwnd.mdf");

String sConnectionString = "Database=Northwind;Server=localhost;Integrated Security=SSPI";

Northwind nw = new Northwind(sConnectionString);

var companyNameQuery =
    from cust in nw.Customers
    where cust.City == "London"
    select cust.CompanyName;

foreach (var customer in companyNameQuery)

MSDN: 101 LINQ Samples