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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -