c# - What is the right and efficient way to retrieve data using Entity Framework 6 -
i have 2 tables:
t1 { columns: **a**, b, c } t2 { columns: d, e, f, **a** }
t1
has 1 many connection t2
using foreign key (column a).
i'm trying retrieve list of f
in case a=1,b=2,e=3
.
what right , efficient way retrieve data?
- is join statement?
- is retrieving
t1 (where a=1,b=2)
includingt2
, looping on result (and eliminate irrelevantt2
)? - some other way?
var lst = (from t1 in context.t1 join t2 in context.t2 on t1.a equals t2.a t1.a == 1 && t1.b == 2 && t2.e == 3 select t2.f).tolist();
- join tables
- filter in clause
- select 1 property interested in
Comments
Post a Comment