LINQ nested joins -


I am trying to include SQL in LINQ. I need some help in nested joining in LINQ.

This is my SQL query, Ive reduced it to show nested joins in SECL:

specific TxtTaskStatus as TaskTitus, txtempfirstname + '+ + + + as the Burofeela name, txtTaskPriorityDescription taken as txtemplastname Caryprdita described as as itemdateTime dtmtaskcreated, dbo.tblTask.lngtaskid TaskID, built as dbo.tblTask.dtmtask DateDateTime, (varchar (512), dbo .tblTask.txttaskdescription) & gt; ProblemStatement, dbo.tblTask.lngtaskmessageid, dbo.tblMessage.lngmessageid As MessageId, is the case when isnull (dbo.tblMessage.txtmessagesubject, '') as & lt; '' So MessageSubject, dbo.tblMessage.txtmessagedescription MessageDescription, the case when dbo.tblMessage.dtmmessagecreated is not clear if the rest of the cast (FLOOR (CAST (decimal as dtmtaskcreated dbo.tblMessage.dtmmessagecreated (as as txtmessagesubject rest left (txtmessagedescription, 50) end 12, 5))) as DATETIME) MessageCreatedDateTime as end dbo.tblAction right external dbo.tblAction.lngactiontaskid = dbo.tblTask.lngtaskid left outer Join dbo.tblMessage dbo. dbo.tblTask.lngtaskmessageid join tblTask ​​= dbo.tblMessage .lngmessageid LEFT OUTER jOIN dbo.tblTaskCommentRecipient RIGHT OUTER jOIN comment on dbo.tblTask ​​dbo.tblTaskCo dbo.tblTask.lngtaskid on dbo.tblTaskCommentRecipient.lngTaskCommentID = dbo.tblTaskComment.lngTaskCommentID on mment = dbo.tblTaskComment.lngTaskCommentTaskId

Another experienced SQL programmer will not be connected in such a way that they use strictly left to use for clarity (as there is a solution available to connect with a strictly).

I've added them to create a hierarchy:

  Task Activity Message TaskComment TaskCommentRecipient  

LINQ for SQL Designer In associations created in, you can reach these levels of hierarchy with:

  // Note: These are not getting external t in db.Task tasks = t Actions message = t.Messages comments = t.TaskComments let's get in to the comments c. Recipients = c.TaskCommentRecipients   

Default IfExty The archive is empty when a default element is produced. Since these are database rows, a default element is a blank line, this is the reason why joining the left is the behavior of the left.

query = (t (one db.Tasks in TkActionskDefaultIfEmpty () m in t.Messages.DefaultIfEmpty) in CkRecipientskDefaultIfEmpty (C) Choose New Initial () {TaskStatus = ??? ...}) Dstinct ();

On one side: After a bunch of joining, separate calling is a crutch. See # 1 if you can do without it. # 2 If not, check that you can terminate any of the worst data that you have to call it. # 3 If not, make a clear call to the entire query in a small circle.

Hope it helps.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -