Linq to Sql - Pillole

Pubblicato da Franz | 11.21 | , , , , | 0 commenti »

Esempio Left Join

// riferimenti
// Libro Linq to Sql: pag 224
// http://social.msdn.microsoft.com/forums/en-US/linqprojectgeneral/thread/797a6e7a-84fb-49a4-99d2-512f06c4f93e/

LinqToSqlDataContext dc = new LinqToSqlDataContext();
var l = from t1  in dc.Tabella1s
join t2 in dc.Tabella2s on t1.id equals t2.id

// Left Join SQL = LEFT JOIN TABELLA3 T3  WITH(NOLOCK) ON T1.item=T3.item
// ---------------------------------------------------------------------------------
join t3 in dc.Tabella3s on t1.id equals t3.id3
into joinDictionary
from TablejoinDictionary in joinDictionary.DefaultIfEmpty()
select new
{
campi ....
};

0 commenti