|
@@ -23,12 +23,13 @@ builder.Services.AddControllers()
|
|
|
.AddJsonOptions(options =>
|
|
|
{
|
|
|
//空字段不响应Response
|
|
|
- options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
|
|
|
+ //options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
|
|
|
+
|
|
|
+ options.JsonSerializerOptions.Converters.Add(new NullJsonConverter());
|
|
|
//时间格式化响应
|
|
|
options.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss"));
|
|
|
});
|
|
|
|
|
|
-
|
|
|
#region Cors
|
|
|
|
|
|
builder.Services.AddCors(policy =>
|
|
@@ -55,9 +56,9 @@ builder.Services.AddScoped(options =>
|
|
|
{
|
|
|
return new SqlSugarClient(new List<ConnectionConfig>()
|
|
|
{
|
|
|
- new ConnectionConfig() {
|
|
|
- ConfigId = DBEnum.OA2023DB,
|
|
|
- ConnectionString = _config.GetConnectionString("OA2023DB"),
|
|
|
+ new ConnectionConfig() {
|
|
|
+ ConfigId = DBEnum.OA2023DB,
|
|
|
+ ConnectionString = _config.GetConnectionString("OA2023DB"),
|
|
|
DbType = DbType.SqlServer, IsAutoCloseConnection = true }
|
|
|
});
|
|
|
});
|