更改自动api

This commit is contained in:
陈淳
2023-01-13 13:40:54 +08:00
parent 8ead6c59c0
commit 65377d9236
3 changed files with 17 additions and 9 deletions

View File

@@ -1,6 +1,4 @@
using Panda.DynamicWebApi;
using Panda.DynamicWebApi.Attributes;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,14 +6,16 @@ using System.Threading.Tasks;
using Yi.Framework.Application.Contracts.Student;
using Yi.Framework.Domain.Student;
using Yi.Framework.Domain.Student.IRepository;
using Microsoft.AspNetCore.Mvc;
using NET.AutoWebApi.Setting;
using Microsoft.AspNetCore.Http;
namespace Yi.Framework.Application.Student
{
/// <summary>
/// 服务实现
/// </summary>
[DynamicWebApi]
public class StudentService : IStudentService, IDynamicWebApi
public class StudentService : IStudentService, IAutoApiService
{
private readonly IStudentRepository _studentRepository;
private readonly StudentManager _studentManager;
@@ -24,8 +24,10 @@ namespace Yi.Framework.Application.Student
_studentRepository = studentRepository;
_studentManager = studentManager;
}
public string GetShijie()
public string PostShijie(IFormFile formFile)
{
var ss = formFile;
return "你好世界";
}
}

View File

@@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
<PackageReference Include="Panda.DynamicWebApi" Version="1.2.1" />
<PackageReference Include="NET.AutoApi" Version="1.0.3" />
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.3.43" />
<PackageReference Include="StartupModules" Version="4.0.0" />
</ItemGroup>

View File

@@ -1,6 +1,5 @@
using AspNetCore.Microsoft.AspNetCore.Builder;
using Panda.DynamicWebApi;
using System.Reflection;
using Yi.Framework.Application;
using Yi.Framework.Application.Contracts;
@@ -40,7 +39,11 @@ builder.Host.UseAutoFacServerProviderFactory();
//<2F><><EFBFBD>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>붯̬api
builder.Services.AddControllers();
builder.Services.AddDynamicWebApi();
builder.Services.AddAutoApiService(opt =>
{
//NETServiceTest<73><74><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD>̬api<70><69><EFBFBD><EFBFBD>
opt.CreateConventional(typeof(YiFrameworkApplicationModule).Assembly);
});
//<2F><><EFBFBD><EFBFBD>swagger
builder.Services.AddSwaggerServer<YiFrameworkApplicationModule>();
@@ -59,6 +62,9 @@ app.UseHttpsRedirection();
app.UseAuthorization();
app.UseRouting();
//ʹ<>ö<EFBFBD>̬api
app.UseAutoApiService();
app.MapControllers();
app.Run();