does this raw sql only one trip to the database or many trips?
Posted
by
Álvaro García
on Stack Overflow
See other posts from Stack Overflow
or by Álvaro García
Published on 2014-06-01T09:16:42Z
Indexed on
2014/06/01
9:25 UTC
Read the original article
Hit count: 196
I gues that I have this sql:
string strTSQL = "Begin TRAN delete from MyTable where ID = 1";
string strTSQL = ";delete from MyTable where ID = 2";
string strTSQL = ";delete from MyTable where ID = 3 COMMIT";
using(Entities dbContext = new Entities())
{
dbCntext.MyTable.SQLQuery(strTSQL);
}
This use a transaction in the dataBase, so all the commands are executed or no one. But how I execute it through EF, it does only one trip to the database or many?
Thanks.
© Stack Overflow or respective owner