How can i do something like this
Session
.CreateQuery("delete from People where People.Id in (:idList)")
.SetParameter("idList", idList)
.ExecuteUpdate()
but without HQL?
You can do this:
foreach(var item in idList)
{
Session.Delete(Session.Load<People>(item));
}
and to improve performance of this set batch size to 20 like this in configurations:
<property name="adonet.batch_size">20</property>
this behavior existing by default in Nhibernate 3.2
As far as I know there is no Fluent Nhibernate syntax for deleting entities. I also used HQL (or even SQL) when I wanted to delete.
There is an example here that might do what you need. It is one of the overloads of session.Delete
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.