Update
In NHibernate 5.0 the following functionality has been added: Modifying entities inside the database , which implements something similar to the one searched for in this question: Updating entities , which would be the possibility of an implementation similar to this:
using NHibernate.Linq;
...
session.Query<Cat>()
.Where(c => c.BodyWeight > 20)
.UpdateBuilder()
.Set(c => c.BodyWeight, 20)
.Update();
That would be equivalent to a SQL like:
UPDATE Cat
SET BodyWeight = 20
WHERE BodyWeight > 20;
I think I know the answer you want to read:
With LINQ something in that idea:
// Atenção isso não existe
(from entity in db.Registro update entity.Flag = 1 where entity.Id = 1).Apply();
Or with Lambda something like this:
// Atenção isso também não existe
db.Registro.Where(t => t.Id = 1).Update(t => t.Flag = 1);
But unfortunately I have bad news for you:
These approaches "still" do not exist, so I recommend following the answers already exist (the most complete one in my opinion is @ HarryPotter )
I've also looked for a similar approach to yours with NHibernate,
p>
Maybe in the near future, something that will allow it to be incorporated into LINQ, LAMBDA and ORMs. But for now the answer is no, there is no way.
In SOEN, there are also posts talking about it, here , with good approaches.