5

Is it possible to set the LockMode when using NHibernate.Linq? When using ICriteria I can this way:

var criteria = Session.CreateCriteria<Foo>();
criteria.SetLockMode(LockMode.None);
criteria.Add(Expression.Eq("Title", title));

Is it possible to build that same query using Nhibernate.Linq?

mxmissile
  • 11,464
  • 3
  • 53
  • 79

2 Answers2

2

I don't think so... I just grepped through the NHibernate.Linq source code and its tests and found no reference to LockMode.

Mauricio Scheffer
  • 98,863
  • 23
  • 192
  • 275
2

You can still achieve the lock on entity using Session.Lock(entity,LockMode.read)

Thanks

Thanigainathan
  • 1,505
  • 14
  • 25
  • 2
    I never understood this way of locking. The entity has already been selected and materialized. Someone could have selected it from db before we got a chance to call Session.Lock right? – Mattias Nordqvist Oct 28 '15 at 19:36