2012-05-21 3 views
0

이것이 가능합니까?필터링 된 레코드 집합을 포함하십시오.

var results = (from c in _context.properties 
       where c.strap == somevalue 
       select c).include("characteristics).where(characteristics.cat_cd != 'DD'); 

기본적으로이 쿼리를 만들고 싶습니다. 앱이 커짐에 따라 다른 테이블을 포함시킬 것입니다.

select * from properties p,characteristics c 
where 
p.strap = c.strap 
and c.cat_cd <> 'DD' 

답변

0

여기 내가 배운거야.

var results = (from c in _context.properties 
       where c.Characteristics.Any(c=>c.cat_cd == "DD") select c); 
0

당신은 단순히 join 성명을 발표 :

var set = from property in _context.Properties 
      join characteristic in _context.Characteristcs on property.strap equals characteristic.strap 
      select new 
      { 
       Property = property, 
       Characteristic = characteristic 
      } 
+0

하지만 'on' 절을 선언하고 있습니다. 나는 그것을 피하고 EF와 관계를 처리하고 필터를 적용하고 싶습니다. –

관련 문제