Castle ActiveRecord学习(八)事务

代码:

public void UpdateThemeInfo(int id)
{
//事务
using (TransactionScope ctran = new TransactionScope())
{
try
{
Models.ThemeInfo model = Models.ThemeInfo.Find(id);
if (model != null)
{
model.CreatDate = DateTime.Now;
model.Subject = "修改测试" + id;
model.Text = "修改测试内容" + id;
}
model.Update();
ctran.VoteCommit();
}
catch (Exception)
{
ctran.VoteRollBack();
}
}
}

  

上一篇:Castle ActiveRecord学习(五)使用HQL语句查询


下一篇:CSS3 Gradient 渐变