完善主题内容

This commit is contained in:
橙子
2023-01-25 22:27:19 +08:00
parent 99787950a8
commit ac26df6827
22 changed files with 155 additions and 25 deletions

View File

@@ -0,0 +1,25 @@
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection
{
public static class ControllerAddExtension
{
public static IMvcBuilder AddNewtonsoftJsonServer(this IMvcBuilder mvcBuilder)
{
return mvcBuilder.AddNewtonsoftJson(opt =>
{
//忽略循环引用
opt.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
//不改变字段大小
//opt.SerializerSettings.ContractResolver = new DefaultContractResolver();
});
}
}
}

View File

@@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.13" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="NET.AutoApi" Version="1.0.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />

View File

@@ -27,22 +27,6 @@ LogLevel logLevel = LogLevel.Warning)
Details = details;
}
public UserFriendlyException(
string message,
ResultCodeEnum code = ResultCodeEnum.NotSuccess,
string? details = null,
Exception? innerException = null,
LogLevel logLevel = LogLevel.Warning)
: base(
(int)code,
message,
details,
innerException,
logLevel)
{
Details = details;
}
/// <summary>
/// 序列化参数的构造函数
/// </summary>

View File

@@ -93,7 +93,7 @@ namespace Yi.Framework.Ddd.Services
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<TGetOutputDto> CreateAsync(TCreateInput input)
public virtual async Task<TGetOutputDto> CreateAsync(TCreateInput input)
{
var entity = await MapToEntityAsync(input);