Reputation: 1701
Is there a way to check if an entity is allready in the cache of NHB (no 2nd level cache enabled) when only the database primary key/Id is known, without hitting the DB as one would if using Get?
In short something down the lines of:
_session.ExistsInCache()
Kind regards
Upvotes: 0
Views: 52
Reputation: 52745
This is one way...
var exists = NHibernateUtil.IsInitialized(Session.Load<YourClass>(id));
Upvotes: 2