Add File Type and Detectors and Mime Type tools and Refactor Grouping ...
This commit is contained in:
@@ -12,12 +12,13 @@ using Swashbuckle.AspNetCore.SwaggerUI;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using xCommons.Interfaces;
|
||||
using xCommons.Providers;
|
||||
|
||||
namespace xCommons.Extensions
|
||||
{
|
||||
public static partial class DIExtensions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Inject Specific Registered Service from IServiceCollection
|
||||
/// </summary>
|
||||
@@ -43,6 +44,41 @@ namespace xCommons.Extensions
|
||||
services.AddSingleton<XAppConfiguration>(appConfiguration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve and Register File Type Detector Configuration ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="configuration"></param>
|
||||
public static void AddXFileTypeDetectorConfiguration(
|
||||
this IServiceCollection source,
|
||||
IConfiguration configuration
|
||||
)
|
||||
{
|
||||
//
|
||||
var config = configuration.GetXFileTypeDetectorConfiguration();
|
||||
source.AddXFileTypeDetectorConfiguration(config);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register File Type Detector Configuration ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="configuration"></param>
|
||||
public static void AddXFileTypeDetectorConfiguration(
|
||||
this IServiceCollection source,
|
||||
XFileTypeDetectorConfiguration configuration
|
||||
)
|
||||
{
|
||||
//
|
||||
if (configuration.IsNull())
|
||||
{
|
||||
configuration = new();
|
||||
}
|
||||
|
||||
//
|
||||
source.AddSingleton(configuration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Search Assemblies, Extract XML Comments and
|
||||
/// Integrate them inside swagger gen documents ...
|
||||
@@ -440,6 +476,16 @@ namespace xCommons.Extensions
|
||||
});
|
||||
}
|
||||
|
||||
public static void AddXFileTypeDetector(
|
||||
this IServiceCollection source,
|
||||
IConfiguration configuration
|
||||
)
|
||||
{
|
||||
//
|
||||
source.AddXFileTypeDetectorConfiguration(configuration);
|
||||
source.AddSingleton<IXFileTypeDetector, XFileTypeDetector>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use X Registered Cross Origin Resource Sharings
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user