Пример #1
0
        protected override void ExecuteProcedure()
        {
            var disk = VirtualDiskCommon.LoadByMirroring(_diskId);
            var file = VirtualFileCommon.FindById(_fileId, QueryLevel.Mirroring);

            //文件删除后减少虚拟磁盘的大小
            disk.Delete(file);
            VirtualDiskCommon.Update(disk);
        }
        protected override VirtualDirectory ExecuteProcedure()
        {
            var disk      = LoadDisk();
            var directory = BuildDirectory(disk);

            disk.Create(directory);
            VirtualDiskCommon.Update(disk);
            return(directory);
        }
Пример #3
0
        private VirtualDisk LoadDisk()
        {
            VirtualDisk disk = VirtualDiskCommon.FindById(_diskId, QueryLevel.Single);

            if (disk.IsEmpty())
            {
                throw new BusinessException(string.Format(Strings.NotFoundVirtualDisk, _diskId));
            }
            return(disk);
        }
Пример #4
0
        protected override VirtualFile ExecuteProcedure()
        {
            VirtualDirectory directory = GetDirectory();
            VirtualFile      file      = BuildVirtualFile();
            var disk = directory.Disk;

            disk.Create(directory, file);
            VirtualDiskCommon.Update(disk);
            return(file);
        }
        protected override void ExecuteProcedure()
        {
            var disk             = VirtualDiskCommon.LoadByMirroring(_diskId);
            VirtualDirectory dir = VirtualDirectoryCommon.FindById(_dirId, QueryLevel.Mirroring);

            //这里需要测试,dir内部的this.Disk和 disk要是同一个对象,在当前会话里都是同一个镜像
            //if(ReferenceEquals(disk, dir.Disk))
            //{

            //}

            if (dir.IsSystem && !_force)
            {
                throw new BusinessException(Strings.CanNotDeleteSystemDirectory);
            }
            disk.Delete(dir);
            VirtualDiskCommon.Update(disk);
        }