c# - Conditional Includes -


i know how can change query:

events = _database.events          .include("contacts")          .tolist(); 

to include contacts having property "type" set "event".

i'm using entityframework, _database context.

firstly, it's worth understanding code posted doesn't include lambda expression @ all. "query not in query expression syntax" isn't same "lambda expression".

i suspect bad idea return event objects partially-filled entity reference set. however, this:

_database.events          .select(e => new { event = e,                             eventcontacts e.contacts                                            .where(c => c.type == "event") }); 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -