mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 10:07:55 +08:00
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:
@@ -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
|
||||
|
@@ -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>
|
||||
|
||||
|
20
src/Orchard.Azure/Orchard.Azure.Web/Config/Sites.config
Normal file
20
src/Orchard.Azure/Orchard.Azure.Web/Config/Sites.config
Normal 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>
|
||||
|
@@ -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.
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user