Entity Framework 4 Linq help - Pulling data from multiple tables filtered -
not sure how done, have .edmx set navigation properties match foreign key relationships on tables. not sure if still need perform joins or if ef give me access related table data through navigational properties automatically.
what need contentsections , associated contentitems based on contentview , filtered diversionprogram.crimenumber.
i ienumerable, each contentsection should have access it's contentitems via navigation property contentitems
thanks
something like:
using(entities context = new entities()) { ienumerable<contentsection> enumerator = context.contentsections .include("contentitems") .where<contentsection>(cs => cs.contentview.contentviewid == someid && cs.contentitems.where<contentitem>(ci => ci.diversionprogram.crimenumber == somecrimenumber)) .asenumerable<contentsection> }
i've interpreted
based on contentview
as cs.contentview.contentviewid == someid
this give contentsections given contentview. , interpreted
filtered diversionprogram.crimenumber
as cs.contentitems.where<contentitem>(ci => ci.diversionprogram.crimenumber == somecrimenumber)
which give contentitems have specific crimenumber.
or did mean else based on / filtered by. maybe orderby, or contentsections of it's contentitems have crimenumber?
Comments
Post a Comment