I would like to know how I can change this query:
events = _database.Events
.Include("Contacts")
.ToList();
To include only contacts having their property “Type” set to “event”.
I’m using EntityFramework, _database is its context.
Firstly, it’s worth understanding that the code you posted doesn’t include a lambda expression at all. “Query not in query expression syntax” isn’t the same as “lambda expression”.
I suspect it would be a bad idea to return event objects with a partially-filled entity reference set. However, you could do this: