Hi,,
I am doing (inside a commited transacton)
var x = session.Load<SomeRoot>(12);
session.Delete(x);
and I am seeing a SELECT ….WHERE Id=12 from the Load. I thought Load would give me a proxy, and then only a DELETE would result. But NHProf is showing both a SELECT and then a DELETE
Kind regards
Maxild
Good question…Yes
I am not following, maybe my ignorance
If its lazy, shouldn’t Load give me a proxy, always?
If I am only doing s.Delete(s.Load(12)), shouldn’t only a delete (for perf reasons) be performed by NH?
/Morten
“No, if it isn't lazy”
It is lazy, I want Load to give me proxy. I have now verified the correct behaviour using NHProf, thanks.
”As for s.Delete(s.Load(12)); NH would load the data anyway, even if the class is lazy, to handle cascades.”
Makes sense for entities with associations to other entities controlled by cascade options, but what if the entity doesn’t have associations, or the associations doesn’t cascade?
In my small investigation the Delete(Load)-statement would generate a SELECT even if the entity had no associations.
P.S.
Maybe this thread is for the nhusers list?
I moved it there