我正在为我的 webmatrix 项目编写代码,其中应用了事务提交和回滚。我正在使用 mysql 5.1 和 innodb 数据库引擎来支持事务。
我用
db.Connection.BeginTransaction();
try
{
db.Execute("Insert into tmp_upload_img(`path`,`type`) values(@0)", FullPath,"Fullimage");
db.Execute("Insert into tmp_upload_img(`path`,`type`) values(@0)", ThumbPath, "Thumbimage");
db.Execute("Insert into tmp_upload_img(`path`,`type`) values(@0)", SmallPath, "Smallimage");
db.Connection.BeginTransaction().Commit();
}
catch
{
db.Connection.BeginTransaction().Rollback();
}
但是我没有实现对 webmatrix 项目的事务支持。
我知道这可以通过mysql.data.mysqlclient实现,但我想知道webmatrix.data类可以实现吗?