質問

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