c# - Translate query with operator 'IN' in Linq -
select * enfants enfants.id in ( select enfantparents.enfant_id enfantparents enfantparents.parent_id in ( select parents.id parents parents.id in ( select reservations.parentid reservations reservations.crecheid = 1 ) ) )
the enfantparents hidden table.
i have enfants *-----*
parents 1-----*
reservations
thank .
the enfantparents hidden table
from above assume using ef auto "link" table, enfant
entity has parents
navigation property , parent
entity has reservations
navigation property.
then can achieve same result sql query linq query this:
var query = db.enfants .where(e => e.parents.selectmany(p => p.reservations).any(r => r.crecheid == 1));
Comments
Post a Comment