LINQ: Showing Single Record From Child Table with Parent Table Row.

In LINQ if you want to show the child table single record with the parent table, you can do like below:

from mem in ctx.Member
join ord in ctx.MemOrder on mem.member_id equals ord.member_id
into memord
select new StagingClass
{
 mem.member_id,
 latestOrderNo = memord.FirstOrDefault().OrderNo
}

Comments

Popular posts from this blog

LINQ: Using int.TryParse() within a LINQ where clause

ASP.Net MVC: Configuring asp.net session state in SQL Server.

IIS: Publish Project to remote IIS with Web Deploy.