Since I am new to Linq so not able to convert this SQL query to Linq I am pasting my code that I have already tried, it gives null records.
Thanks in advance.
This is my Linq C# Statements that I have tried:
from ts in Db.Tasks
join prt in Db.ProjectTasks on ts.Id equals prt.TaskId into PojTsk
from t1 in PojTsk
join TL in Db.Timeline on ts.Id equals TL.TypeId into Tmln
from t2 in Tmln
join DUR in Db.Duration on ts.Id equals DUR.TypeId into Dur
from t3 in Tmln
where t1.ProjectId == ProjectId
&& t2.Type == (int)Provider.EntityType.TASK
&& t3.Type == (int)Provider.EntityType.TASK
select ts
This is my SQL query that I am trying to convert to Linq with C#:
SELECT
CONCAT('T', R1.Id) as Id,
R1.Name, R1.Description, R1.Priority,
R1.Stage, R1.Status, R1.CreatorId,
R2.ProjectId, R3.StartDate, R3.EndDate,
R3.LatestEndDate, R3.LatestStartDate,
R3.EarliestStartDate, R3.ActualStart, R3.ActualEnd,
R3.RemTime, R3.ReshowDate, R3.RemTime, R3.Completed,
R4.ActualDuration, R4.ActualDurationPlanned
FROM
(SELECT *
FROM [ProjectManagement].[dbo].[Tasks] AS TS) AS R1
JOIN
(SELECT *
FROM [ProjectManagement].[dbo].[ProjectTasks]) AS R2 ON R1.Id = R2.TaskId
LEFT JOIN
(SELECT * FROM [ProjectManagement].[dbo].[Timelines]
WHERE Type = 3) AS R3 ON R1.Id = R3.TypeId
LEFT JOIN
(SELECT * FROM [ProjectManagement].[dbo].[Durations]
WHERE Type = 3) AS R4 ON R1.Id = R4.TypeId
WHERE
ProjectId = 1