I am trying to do a group join(GroupJoin) on a couple of fields including a string 'like'.
Let's say Human - {Name, Size, FullAddress} and Item - {OwnerName, City, Size}
let's say I go for a normal join
var result = from h in Human
join it in Item on
h.OwnerName equals it.OwnerName
where h.Size == it.Size ||
h.Address.startsWith(it.City)
select new {human = h, Item = it};
I guess I can pretend that it works and gives all items that belong to a person with the same name and fit them, or are in the same city.
But trying to go for the group join kinda stops me in my tracks:
var result = from h in Human
join it in Item on
h.OwnerName equals it.OwnerName into g
where h.Size == it.Size ||
h.Address.startsWith(it.City)
select new {human = h, Items = g};
ASFAIK it(item) is no longer defined for the 'where' context. If I did not have the 'LIKE%' part(startsWith) I probably would have been able to use the anonymous class helped join(as in this answer/question)
I am trying to figure some compact solution for this, without going back to the not grouped join and grouping them manually.