public void MysqlExecute() { MyDapperPower.DbConnection("server=localhost;port=3306;user id=root;password=Aa82078542;database=testmysql;SslMode=none", "mysql", "mysql"); UserLocalDAL userLocalDAL = new UserLocalDAL(); var commandText = $"update {EntityHelper.CallName<UserLocal>()} set status = 7 where id > 30"; var result = userLocalDAL.Execute(commandText, null); }
public void MysqlExecuteTra() { MyDapperPower.DbConnection("server=localhost;port=3306;user id=root;password=Aa82078542;database=testmysql;SslMode=none", "mysql", "mysql"); UserLocalDAL userLocalDAL = new UserLocalDAL(); var commandText = $"update {EntityHelper.CallName<UserLocal>()} set status = 7 where id > 30"; using (var transactionScope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { using (var connection = userLocalDAL.Connection) { var result = userLocalDAL.Execute(connection, commandText, null); } } }