in stead of IEnumerable
, use IQueryable
...
public IQueryable<Session> Sessions()
...etc.
This enables any expression that's appended after the method call to be translated into SQL. When you expose IEnumerable
the connection with the original query provider is cut.