zyf
8 天以前 91489875fc8c9fd2b44c3791ca6f67dcf559675f
MESApplication/Startup.cs
@@ -1,10 +1,11 @@
using MES.Service.Dto.@base;
using System.Reflection;
using MES.Service.Dto.@base;
using MES.Service.util;
using MESApplication.Filter;
using Microsoft.OpenApi.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Swashbuckle.AspNetCore.SwaggerUI;
using System.Reflection;
namespace MESApplication;
@@ -36,7 +37,8 @@
            c.SwaggerDoc("v1",
                new OpenApiInfo
                    { Title = "MESApplication.Api", Version = "v1" });
            var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
            var xmlFile =
                $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
            var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
            c.IncludeXmlComments(xmlPath, true);
        });
@@ -72,11 +74,15 @@
        });
        #region 接口行动过滤器
        services.AddControllers(options => {
        services.AddControllers(options =>
        {
            options.Filters.Add(new ActionFilter());
        });
        var serviceProvider = services.BuildServiceProvider();
        ActionFilter.LoggerError = serviceProvider.GetRequiredService<ILogger<ActionFilter>>();
        ActionFilter.LoggerError =
            serviceProvider.GetRequiredService<ILogger<ActionFilter>>();
        #endregion
    }
@@ -106,8 +112,7 @@
        app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
        //////////////////////////
        ///////////////////////////
        ///////////////////////////
    }
}