Join in linq

lunedì 10 dicembre 2012 - 10.10
Tag Elenco Tags  C#  |  .NET 4.0

Gemini Profilo | Expert

Ciao a tutti
come si riscrive la seguente query:

Select u.UserId, up.Name, up.Surname, u.UserName, m.Email
from aspnet_Users u
inner join aspnet_Membership m on u.UserId=m.UserId
inner join UsersProfile up on u.UserId=up.UserId
Where m.IsApproved = 'true'

l'ho già scritta in questo modo:
var query =
from u in ctx.aspnet_Users.ToList()
join m in ctx.aspnet_Membership.ToList() on u.UserId equals m.UserId
join up in ctx.UsersProfile.ToList() on u.UserId equals up.UserId
where m.IsApproved
select new tipoUser
{
UserId = u.UserId.ToString(),
IsApproved = m.IsApproved,
Nome = up.Name,
Cognome = up.Surname,
CognomeNome = string.Concat(up.Surname, up.Name),
Username = u.UserName,
Password = m.Password,
Email = m.Email
};

ma vorrei scriverla anche nella forma:
.Where(...)

perchè devo creare una query parametrica con linq e tutti gli esempi che ho trovato usano questa forma.
Dove posso trovare degli ottimi tutorial e/o articoli?
Grazie mille
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5