Simple question: can NHibernate save a collection without an iterator? For example:
var list = new List<Item>();
list.Add(1000 items);
session.Save(list);
Or do I have to do foreach
over the list?
Simple question: can NHibernate save a collection without an iterator? For example:
var list = new List<Item>();
list.Add(1000 items);
session.Save(list);
Or do I have to do foreach
over the list?
Simple question - simple answer. AFAIK no - you have to iterate. In fact it is faster if you keep flushing and clearing the session time after time like it is told in the NHibernate Docs about batch processing:
for(int i=0;i<list.count;i++)
{
session.Save(list[i])
if(i % 20 == 0)
{
session.Flush();
session.Clear()
}
}