I think that the reason that he wants to save a list is that he expects the operation to be in a transaction. If one of the items in the list fail then none should be saved.
You cannot do that but you can easily create a helper method:
Code:
public static class Helper
{
public static void SaveList(ISession session, IList list)
{
session.Transaction.Begin();
foreach(object o in list) session.Save(o);
session.Transaction.Commit();
}
}
ISession session;
IList myList;
...
Helper.SaveList(session, myList);
Or is you have .net 3.0 via extension methods:
Code:
public static class Helper
{
public static void SaveList(this ISession session, IList list)
{
session.Transaction.Begin();
foreach(object o in list) session.Save(o);
session.Transaction.Commit();
}
}
ISession session;
IList myList;
...
session.SaveList(myList);