I would recommend
var workshopItemsDueSoon = Session.QueryOver<WorkshopItem>() .Where(w => w.DateDue <= twoWeeksTime) var allTodos = Session.QueryOver<ToDo>();
Instead
var allTodos = Session.QueryOver<ToDo>().List(); var workshopItemsDueSoon = Session.QueryOver<WorkshopItem>() .Where(w => w.DateDue <= twoWeeksTime).List();
So that the collection is not repeated until you need it.
I found it useful to use linq extension methods to make subqueries more readable and less inconvenient.
For instance:
var matches = from wsi in workshopItemsDueSoon where !allTodos.Select(it=>it.TaskName).Contains(wsi.Name) select wsi
Personally, since the request is quite simple, I would prefer to do it like this:
var matches = workshopItemsDueSoon.Where(wsi => !allTodos.Select(it => it.TaskName).Contains(wsi.Name))
The latter seems to me less detailed.
source share