You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
719 B
C#
24 lines
719 B
C#
using Khd.Core.Library.Filter;
|
|
using Khd.Core.Library.Swagger;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Khd.Core.Library
|
|
{
|
|
public static class LibraryExtensions
|
|
{
|
|
public static void AddLibrary(this IServiceCollection services)
|
|
{
|
|
services.AddControllers(options =>
|
|
{
|
|
//可以定义出参格式
|
|
//options.Filters.Add<ResultFilter>();
|
|
options.Filters.Add<ExceptionFilter>();
|
|
});
|
|
services.AddMvc().AddJsonOptions(option =>
|
|
{
|
|
option.JsonSerializerOptions.IgnoreNullValues = true;
|
|
});
|
|
services.AddLibrarySwagger();
|
|
}
|
|
}
|
|
} |