Uses TransactionScope to invoke delete operations to re-query the database?

I am using LINQ to SQl and am using TransactionScopre. I am inserting data into SQL.

_context.tblDataContainer.InsertOnSubmit(migrationData);

using (TransactionScope ts = new TransactionScope())
{
    _context.SubmitChanges();
    ts.Complete();
}

      

doing this, linq executes any delete statements in SQL. I checked using the context log and no delete statement is issued to the database, but my db admin says that I am following some delete statements in this transaction. Any views on this?

+1


source to share


1 answer


We really need to know more about your circuit. Remember that L2S is declarative - you state what you want so as not to do so. It is possible that the L2S engine looked at your database, found some type of constraint or other situation, and decided that the best way to safely insert this data is to delete the record first. Although it is stretching, it can happen.



HOWEVER, there are other possibilities, such as triggers. Have you checked that the table is doing an insert and see if there are any triggers on it that might delete data elsewhere?

+1


source







All Articles