1

Topic: [LINQ] field Check in a subset

Let we have two essences (DB) connected among themselves.




    public class Foo 
    { 
        public string Id; 
        public bool Test; 
        public IList <Bar> Bars; 
    }

    public class Bar 
    { 
        public string FooId; 
        public bool Test; 
    }


The task - to select those records from essence Foo, at which Test == true, or from child essence Bar at them Test == true. How it to make LINQ expression? Something of type such:



session. Linq <Foo> ().Where (x => X. Test) || X. Bars. Test)) 


As far as I understand, function introduction in Foo does not help as in Linq expression it is impossible to cause functions which cannot be transformed to SQL truly?

2

Re: [LINQ] field Check in a subset

Hello, the Anonymous author, you wrote:

The Task  to select those records from essence Foo, at which Test == true,
or from child essence Bar at them Test == true.


At all child Bar "Test == true"



session. Linq <Foo> ().Where (x = X. Test X. Bars. All (b => b. Test)) 



Or at least at one?



session. Linq <Foo> ().Where (x = X. Test X. Bars. Any (b => b. Test))