Created
January 25, 2014 15:36
-
-
Save grishin/8618159 to your computer and use it in GitHub Desktop.
How to JOIN multiple tables with multiple ON conditions in LINQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from project in _db.Projects | |
| join typeOfficial in _db.GuidContents on (short?)project.TypeOfficial equals typeOfficial.Value into TtypeOfficial | |
| from typeOfficial in TtypeOfficial.DefaultIfEmpty() | |
| where typeOfficial.Guid == 1 | |
| join typePanel in _db.GuidContents on (short?)project.TypePanel equals typePanel.Value into TtypePanel | |
| from typePanel in TtypePanel.DefaultIfEmpty() | |
| where typePanel.Guid == 2 | |
| join status in _db.GuidContents on (short?)project.StatusId equals status.Value into TStatus | |
| from status in TStatus.DefaultIfEmpty() | |
| where status.Guid == 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment