From 3234d8115d30977363f4dc07d599d9a9db71fb0a Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Thu, 19 Jul 2018 15:17:45 +0300 Subject: [PATCH] Rename IHybridWebRootFileProvider to IWebContentFileProvider --- .../Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs | 10 +++++----- .../Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs | 10 +++++----- .../Mvc/UI/Bundling/Scripts/ScriptBundler.cs | 4 ++-- .../AspNetCore/Mvc/UI/Bundling/Styles/StyleBundler.cs | 4 ++-- .../Bundling/TagHelpers/AbpTagHelperResourceService.cs | 10 +++++----- .../Bundling/TagHelpers/AbpTagHelperScriptService.cs | 4 ++-- .../UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs | 4 ++-- .../VirtualFileSystemApplicationBuilderExtensions.cs | 2 +- ...bRootFileProvider.cs => IWebContentFileProvider.cs} | 2 +- ...ebRootFileProvider.cs => WebContentFileProvider.cs} | 9 ++++----- 10 files changed, 29 insertions(+), 30 deletions(-) rename framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/{IHybridWebRootFileProvider.cs => IWebContentFileProvider.cs} (63%) rename framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/{HybridWebRootFileProvider.cs => WebContentFileProvider.cs} (91%) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs index 000b38b8ea..ca5e914754 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling public ILogger Logger { get; set; } protected readonly BundlingOptions Options; - protected readonly IHybridWebRootFileProvider WebRootFileProvider; + protected readonly IWebContentFileProvider WebContentFileProvider; protected readonly IHostingEnvironment HostingEnvironment; protected readonly IScriptBundler ScriptBundler; protected readonly IStyleBundler StyleBundler; @@ -38,7 +38,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling IServiceProvider serviceProvider, IDynamicFileProvider dynamicFileProvider, IBundleCache bundleCache, - IHybridWebRootFileProvider webRootFileProvider, + IWebContentFileProvider webContentFileProvider, IWebRequestResources requestResources) { HostingEnvironment = hostingEnvironment; @@ -46,7 +46,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling ServiceProvider = serviceProvider; DynamicFileProvider = dynamicFileProvider; BundleCache = bundleCache; - WebRootFileProvider = webRootFileProvider; + WebContentFileProvider = webContentFileProvider; RequestResources = requestResources; StyleBundler = styleBundler; Options = options.Value; @@ -112,7 +112,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling { foreach (var file in files) { - var watchDisposeHandle = WebRootFileProvider.Watch(file).RegisterChangeCallback(_ => + var watchDisposeHandle = WebContentFileProvider.Watch(file).RegisterChangeCallback(_ => { lock (cacheValue.WatchDisposeHandles) { @@ -196,7 +196,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling protected virtual BundleConfigurationContext CreateBundleConfigurationContext() { - return new BundleConfigurationContext(ServiceProvider, WebRootFileProvider); + return new BundleConfigurationContext(ServiceProvider, WebContentFileProvider); } protected virtual List GetContributors(BundleConfigurationCollection bundles, string bundleName) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs index 7d19b5a32c..50b81d9236 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs @@ -12,12 +12,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling { public ILogger Logger { get; set; } - protected IHybridWebRootFileProvider WebRootFileProvider { get; } + protected IWebContentFileProvider WebContentFileProvider { get; } protected IMinifier Minifier { get; } - protected BundlerBase(IHybridWebRootFileProvider webRootFileProvider, IMinifier minifier) + protected BundlerBase(IWebContentFileProvider webContentFileProvider, IMinifier minifier) { - WebRootFileProvider = webRootFileProvider; + WebContentFileProvider = webContentFileProvider; Minifier = minifier; Logger = NullLogger.Instance; @@ -59,11 +59,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling protected virtual IFileInfo GetFileInfo(IBundlerContext context, string file) { - var fileInfo = WebRootFileProvider.GetFileInfo(file); + var fileInfo = WebContentFileProvider.GetFileInfo(file); if (!fileInfo.Exists) { - throw new AbpException($"Could not find file '{file}' using {nameof(IHybridWebRootFileProvider)}"); + throw new AbpException($"Could not find file '{file}' using {nameof(IWebContentFileProvider)}"); } return fileInfo; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Scripts/ScriptBundler.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Scripts/ScriptBundler.cs index e653684139..e65379fc74 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Scripts/ScriptBundler.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Scripts/ScriptBundler.cs @@ -7,8 +7,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Scripts { public override string FileExtension => "js"; - public ScriptBundler(IHybridWebRootFileProvider webRootFileProvider, IJavascriptMinifier minifier) - : base(webRootFileProvider, minifier) + public ScriptBundler(IWebContentFileProvider webContentFileProvider, IJavascriptMinifier minifier) + : base(webContentFileProvider, minifier) { } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/StyleBundler.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/StyleBundler.cs index c7c7d681a9..768a1bb136 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/StyleBundler.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/StyleBundler.cs @@ -11,8 +11,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Styles private readonly IHostingEnvironment _hostingEnvironment; public override string FileExtension => "css"; - public StyleBundler(IHybridWebRootFileProvider webRootFileProvider, ICssMinifier minifier, IHostingEnvironment hostingEnvironment) - : base(webRootFileProvider, minifier) + public StyleBundler(IWebContentFileProvider webContentFileProvider, ICssMinifier minifier, IHostingEnvironment hostingEnvironment) + : base(webContentFileProvider, minifier) { _hostingEnvironment = hostingEnvironment; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs index 5dd15b3ebf..2224198dc4 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs @@ -18,18 +18,18 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers public ILogger Logger { get; set; } protected IBundleManager BundleManager { get; } - protected IHybridWebRootFileProvider WebRootFileProvider { get; } + protected IWebContentFileProvider WebContentFileProvider { get; } protected IHostingEnvironment HostingEnvironment { get; } protected readonly BundlingOptions Options; protected AbpTagHelperResourceService( IBundleManager bundleManager, - IHybridWebRootFileProvider webRootFileProvider, + IWebContentFileProvider webContentFileProvider, IOptions options, IHostingEnvironment hostingEnvironment) { BundleManager = bundleManager; - WebRootFileProvider = webRootFileProvider; + WebContentFileProvider = webContentFileProvider; HostingEnvironment = hostingEnvironment; Options = options.Value; @@ -63,10 +63,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers foreach (var bundleFile in bundleFiles) { - var file = WebRootFileProvider.GetFileInfo(bundleFile); + var file = WebContentFileProvider.GetFileInfo(bundleFile); if (file == null) { - throw new AbpException($"Could not find the bundle file from {nameof(IHybridWebRootFileProvider)}"); + throw new AbpException($"Could not find the bundle file from {nameof(IWebContentFileProvider)}"); } AddHtmlTag(context, output, bundleFile + "?_v=" + file.LastModified.UtcTicks); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs index f746a34b29..52e05776e8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs @@ -12,12 +12,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers { public AbpTagHelperScriptService( IBundleManager bundleManager, - IHybridWebRootFileProvider webRootFileProvider, + IWebContentFileProvider webContentFileProvider, IOptions options, IHostingEnvironment hostingEnvironment ) : base( bundleManager, - webRootFileProvider, + webContentFileProvider, options, hostingEnvironment) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs index e4ad8536f4..4a798fe051 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs @@ -12,12 +12,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers { public AbpTagHelperStyleService( IBundleManager bundleManager, - IHybridWebRootFileProvider webRootFileProvider, + IWebContentFileProvider webContentFileProvider, IOptions options, IHostingEnvironment hostingEnvironment ) : base( bundleManager, - webRootFileProvider, + webContentFileProvider, options, hostingEnvironment) { diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/VirtualFileSystemApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/VirtualFileSystemApplicationBuilderExtensions.cs index 5ad7bff1d1..92bf338f5d 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/VirtualFileSystemApplicationBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/VirtualFileSystemApplicationBuilderExtensions.cs @@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Builder app.UseStaticFiles( new StaticFileOptions { - FileProvider = app.ApplicationServices.GetRequiredService() + FileProvider = app.ApplicationServices.GetRequiredService() } ); } diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/IHybridWebRootFileProvider.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/IWebContentFileProvider.cs similarity index 63% rename from framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/IHybridWebRootFileProvider.cs rename to framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/IWebContentFileProvider.cs index f639d6e499..ab4130024f 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/IHybridWebRootFileProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/IWebContentFileProvider.cs @@ -2,7 +2,7 @@ namespace Volo.Abp.AspNetCore.VirtualFileSystem { - public interface IHybridWebRootFileProvider : IFileProvider + public interface IWebContentFileProvider : IFileProvider { } diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/HybridWebRootFileProvider.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs similarity index 91% rename from framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/HybridWebRootFileProvider.cs rename to framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs index 021aeec35b..3ac429853f 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/HybridWebRootFileProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Linq; using JetBrains.Annotations; using Microsoft.AspNetCore.Hosting; @@ -12,7 +11,7 @@ using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.AspNetCore.VirtualFileSystem { //TODO: How to handle wwwroot naming? - public class HybridWebRootFileProvider : IHybridWebRootFileProvider, ISingletonDependency + public class WebContentFileProvider : IWebContentFileProvider, ISingletonDependency { private readonly IVirtualFileProvider _virtualFileProvider; private readonly IFileProvider _fileProvider; @@ -21,7 +20,7 @@ namespace Volo.Abp.AspNetCore.VirtualFileSystem protected AspNetCoreContentOptions Options { get; } - public HybridWebRootFileProvider( + public WebContentFileProvider( IVirtualFileProvider virtualFileProvider, IHostingEnvironment hostingEnvironment, IOptions options) @@ -69,13 +68,13 @@ namespace Volo.Abp.AspNetCore.VirtualFileSystem { if (!ExtraAllowedFolder(filter)) { - return _fileProvider.Watch("/wwwroot" + filter); + return _fileProvider.Watch(_rootPath + filter); } return new CompositeChangeToken( new[] { - _fileProvider.Watch("/wwwroot" + filter), + _fileProvider.Watch(_rootPath + filter), _fileProvider.Watch(filter) } );