LINQ – Acesso a tabelas orientado a Objeto

Tenho participado do FORUM MSDN (USA) e tenho acompanhado a idéia do projeto LINQ. Acesso a tabelas orientado a Objeto. REGASSA!
 
Estava pensando ontem… Com isso o TableAdapter do VS 2005 pode sumir? Será?
 
Achei um código legal que pode ajudar no caminho das pesquisas…
// establish a query context over ADO.NET sql connection
DataContext context = new DataContext(
     "Initial Catalog=petdb;Integrated Security=sspi");

// grab variables that represent the remote tables that 
// correspond to the Person and Order CLR types
Table<Person> custs = context.GetTable<Person>();
Table<Order> orders   = context.GetTable<Order>();

// build the query
var query = from c in custs, o in orders
            where o.Customer == c.Name
            select new { 
                       c.Name, 
                       o.OrderID,
                       o.Amount,
                       c.Age
            }; 

// execute the query
foreach (var item in query) 
    Console.WriteLine("{0} {1} {2} {3}", 
                      item.Name, item.OrderID, 
                      item.Amount, item.Age);

OBS: O que avacalhou foi o "var" do VB. hahahaha…

 

Site: http://msdn.microsoft.com/netframework/future/linq/default.aspx?pull=/library/en-us/dndotnet/html/linqprojectovw.asp

 

Grande abraço,

Thiago Cruz

thiago.cruz@dotnetraptors.com.br

 

 

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s