代碼: 選擇全部
using (var transaction = (new YourEntities()).Connection.BeginTransaction())
{
//....
transaction.Commit();
transaction.Rollback();
}