c# - Linq To Entities, Select multiple sets of data with one query -
i've found plenty of info on how select multiple result sets stored procedures nothing substantial on how linq query.
for example, can sub-queries return mulitple sets of results like
var query = (from school in context.schools school.id == someid select new { subseta = (from student in context.students select student).tolist(), subsetb = (from building in context.buildings select building).tolist(), }).first(); query.subseta; //access subseta query.subsetb; //access subsetb
which works fine, if want select both subseta , subsetb without querying against school table? want select 2 separate sets of data gets sent server in 1 query.
any information how ef 6 great.
well, i'm sure there many ways this, if want avoid introducing third dbset
mix...
var query = (from s in context.students.take(1) select new { subseta = context.students.tolist(), subsetb = context.buildings.tolist(), })
then, can use query.tolist()
or maybe using query.load()
, working context.students.local
, etc. work.
Comments
Post a Comment