public Task <DomainModel.Directory> LoadAsync(string id) { var directoryContext = new DirectoryContext(id); directoryContext.DemandAccess(); var files = directoryContext.GetFiles() .Select(file => new DomainModel.File(file.Name, new FileContentLoadingPolicy(file.Path))) .ToArray(); return(Task.FromResult(new DomainModel.Directory(id, files))); }
public async Task SaveAsync(DomainModel.Directory directory) { var directoryContext = new DirectoryContext(directory.Id); directoryContext.DemandAccess(); foreach (var file in directory.GetNewFiles()) { directoryContext.CreateFile(file.Name, file.Content); } directory.Commit(); await Task.Yield(); }