title: Linq query for multiple join tables in C#
body: <p>In my application, I have to write a query that displays data from a number of the tables. In other words, I have to create a query that will make a join for number of tables and will show wanted information from this query.
  The query has to display all the events (and all data about the events in <code>DataGrid</code>) for a specific (chosen) worker.</p>
  
  <p>Here is a code of my LINQ:</p>
  
  <pre><code>IList dataList = (from dWorker in App.glidusContext.tbl_workers
        where dWorker.workerTZ == strSplit
        join d2 in App.glidusContext.tbl_workers_has_tbl_events
        on dWorker.workerID equals d2.workerID
        join dEvent in App.glidusContext.tbl_events
        on d2.eventID equals dEvent.eventID
        join dAct in App.glidusContext.tbl_activities
        on d2.eventID equals dAct.eventID
        select new { d2.damagedVacantionEnd, dEvent, dAct }).ToList();
  
  return dataList;
  </code></pre>
  
  <p>Where strSplit is a specific (chosen) worker.</p>
  
  <p>XAML-code of <code>DataGrid</code>:</p>
  
  <pre><code>&lt;DataGrid.Columns&gt;
   &lt;DataGridTextColumn Header="{x:Static res:Resources.WinSafetyByEmployee_DataGrid_ColHead_Event_type}"
        Width="130"
        IsReadOnly="True"
        Binding="{Binding Path=dEvent.tbl_eventsType.eventTypeName}" /&gt;
       &lt;DataGridTextColumn Header="{x:Static res:Resources.WinSafetyByEmployee_DataGrid_ColHead_Classification}"
         Width="130"
         Binding="{Binding Path=dEvent.tbl_eventsClassification.eventClassificationName}" /&gt;
   &lt;DataGridTextColumn Header="{x:Static res:Resources.WinSafetyByEmployee_DataGrid_ColHead_Catagory}"
        Width="130"
        Binding="{Binding Path=dEvent.tbl_eventsCategories.eventCategoryName}" /&gt;
   &lt;DataGridTextColumn Header="{x:Static res:Resources.WinSafetyByEmployee_DataGrid_ColHead_Evacuation}"
        Width="130"
        Binding="{Binding Path=d2.damagedEvacuationDescription}" /&gt;
   &lt;DataGridTextColumn Header="{x:Static res:Resources.WinSafetyByEmployee_DataGrid_ColHead_EvacuationStart}"
        Width="130"
        Binding="{Binding Path=d2.damagedVacantionStart}" /&gt;
   &lt;DataGridTextColumn Header="{x:Static res:Resources.WinSafetyByEmployee_DataGrid_ColHead_EvacuationEnd}"
        Width="130"
        Binding="{Binding Path=d2.damagedVacantionEnd}" /&gt;
   &lt;DataGridTextColumn Header="{x:Static res:Resources.WinSafetyByEmployee_DataGrid_ColHead_ActivityName}"
        Width="*"
        Binding="{Binding Path=dAct.activityName}" /&gt;
  &lt;/DataGrid.Columns&gt;
  </code></pre>
  
  <p></p>
  
  <p>Please, help how to fix this query, now this variant doesn't return values.</p>
  
  <p>I also cannot reach tbl_objects in the query because I need to do it thought the connection table <code>tbl_object_has_tbl_events</code> and <code>App.glidus</code> do not show such a table.</p>
  
  <p>Here is an ERD of my database:</p>
  
  <p><img src="https://i.stack.imgur.com/9ISaE.png" alt="DB ERD"></p>