コード例 #1
0
        public void CreateDirectory(FileSystemCreateDirectoryOptions options)
        {
            string path    = GetFileItemPath(options.ParentDirectory);
            string blobKey = $"{options.DirectoryName}/{EmptyDirectoryDummyBlobName}";

            if (!string.IsNullOrEmpty(path))
            {
                blobKey = $"{path}/{blobKey}";
            }
            CloudBlockBlob dirBlob = Container.GetBlockBlobReference(blobKey);

            dirBlob.UploadText("");
        }
コード例 #2
0
        public void CreateDirectory(FileSystemCreateDirectoryOptions options)
        {
            var parentDirectory = options.ParentDirectory;

            if (!IsFileItemExists(parentDirectory))
            {
                ThrowItemNotFoundException(parentDirectory);
            }

            var directory = new FileItem {
                Name         = options.DirectoryName,
                Modified     = DateTime.Now,
                Created      = DateTime.Now,
                IsDirectory  = true,
                ParentId     = ParseKey(parentDirectory.Key),
                ModifiedById = GuestPersonId
            };

            FileManagementDbContext.FileItems.Add(directory);
            FileManagementDbContext.SaveChanges();
        }