Reputation: 1273
I have an entity which is updated externally (using triggers, stored procedures). This means the entity can change without my knowledge in the same session, and it is required for me that I always perform a database hit, and never use the entity from the first level cache.
Is this possible using NHibernate (or actually, Castle ActiveRecord)?
Upvotes: 1
Views: 1473
Reputation: 1038720
You cold use a IStatelessSession
instead of ISession
to disable first level cache:
using (ISessionFactory sf = cfg.BuildSessionFactory())
using (IStatelessSession session = sf.OpenStatelessSession())
{
// ...
}
Upvotes: 6