I have a parent/child table in Entity Framework and I need to select some row from parent based on child primary key.
I write these code:
List<int> s = (from all in DB.TbProfiles
where all.TbMaharat.Any(c => maharat.Contains(c.MaharatId))
select all.ProfileId).ToList();
but I Found that Linq2Entity does not support "Contains", and I must use "MultiSet" and ESQL command. but i can find any sample to do this.
I write ESQL like this but it does not work:
byte[] moshTypes = new byte[] { 1, 2, 3 };
List<int> s = DB.TbProfiles.Where("it.TbMaharat exists(Select 0 from TbMaharat as e where e.MaharatId IN MultiSet (" + string.Join(",", moshTypes) + "))")
.Select(c=>c.ProfileId).ToList();
return s;
Can anyone help me?