Skip to content

Instantly share code, notes, and snippets.

@jmcd
Created April 19, 2012 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmcd/2419991 to your computer and use it in GitHub Desktop.
Save jmcd/2419991 to your computer and use it in GitHub Desktop.
QueryOver select except
var scheduleDateAlias = default(ScheduleDate);
return session.QueryOver(() => scheduleDateAlias)
.WithSubquery.WhereNotExists(
QueryOver.Of<CommunityGrantApplicationChequeRequest>()
.Where(x => x.ScheduleDate.Id == scheduleDateAlias.Id)
.Select(x => x.ScheduleDate)
)
.OrderBy(scheduleDate => scheduleDate.Rank).Asc
.List<ScheduleDate>();
@jmcd
Copy link
Author

jmcd commented Aug 15, 2013

The trick is to define the alias in the parent query, then reference it in the subquery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment