using (var session = _databaseLink.CreateSession())
{
using (var transation = session.BeginTransaction())
{
foreach (var amsShipMotionBand in amsShipMotionBands)
{
session.Save(amsShipMotionBand);
}
transation.Commit();
}
}
给定一个简单的for循环和序列化到数据库,是在一个紧凑的循环坏练习中使用session.Save?有替代品吗?或者它是懒惰的,只在提交/会话结束时完成?