Browse Source

Add a extension method that using `WebRootFileProvider`.

pull/21559/head
maliming 1 year ago
parent
commit
41f9e0b546
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 17
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs

17
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs

@ -126,9 +126,22 @@ public static class AbpApplicationBuilderExtensions
{
return app.UseMiddleware<AbpDynamicClaimsMiddleware>();
}
/// <summary>
/// Configures the application to serve static files that match the specified filename patterns with the WebRootFileProvider of the application.
/// </summary>
/// <param name="app">The <see cref="IApplicationBuilder"/> used to configure the application pipeline.</param>
/// <param name="includeFileNamePatterns">The file name patterns to include when serving static files (e.g., "appsettings*.json").
/// Supports glob patterns. See <see href="https://learn.microsoft.com/en-us/dotnet/core/extensions/file-globbing">Glob patterns documentation</see>.
/// </param>
/// <returns>The <see cref="IApplicationBuilder"/> instance.</returns>
public static IApplicationBuilder UseStaticFilesForPatterns(this IApplicationBuilder app, params string[] includeFileNamePatterns)
{
return UseStaticFilesForPatterns(app, includeFileNamePatterns, app.ApplicationServices.GetRequiredService<IWebHostEnvironment>().WebRootFileProvider);
}
/// <summary>
/// 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.
/// </summary>
/// <param name="app">The <see cref="IApplicationBuilder"/> used to configure the application pipeline.</param>
/// <param name="includeFileNamePatterns">The file name patterns to include when serving static files (e.g., "appsettings*.json").

Loading…
Cancel
Save