/// <summary>
/// Marks orphaned file records (the ones that do not have a referencing binary record anymore) as Deleted.
/// </summary>
public void CleanupFilesSetDeleteFlag()
{
var isLocalTransaction = false;
if (!TransactionScope.IsActive)
{
TransactionScope.Begin();
isLocalTransaction = true;
}
try
{
using (var proc = new SqlProcedure {
CommandText = CleanupFileSetIsdeletedScript, CommandType = CommandType.Text
})
{
proc.CommandType = CommandType.Text;
proc.ExecuteNonQuery();
}
if (isLocalTransaction && TransactionScope.IsActive)
{
TransactionScope.Commit();
}
}
catch (Exception ex)
{
if (isLocalTransaction && TransactionScope.IsActive)
{
TransactionScope.Rollback();
}
throw new DataException("Error during setting deleted flag on files.", ex);
}
}