I'm doing string based Dynamic Linq and need to apply a nested where clause.
The answer here gets me half way there. However, the columns in two tables have matching ids. I need to be able to reference via an alias or other, like below:
rolesCollection
.Where("AssignedUsers.Where(AssignedUsers.TypId == rolesCollection.TypId).Any()");
Any idea how to accomplish this? I don't have the ability to pass in an object, this has to be purely a string based solution in the context of a genericized API search method. This is just an example of what I need ... I don't have the ability to join or anything via code. I'm looking for the solution in the string based portion of the example code.
The AssignedUsers object should, in this theoretical example, have an AssignedUsers_Typ collection, and you can simply reference below, without having to reference the Typ columns from both tables.
rolesCollection.Where("AssignedUsers_Typ.Any()");
I was able to resolve my issue using this solution.
Do you want something like that;
rolesCollection = rolesCollection.Where(x => assignedUsers.Any(t => t.TypId == x.TypId)).ToList();