I have following LINQ to SQL query
from msg in TblUserMessages
join user in Aspnet_Users on msg.FromUserID equals user.UserId
select new {
msg.FromUserID,
msg.ToUserID,
msg.MessageLocationID,
msg.MessageID,
user.UserName
}
And following lambda expression:
TblUserMessages
.Join (
Aspnet_Users,
msg => msg.FromUserID,
user => user.UserId,
(msg, user) =>
new
{
FromUserID = msg.FromUserID,
ToUserID = msg.ToUserID,
MessageLocationID = msg.MessageLocationID,
MessageID = msg.MessageID,
UserName = user.UserName
}
)
Both of these return same result set. Which is e.g. :
82522f05-2650-466a-a430-72e6c9fb68b7
6b2a174a-8141-43d2-b3ad-5b199bcbfcae
1
1
waheed
Which one is better to use. The FIRST
one or the SECOND
one.
Thanks