Suppose I have the following two tables
Tables A, B, and C have a logical column called "IsEnabled".
Between the tables there is a ratio from 1 to several:
I am using the Entity framework to query a table, and programming in C #. Suppose I need all the columns in A, I do the following:
var query = _context.A; query.where( <where clause> )
If I need to include columns B to prevent lazy loading,
query.Include ( s => sB );
The question is, how to include B columns by adding a where clause to select only rows with IsEnabled = 1? I am looking for something like:
query.Include ( s => sBwhere ( k => k.IsEnabled = 1 ))
(This does not work and throws an exception at runtime)
If we can get the above question, I want to include C columns too rows that IsEnabled = 1 for B and C. Is this possible?
source share