문제

is it possible to write such a query via linq in BlToolkit?

SELECT  * FROM X pd
WHERE EXISTS (SELECT 1 FROM Y mm
WHERE VersionMaster > 0 
)

I mean - is it possible to write an 'Exists' construct in linq so the BlToolkit would understand it?

thanks

도움이 되었습니까?

해결책

Method Any() is the equivalent of exists in the sql. It is used as following.

var query = (from pd in db.TableX
    where (from mm in db.TableY where mm.VersionNUmber > 0).Any()
    select pd);

or

var query = (from pd in db.TableX
    where db.TableY.Any( mm => mm.VersionNUmber > 0 )
    select pd);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top