Ensure Azure specific IStorageProvider is registered properly

The AzureBlobStorageProvider components must be registered as a
per-lifetime-scope in the "Shell" container, not in the "Host" container.

This is why it must be registered in the "Config/Sites.Config" file instead
of the "Config/Host.config" files.

This also allows us to remove the "AZURE" compilation directive from
Orchard.Framework implementation.

All in all, this ensures that the files stored in the "Media" folder
are stored in the Azure Blob Storage even when running locally in
Visual Studio.

--HG--
branch : dev
extra : transplant_source : %3E%E2%82g%18M%AB%26xi%CA%19%99H%3A%A0%20%F0%B2F
This commit is contained in:
Renaud Paquay
2011-02-19 16:13:23 -08:00
parent 8a0cfa7805
commit 030999dda3
5 changed files with 27 additions and 10 deletions

View File

@@ -53,7 +53,7 @@
<MSBuild
Projects="$(SrcFolder)\Orchard.Azure\Orchard.Azure.sln"
Targets="Build"
Properties="Configuration=Release;OutputPath=$(CompileFolder);PlatformTarget=x64;DefineConstants=AZURE"
Properties="Configuration=Release;OutputPath=$(CompileFolder);PlatformTarget=x64"
/>
<MSBuild

View File

@@ -13,13 +13,7 @@
service="Orchard.Environment.Configuration.IShellSettingsManager">
</component>
<component instance-scope="per-lifetime-scope"
type="Orchard.Azure.FileSystems.Media.AzureBlobStorageProvider, Orchard.Azure"
service="Orchard.FileSystems.Media.IStorageProvider">
</component>
</components>
</autofac>
</configuration>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="autofac" type="Autofac.Configuration.SectionHandler, Autofac.Configuration"/>
</configSections>
<autofac defaultAssembly="Orchard.Framework">
<components>
<component instance-scope="per-lifetime-scope"
type="Orchard.Azure.FileSystems.Media.AzureBlobStorageProvider, Orchard.Azure"
service="Orchard.FileSystems.Media.IStorageProvider">
</component>
</components>
</autofac>
</configuration>

View File

@@ -316,6 +316,11 @@
<ItemGroup>
<Content Include="Config\log4net.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Config\Sites.config">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -1,5 +1,4 @@
#if !AZURE
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -394,4 +393,3 @@ namespace Orchard.FileSystems.Media {
}
}
}
#endif