Hi all,
Sometimes I have to replace the content of a complete tabel.
When I try the following, the application seems to be "hanging":
Transaction transactionManager = new Transaction(IsolationLevel.ReadCommitted, "SavepointRollback");
XXXCollection xc = new XXXCollection();
try
{
transactionManager.Add(xc);
sc.DeleteMulti(null);
xxxEntity xe;
int lastEntry = xxxNewCollection.Count();
for (int i = 0; i < lastEntry; i++)
{
xe = new xxxEntity();
xe.Id = xxxNewCollection[i].Id;
..
..
xe.Save();
transactionManager.Add(xe);
}
transactionManager.Commit();
}
catch (Exception)
{
// abort, roll back the transaction
transactionManager.Rollback();
throw;
}
finally
{
// clean up. Necessary action.
transactionManager.Dispose();
}
Id is primary key and also present in the collection of records I try to delete.
Any suggestions? Is there a better way to clear a complete table?
Best regards,
Jan