From 41f9e0b54602ad179fbfcc899df2bd0a3bc2fb54 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 6 Dec 2024 16:59:02 +0800 Subject: [PATCH] Add a extension method that using `WebRootFileProvider`. --- .../Builder/AbpApplicationBuilderExtensions.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs index f1dd6d4d6e..3cada3bf46 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs @@ -126,9 +126,22 @@ public static class AbpApplicationBuilderExtensions { return app.UseMiddleware(); } - + + /// + /// Configures the application to serve static files that match the specified filename patterns with the WebRootFileProvider of the application. + /// + /// The used to configure the application pipeline. + /// The file name patterns to include when serving static files (e.g., "appsettings*.json"). + /// Supports glob patterns. See Glob patterns documentation. + /// + /// The instance. + public static IApplicationBuilder UseStaticFilesForPatterns(this IApplicationBuilder app, params string[] includeFileNamePatterns) + { + return UseStaticFilesForPatterns(app, includeFileNamePatterns, app.ApplicationServices.GetRequiredService().WebRootFileProvider); + } + /// - /// Configures the application to serve static files that match the specified filename patterns. + /// Configures the application to serve static files that match the specified filename patterns with the specified file provider. /// /// The used to configure the application pipeline. /// The file name patterns to include when serving static files (e.g., "appsettings*.json").