Remove IAppDataFolder implementation for Azure

We don't need this. Azure supports writing tp ~/App_Data. There is no
guarantee that the content will persist, but that's exactly the assumption
of the IAppDataFolder abstraction: it's a local cache, which persists
for _some_ time accross app restarts.

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-06-16 15:44:53 -07:00
parent ed410cba61
commit c4bc2a1375
4 changed files with 3 additions and 76 deletions

View File

@@ -1,11 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Web;
using Microsoft.WindowsAzure; using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime; using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.StorageClient; using Microsoft.WindowsAzure.StorageClient;
using System.IO;
using Orchard.FileSystems.Media; using Orchard.FileSystems.Media;
namespace Orchard.Azure { namespace Orchard.Azure {

View File

@@ -2,14 +2,13 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Web;
using System.Yaml.Serialization; using System.Yaml.Serialization;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime; using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.StorageClient; using Microsoft.WindowsAzure.StorageClient;
using Orchard.Localization;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
using Microsoft.WindowsAzure; using Orchard.Localization;
namespace Orchard.Azure.Environment.Configuration { namespace Orchard.Azure.Environment.Configuration {

View File

@@ -1,70 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Orchard.Environment.Configuration;
using Orchard.FileSystems.AppData;
namespace Orchard.Azure.FileSystems.AppData {
public class AzureAppDataFolder : IAppDataFolder {
private readonly AzureFileSystem _fs;
public AzureAppDataFolder() {
_fs = new AzureFileSystem("appdata", null, true);
}
public void CreateFile(string path, string content) {
using ( new HttpContextWeaver() ) {
if (_fs.FileExists(path)) {
DeleteFile(path);
}
using (var stream = _fs.CreateFile(path).OpenWrite()) {
using (var writer = new StreamWriter(stream)) {
writer.Write(content);
}
}
}
}
public string ReadFile(string path) {
using ( new HttpContextWeaver() ) {
using (var stream = _fs.GetFile(path).OpenRead()) {
using (var reader = new StreamReader(stream)) {
return reader.ReadToEnd();
}
}
}
}
public void DeleteFile(string path) {
_fs.DeleteFile(path);
}
public bool FileExists(string path) {
return _fs.FileExists(path);
}
public IEnumerable<string> ListFiles(string path) {
return _fs.ListFiles(path).Select(sf => sf.GetPath());
}
public IEnumerable<string> ListDirectories(string path) {
return _fs.ListFolders(path).Select(sf => sf.GetName());
}
public string CreateDirectory(string path) {
_fs.CreateFolder(path);
return Path.GetDirectoryName(path);
}
public void SetBasePath(string basePath) {
throw new NotImplementedException();
}
public string MapPath(string path) {
throw new NotImplementedException();
}
}
}

View File

@@ -76,7 +76,6 @@
<ItemGroup> <ItemGroup>
<Compile Include="CloudBlobContainerExtensions.cs" /> <Compile Include="CloudBlobContainerExtensions.cs" />
<Compile Include="HttpContextWeaver.cs" /> <Compile Include="HttpContextWeaver.cs" />
<Compile Include="FileSystems\AppData\AzureAppDataFolder.cs" />
<Compile Include="Environment\Configuration\AzureShellSettingsManager.cs" /> <Compile Include="Environment\Configuration\AzureShellSettingsManager.cs" />
<Compile Include="FileSystems\Media\AzureBlobStorageProvider.cs" /> <Compile Include="FileSystems\Media\AzureBlobStorageProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />