static void QueryTheDatabase(ISessionContainer sessionContainer) { //you've got to open the session before we can use it sessionContainer.OpenSession(); //using the opened session from the sessionContainer, we can query the database List<Account> accounts = sessionContainer.Session.Query<Account>().ToList(); accounts.ForEach(x => Console.WriteLine(x.Name)); //afterwards, you need to close the session sessionContainer.CloseSession(); }