Exemplo n.º 1
0
        /// <summary>
        /// Overridable method to execute when All resolvers have been initialized but resolution is not
        /// frozen so they can be modified in this method
        /// </summary>
        /// <param name="umbracoApplication">The current <see cref="UmbracoApplicationBase"/></param>
        /// <param name="applicationContext">The Umbraco <see cref="ApplicationContext"/> for the current application.</param>
        protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            bool disable = ConfigurationManager.AppSettings[DisableVirtualPathProviderKey] != null &&
                           ConfigurationManager.AppSettings[DisableVirtualPathProviderKey]
                           .Equals("true", StringComparison.InvariantCultureIgnoreCase);

            IFileSystem fileSystem            = FileSystemProviderManager.Current.GetUnderlyingFileSystemProvider(Constants.DefaultMediaRoute);
            bool        isAzureBlobFileSystem = fileSystem is AzureBlobFileSystem;

            if (!disable && isAzureBlobFileSystem)
            {
                AzureFileSystem azureFileSystem = ((AzureBlobFileSystem)fileSystem).FileSystem;

                // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
                if (azureFileSystem.UseDefaultRoute)
                {
                    FileSystemVirtualPathProvider.ConfigureMedia(Constants.DefaultMediaRoute);
                }
                else
                {
                    FileSystemVirtualPathProvider.ConfigureMedia(azureFileSystem.ContainerName);
                }
            }

            base.ApplicationStarting(umbracoApplication, applicationContext);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Overridable method to execute when All resolvers have been initialized but resolution is not
        /// frozen so they can be modified in this method
        /// </summary>
        /// <param name="umbracoApplication">The current <see cref="UmbracoApplicationBase"/></param>
        /// <param name="applicationContext">The Umbraco <see cref="ApplicationContext"/> for the current application.</param>
        protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            bool disable = ConfigurationManager.AppSettings[DisableVirtualPathProviderKey] != null &&
                           ConfigurationManager.AppSettings[DisableVirtualPathProviderKey]
                           .Equals("true", StringComparison.InvariantCultureIgnoreCase);

            IFileSystem fileSystem            = FileSystemProviderManager.Current.GetUnderlyingFileSystemProvider("media");
            bool        isAzureBlobFileSystem = fileSystem.GetType() == typeof(AzureBlobFileSystem);

            if (!disable && isAzureBlobFileSystem)
            {
                FileSystemVirtualPathProvider.ConfigureMedia();
            }

            base.ApplicationStarting(umbracoApplication, applicationContext);
        }