diff --git a/src/Orchard.Azure/Orchard.Azure.CloudService/Orchard.Azure.CloudService.ccproj b/src/Orchard.Azure/Orchard.Azure.CloudService/Orchard.Azure.CloudService.ccproj index bb2fb1472..f6a78f8c1 100644 --- a/src/Orchard.Azure/Orchard.Azure.CloudService/Orchard.Azure.CloudService.ccproj +++ b/src/Orchard.Azure/Orchard.Azure.CloudService/Orchard.Azure.CloudService.ccproj @@ -52,7 +52,7 @@ - + Content diff --git a/src/Orchard.Azure/Orchard.Azure.CloudService/Orchard.Azure.WebContent/Bin/Startup/ConfigureIIS.cmd b/src/Orchard.Azure/Orchard.Azure.CloudService/Orchard.Azure.WebContent/Bin/Startup/ConfigureIIS.cmd deleted file mode 100644 index 2128c2a8d..000000000 --- a/src/Orchard.Azure/Orchard.Azure.CloudService/Orchard.Azure.WebContent/Bin/Startup/ConfigureIIS.cmd +++ /dev/null @@ -1,5 +0,0 @@ -REM Check if this task is running on the compute emulator, if not then sets the Idle Timeout to zero - -IF "%ComputeEmulatorRunning%" == "false" ( - %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00 -) \ No newline at end of file diff --git a/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceConfiguration.cscfg b/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceConfiguration.cscfg index 23fe3b2af..5c0a834cc 100644 --- a/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceConfiguration.cscfg +++ b/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceConfiguration.cscfg @@ -3,8 +3,13 @@ - + + + + + + \ No newline at end of file diff --git a/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceDefinition.csdef b/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceDefinition.csdef index 1f8e20000..4cc7c05ca 100644 --- a/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceDefinition.csdef +++ b/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceDefinition.csdef @@ -10,25 +10,28 @@ + - + + - + + in the compute emulator or in the cloud. --> + + + \ No newline at end of file diff --git a/src/Orchard.Azure/Orchard.Azure.Web/Web.config b/src/Orchard.Azure/Orchard.Azure.Web/Web.config index dc1339c5d..6bedcf450 100644 --- a/src/Orchard.Azure/Orchard.Azure.Web/Web.config +++ b/src/Orchard.Azure/Orchard.Azure.Web/Web.config @@ -36,11 +36,11 @@ To use the in-role flavor of Windows Azure Caching, set {CacheHostIdentifier} to be the cache cluster role name. To use the Windows Azure Caching Service, set {CacheHostIdentifier} to be the endpoint of the cache cluster. --> - + @@ -102,11 +102,11 @@ - + diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Constants.cs b/src/Orchard.Web/Modules/Orchard.Azure/Constants.cs new file mode 100644 index 000000000..ee7b70d2f --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Azure/Constants.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Orchard.Azure { + + public class Constants { + public const string ShellSettingsStorageConnectionStringSettingName = "Orchard.Settings.StorageConnectionString"; + public const string ShellSettingsContainerName = "sites"; // Container names must be lower case. + public const string ShellSettingsFileName = "Settings.txt"; + + public const string MediaStorageFeatureName = "Orchard.Azure"; + public const string MediaStorageStorageConnectionStringSettingName = "Orchard.Media.StorageConnectionString"; + public const string MediaStorageContainerName = "media"; // Container names must be lower case. + + public const string OutputCacheFeatureName = "Orchard.Azure.OutputCache"; + public const string OutputCacheHostIdentifierSettingName = "Azure.OutputCache.HostIdentifier"; + public const string OutputCacheCacheNameSettingName = "Azure.OutputCache.CacheName"; + public const string OutputCacheIsSharedCachingSettingName = "Azure.OutputCache.IsSharedCaching"; + + public const string DatabaseCacheFeatureName = "Orchard.Azure.DatabaseCache"; + public const string DatabaseCacheHostIdentifierSettingName = "Azure.DatabaseCache.HostIdentifier"; + public const string DatabaseCacheCacheNameSettingName = "Azure.DatabaseCache.CacheName"; + public const string DatabaseCacheIsSharedCachingSettingName = "Azure.DatabaseCache.IsSharedCaching"; + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Module.txt b/src/Orchard.Web/Modules/Orchard.Azure/Module.txt index 2b07e2a1c..0bcfb4af8 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Azure/Module.txt @@ -1,4 +1,4 @@ -Name: Orchard.Azure +Name: Azure AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net @@ -6,6 +6,10 @@ Version: 1.0 OrchardVersion: 1.7 Description: Provides a set of Orchard service implementations targeting Windows Azure services. Features: + Orchard.Azure: + Name: Windows Azure Media Storage + Description: Activates an Orchard media storage provider that targets Windows Azure Blob Storage. + Category: Hosting Orchard.Azure.OutputCache: Name: Windows Azure Output Cache Description: Activates an Orchard output cache provider that targets Windows Azure Cache. @@ -15,7 +19,3 @@ Features: Name: Windows Azure Database Cache Description: Activates an NHibernate second-level cache provider that targets Windows Azure Cache. Category: Performance - Orchard.Azure.MediaStorage: - Name: Windows Azure Media Storage - Description: Activates an Orchard media storage provider that targets Windows Azure Blob Storage. - Category: Hosting \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Orchard.Azure.csproj b/src/Orchard.Web/Modules/Orchard.Azure/Orchard.Azure.csproj index b8c130361..c315135ee 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Orchard.Azure.csproj +++ b/src/Orchard.Web/Modules/Orchard.Azure/Orchard.Azure.csproj @@ -102,6 +102,7 @@ + @@ -112,6 +113,7 @@ + diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/Caching/Database/AzureCacheConfiguration.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/Caching/Database/AzureCacheConfiguration.cs index 9399036d8..2d51e8b60 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Services/Caching/Database/AzureCacheConfiguration.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/Caching/Database/AzureCacheConfiguration.cs @@ -7,7 +7,7 @@ using Orchard.Logging; namespace Orchard.Azure.Services.Caching.Database { - [OrchardFeature("Orchard.Azure.DatabaseCache")] + [OrchardFeature(Constants.DatabaseCacheFeatureName)] [OrchardSuppressDependency("Orchard.Data.DefaultDatabaseCacheConfiguration")] public class AzureCacheConfiguration : Component, IDatabaseCacheConfiguration { @@ -18,8 +18,8 @@ namespace Orchard.Azure.Services.Caching.Database { : base() { _shellSettings = shellSettings; - CacheHostIdentifier = shellSettings["Azure.DatabaseCache.HostIdentifier"]; - CacheName = shellSettings["Azure.DatabaseCache.CacheName"]; + CacheHostIdentifier = shellSettings[Constants.DatabaseCacheHostIdentifierSettingName]; + CacheName = shellSettings[Constants.DatabaseCacheCacheNameSettingName]; } private readonly ShellSettings _shellSettings; diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/Caching/Output/AzureOutputCacheStorageProvider.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/Caching/Output/AzureOutputCacheStorageProvider.cs index 19d3336b0..f650424b1 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Services/Caching/Output/AzureOutputCacheStorageProvider.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/Caching/Output/AzureOutputCacheStorageProvider.cs @@ -10,15 +10,15 @@ using System.Web; namespace Orchard.Azure.Services.Caching.Output { - [OrchardFeature("Orchard.Azure.OutputCache")] + [OrchardFeature(Constants.OutputCacheFeatureName)] [OrchardSuppressDependency("Orchard.OutputCache.Services.DefaultCacheStorageProvider")] public class AzureOutputCacheStorageProvider : Component, IOutputCacheStorageProvider { public AzureOutputCacheStorageProvider(ShellSettings shellSettings) : base() { - var cacheHostIdentifier = shellSettings["Azure.OutputCache.HostIdentifier"]; - var cacheName = shellSettings["Azure.OutputCache.CacheName"]; + var cacheHostIdentifier = shellSettings[Constants.OutputCacheHostIdentifierSettingName]; + var cacheName = shellSettings[Constants.OutputCacheCacheNameSettingName]; var dataCacheFactoryConfiguration = new DataCacheFactoryConfiguration() { AutoDiscoverProperty = new DataCacheAutoDiscoverProperty(true, cacheHostIdentifier), @@ -33,7 +33,7 @@ namespace Orchard.Azure.Services.Caching.Output { else _cache = dataCacheFactory.GetDefaultCache(); - _usingSharedCaching = Boolean.Parse(shellSettings["Azure.OutputCache.IsSharedCaching"]); + _usingSharedCaching = Boolean.Parse(shellSettings[Constants.OutputCacheIsSharedCachingSettingName]); if (!_usingSharedCaching) { diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureBlobShellSettingsManager.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureBlobShellSettingsManager.cs index 3767a65f4..2110f4fda 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureBlobShellSettingsManager.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureBlobShellSettingsManager.cs @@ -12,22 +12,13 @@ namespace Orchard.Azure.Services.Environment.Configuration { public class AzureBlobShellSettingsManager : Component, IShellSettingsManager { - public const string ConnectionStringSettingName = "Orchard.StorageConnectionString"; - public const string ContainerName = "sites"; // Container names must be lower cased. - public const string SettingsFilename = "Settings.txt"; - public const char Separator = ':'; - public const string EmptyValue = "null"; - + protected const string EmptyValueString = "null"; protected readonly IShellSettingsManagerEventHandler Events; protected readonly AzureFileSystem FileSystem; - public AzureBlobShellSettingsManager(IShellSettingsManagerEventHandler events, IMimeTypeProvider mimeTypeProvider) - : this(CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(ConnectionStringSettingName)), events, mimeTypeProvider) { - } - - public AzureBlobShellSettingsManager(CloudStorageAccount storageAccount, IShellSettingsManagerEventHandler events, IMimeTypeProvider mimeTypeProvider) { + public AzureBlobShellSettingsManager(IShellSettingsManagerEventHandler events, IMimeTypeProvider mimeTypeProvider) { Events = events; - FileSystem = new AzureFileSystem(ContainerName, String.Empty, true, mimeTypeProvider); + FileSystem = new AzureFileSystem(CloudConfigurationManager.GetSetting(Constants.ShellSettingsStorageConnectionStringSettingName), Constants.ShellSettingsContainerName, String.Empty, true, mimeTypeProvider); } public virtual IEnumerable LoadSettings() { @@ -37,11 +28,8 @@ namespace Orchard.Azure.Services.Environment.Configuration { public virtual void SaveSettings(ShellSettings settings) { var content = ShellSettingsSerializer.ComposeSettings(settings); - var filePath = FileSystem.Combine(settings.Name, SettingsFilename); - - var file = FileSystem.FileExists(filePath) - ? FileSystem.GetFile(filePath) - : FileSystem.CreateFile(filePath); + var filePath = FileSystem.Combine(settings.Name, Constants.ShellSettingsFileName); + var file = FileSystem.FileExists(filePath) ? FileSystem.GetFile(filePath) : FileSystem.CreateFile(filePath); using (var stream = file.OpenWrite()) { using (var writer = new StreamWriter(stream)) { @@ -55,7 +43,7 @@ namespace Orchard.Azure.Services.Environment.Configuration { private IEnumerable LoadSettingsInternal() { foreach (var folder in FileSystem.ListFolders(null)) { foreach (var file in FileSystem.ListFiles(folder.GetPath())) { - if (!String.Equals(file.GetName(), SettingsFilename)) + if (!String.Equals(file.GetName(), Constants.ShellSettingsFileName)) continue; using (var stream = file.OpenRead()) { using (var reader = new StreamReader(stream)) diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureConfigShellSettingsManager.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureConfigShellSettingsManager.cs index 68883bbcc..e10785d1c 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureConfigShellSettingsManager.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureConfigShellSettingsManager.cs @@ -48,11 +48,7 @@ namespace Orchard.Azure.Services.Environment.Configuration { private const string _prefix = "Orchard"; public AzureConfigShellSettingsManager(IShellSettingsManagerEventHandler events, IMimeTypeProvider mimeTypeProvider) - : this(CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(ConnectionStringSettingName)), events, mimeTypeProvider) { - } - - public AzureConfigShellSettingsManager(CloudStorageAccount storageAccount, IShellSettingsManagerEventHandler events, IMimeTypeProvider mimeTypeProvider) - : base(storageAccount, events, mimeTypeProvider) { + : base(events, mimeTypeProvider) { if (RoleEnvironment.IsAvailable) { RoleEnvironment.Changing += RoleEnvironment_Changing; RoleEnvironment.Changed += RoleEnvironment_Changed; @@ -97,7 +93,7 @@ namespace Orchard.Azure.Services.Environment.Configuration { } private string ParseValue(string value) { - if (value == EmptyValue || String.IsNullOrWhiteSpace(value)) + if (value == EmptyValueString || String.IsNullOrWhiteSpace(value)) return null; return value; } diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/AzureFileSystem.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/AzureFileSystem.cs index 5271c3da8..5fe45d021 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/AzureFileSystem.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/AzureFileSystem.cs @@ -23,6 +23,11 @@ namespace Orchard.Azure.Services.FileSystems { private CloudBlobClient _blobClient; private CloudBlobContainer _container; + public string StorageConnectionString { + get; + protected set; + } + public string ContainerName { get; protected set; @@ -42,9 +47,10 @@ namespace Orchard.Azure.Services.FileSystems { } } - public AzureFileSystem(string containerName, string root, bool isPrivate, IMimeTypeProvider mimeTypeProvider) { + public AzureFileSystem(string storageConnectionString, string containerName, string root, bool isPrivate, IMimeTypeProvider mimeTypeProvider) { _isPrivate = isPrivate; _mimeTypeProvider = mimeTypeProvider; + StorageConnectionString = storageConnectionString; ContainerName = containerName; _root = String.IsNullOrEmpty(root) ? "" : root + "/"; } @@ -54,7 +60,7 @@ namespace Orchard.Azure.Services.FileSystems { return; } - _storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("Orchard.StorageConnectionString")); + _storageAccount = CloudStorageAccount.Parse(StorageConnectionString); _absoluteRoot = Combine(Combine(_storageAccount.BlobEndpoint.AbsoluteUri, ContainerName), _root); _blobClient = _storageAccount.CreateCloudBlobClient(); diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs index 093dfbded..55e31aef2 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs @@ -2,14 +2,15 @@ using Orchard.Environment.Configuration; using Orchard.FileSystems.Media; using Orchard.Environment.Extensions; +using Microsoft.WindowsAzure; namespace Orchard.Azure.Services.FileSystems.Media { - [OrchardFeature("Orchard.Azure.MediaStorage")] + [OrchardFeature(Constants.MediaStorageFeatureName)] [OrchardSuppressDependency("Orchard.FileSystems.Media.FileSystemStorageProvider")] public class AzureBlobStorageProvider : AzureFileSystem, IStorageProvider { - public AzureBlobStorageProvider(ShellSettings shellSettings, IMimeTypeProvider mimeTypeProvider) : base("media", shellSettings.Name, false, mimeTypeProvider) + public AzureBlobStorageProvider(ShellSettings shellSettings, IMimeTypeProvider mimeTypeProvider) : base(CloudConfigurationManager.GetSetting(Constants.MediaStorageStorageConnectionStringSettingName), Constants.MediaStorageContainerName, shellSettings.Name, false, mimeTypeProvider) { } public bool TrySaveStream(string path, Stream inputStream) { diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/Logging/AzureDiagnosticsAppender.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/Logging/AzureDiagnosticsAppender.cs index e50446b54..134ff7b91 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Services/Logging/AzureDiagnosticsAppender.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/Logging/AzureDiagnosticsAppender.cs @@ -11,17 +11,17 @@ namespace Orchard.Azure.Services.Logging { /// public class AzureDiagnosticsAppender : AppenderSkeleton { - private const string _wadStorageAccountConnectionStringSettingName = "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"; + //private const string _wadStorageAccountConnectionStringSettingName = "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"; public AzureDiagnosticsAppender() { - var defaultDiagnostics = DiagnosticMonitor.GetDefaultInitialConfiguration(); - var period = TimeSpan.FromMinutes(1d); + //var defaultDiagnostics = DiagnosticMonitor.GetDefaultInitialConfiguration(); + //var period = TimeSpan.FromMinutes(1d); - defaultDiagnostics.Directories.ScheduledTransferPeriod = period; - defaultDiagnostics.Logs.ScheduledTransferPeriod = period; - defaultDiagnostics.WindowsEventLog.ScheduledTransferPeriod = period; + //defaultDiagnostics.Directories.ScheduledTransferPeriod = period; + //defaultDiagnostics.Logs.ScheduledTransferPeriod = period; + //defaultDiagnostics.WindowsEventLog.ScheduledTransferPeriod = period; - DiagnosticMonitor.Start(_wadStorageAccountConnectionStringSettingName, defaultDiagnostics); + //DiagnosticMonitor.Start(_wadStorageAccountConnectionStringSettingName, defaultDiagnostics); } protected override void Append(LoggingEvent loggingEvent) { diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/MissingSettingsBanner.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/MissingSettingsBanner.cs new file mode 100644 index 000000000..2745ad05d --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/MissingSettingsBanner.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Orchard.Localization; +using Orchard.UI.Admin.Notification; +using Orchard.UI.Notify; +using Orchard.Environment.Features; +using Orchard.Environment.Configuration; +using Microsoft.WindowsAzure; +using Microsoft.WindowsAzure.Storage; + +namespace Orchard.Azure.Services { + + public class MissingSettingsBanner : INotificationProvider { + + public MissingSettingsBanner(IFeatureManager featureManager, ShellSettings shellSettings) { + _featureManager = featureManager; + _shellSettings = shellSettings; + T = NullLocalizer.Instance; + } + + private IFeatureManager _featureManager; + private ShellSettings _shellSettings; + + public Localizer T { + get; + set; + } + + public IEnumerable GetNotifications() { + var enabledFeatureNamesQuery = + from feature in _featureManager.GetEnabledFeatures() + select feature.Id; + + if (enabledFeatureNamesQuery.Contains(Constants.MediaStorageFeatureName)) { + CloudStorageAccount storageAccount = null; + var storageConnectionString = CloudConfigurationManager.GetSetting(Constants.MediaStorageStorageConnectionStringSettingName); + var isValid = CloudStorageAccount.TryParse(storageConnectionString, out storageAccount); + if (!isValid) + yield return new NotifyEntry { + Message = T("A valid storage account connection string must be configured in the role configuration setting '{0}'.", Constants.MediaStorageStorageConnectionStringSettingName), + Type = NotifyType.Warning + }; + } + + if (enabledFeatureNamesQuery.Contains(Constants.OutputCacheFeatureName)) { + // Create default configuration to local role-based cache when feature is enabled. + if (!_shellSettings.Keys.Contains(Constants.OutputCacheHostIdentifierSettingName)) + _shellSettings[Constants.OutputCacheHostIdentifierSettingName] = "Orchard.Azure.Web"; + if (!_shellSettings.Keys.Contains(Constants.OutputCacheCacheNameSettingName)) + _shellSettings[Constants.OutputCacheCacheNameSettingName] = "OutputCache"; + if (!_shellSettings.Keys.Contains(Constants.OutputCacheIsSharedCachingSettingName)) + _shellSettings[Constants.OutputCacheIsSharedCachingSettingName] = "false"; + + if (String.IsNullOrWhiteSpace(_shellSettings[Constants.OutputCacheHostIdentifierSettingName])) + yield return new NotifyEntry { + Message = T("A cache cluster host identifier must be configured in the shell setting '{0}'.", Constants.OutputCacheHostIdentifierSettingName), + Type = NotifyType.Warning + }; + if (String.IsNullOrWhiteSpace(_shellSettings[Constants.OutputCacheCacheNameSettingName])) + yield return new NotifyEntry { + Message = T("A cache name must be configured in the shell setting '{0}'.", Constants.OutputCacheCacheNameSettingName), + Type = NotifyType.Warning + }; + bool result; + if (!Boolean.TryParse(_shellSettings[Constants.OutputCacheIsSharedCachingSettingName], out result)) + yield return new NotifyEntry { + Message = T("A valid boolean value must be configured in the shell setting '{0}'.", Constants.OutputCacheIsSharedCachingSettingName), + Type = NotifyType.Warning + }; + } + + if (enabledFeatureNamesQuery.Contains(Constants.DatabaseCacheFeatureName)) { + // Create default configuration to local role-based cache when feature is enabled. + if (!_shellSettings.Keys.Contains(Constants.DatabaseCacheHostIdentifierSettingName)) + _shellSettings[Constants.DatabaseCacheHostIdentifierSettingName] = "Orchard.Azure.Web"; + if (!_shellSettings.Keys.Contains(Constants.DatabaseCacheCacheNameSettingName)) + _shellSettings[Constants.DatabaseCacheCacheNameSettingName] = "DatabaseCache"; + if (!_shellSettings.Keys.Contains(Constants.DatabaseCacheIsSharedCachingSettingName)) + _shellSettings[Constants.DatabaseCacheIsSharedCachingSettingName] = "false"; + + if (String.IsNullOrWhiteSpace(_shellSettings[Constants.DatabaseCacheHostIdentifierSettingName])) + yield return new NotifyEntry { + Message = T("A cache cluster host identifier must be configured in the shell setting '{0}'.", Constants.DatabaseCacheHostIdentifierSettingName), + Type = NotifyType.Warning + }; + if (String.IsNullOrWhiteSpace(_shellSettings[Constants.DatabaseCacheCacheNameSettingName])) + yield return new NotifyEntry { + Message = T("A cache name must be configured in the shell setting '{0}'.", Constants.DatabaseCacheCacheNameSettingName), + Type = NotifyType.Warning + }; + bool result; + if (!Boolean.TryParse(_shellSettings[Constants.DatabaseCacheIsSharedCachingSettingName], out result)) + yield return new NotifyEntry { + Message = T("A valid boolean value must be configured in the shell setting '{0}'.", Constants.DatabaseCacheIsSharedCachingSettingName), + Type = NotifyType.Warning + }; + } + } + } +} \ No newline at end of file