Beispiel #1
0
        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();
                }
            };
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public CopyTemporaryFileResult CopyTemporaryFile(string dbTemporaryFile, Int64 entityId, FilesToDelete filesToDelete)
        {
            var result = CopyTemporaryFile(dbTemporaryFile, entityId);

            filesToDelete.Register(result);
            return(result);
        }