public static void RegisterFilesToDelete(IUnitOfWork unitOfWork, FilesToDelete filesToDelete) { unitOfWork.OnCommit += delegate() { try { filesToDelete.KeepNewFiles(); filesToDelete.Dispose(); } catch (Exception ex) { ex.Log(); } }; unitOfWork.OnRollback += delegate() { try { filesToDelete.Dispose(); } catch (Exception ex) { ex.Log(); } }; }
public CopyTemporaryFileResult CopyTemporaryFile(string dbTemporaryFile, object entityId, FilesToDelete filesToDelete, Func <string, string> fileNameReplacer = null) { var result = CopyTemporaryFile(dbTemporaryFile, entityId, fileNameReplacer); filesToDelete.Register(result); return(result); }
public CopyTemporaryFileResult CopyTemporaryFile(string dbTemporaryFile, Int64 entityId, FilesToDelete filesToDelete) { var result = CopyTemporaryFile(dbTemporaryFile, entityId); filesToDelete.Register(result); return(result); }