I’m building an internal IT inventory application in LightSwitch, and have been trying to add a screen that only shows software in the inventory that has not been assigned to hardware.
Lightswitch doesn’t allow the graphical query editor to select the “many” side of a relationship on a filter (as documented here), so this is something that must be done in code.
I struggled for a bit trying to make a Left Outer Join in Linq between my two entities, but eventually stumbled upon a post by the always helpful Yann Duran:
What I needed was the C# syntax for his suggestion, which is reproduced here with my relevant entity name:
query = query.Where((a) => a.itinv_SoftwareAssignedHardwares.Any() == false);
This is created within a query on the itinv_Software entity.