3
我想我知道这个问题的答案可能会是什么,但我想我会继续问它。使用Criteria API删除NHibernate集合使用Criteria API
看来,内NHibernate的,如果我做这样的事情:
IList<Customer> customers = Session.CreateCriteria(typeof(Customer))
.Add(Restrictions.Eq("Name", "Steve")
.List<Customer>();
而且我想,然后删除客户该列表。从我可以告诉只有这样,才能做到这一点是这样的:
foreach(var customer in customers)
{
Session.Delete(customer);
}
但我不知道是如果有什么办法,我可以去:
Session.Delete(customers);
并删除整个集合只需一个电话?