Consider a typical NHibernate context class.
public class SampleContext : NHibernateContext
{
public SampleContext(ISession session)
: base(session)
{ }
public IQueryable<Person> People
{
get { return Session.Linq<Person>(); }
}
public Person GetPerson(int id)
{
get { return Session.Linq<Person>().SingleOrDefault(p => p.ID == id); }
}
}
My question:
- How could I rewrite the GetPerson method to ignore the cache and retrieve data directly from the database?