为什么下面这段代码中的Persist方法,每次都立即在SQL Server中执行Insert语句?
我用的是Nhibernate3.2
[TestMethod]
public void oneToManyTest()
{
Customer c1 = _session.Get<Customer>(1);;
for (int i = 0; i < 13; i++)
{
Order o = new Order() { Customer = c1, OrderDate = DateTime.Now};
c1.Orders.Add(o);
_session.Persist(o);
}
_session.Flush();
}
慕丝7291255
一只甜甜圈
相关分类