From 65377d923652f4ec8f12835f64e67b0d772f30aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B7=B3?= Date: Fri, 13 Jan 2023 13:40:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E8=87=AA=E5=8A=A8api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Student/StudentService.cs | 14 ++++++++------ .../Yi.Framework.Core/Yi.Framework.Core.csproj | 2 +- src/Yi.Framework/Yi.Framework.Web/Program.cs | 10 ++++++++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/Yi.Framework/Yi.Framework.Application/Student/StudentService.cs b/src/Yi.Framework/Yi.Framework.Application/Student/StudentService.cs index 48e590ed..2e896389 100644 --- a/src/Yi.Framework/Yi.Framework.Application/Student/StudentService.cs +++ b/src/Yi.Framework/Yi.Framework.Application/Student/StudentService.cs @@ -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 { /// /// 服务实现 /// - [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 "你好世界"; } } diff --git a/src/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj b/src/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj index 91843c46..b7d607f3 100644 --- a/src/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj +++ b/src/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Yi.Framework/Yi.Framework.Web/Program.cs b/src/Yi.Framework/Yi.Framework.Web/Program.cs index bc8b21b5..0a0554e9 100644 --- a/src/Yi.Framework/Yi.Framework.Web/Program.cs +++ b/src/Yi.Framework/Yi.Framework.Web/Program.cs @@ -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(); //ӿ붯̬api builder.Services.AddControllers(); -builder.Services.AddDynamicWebApi(); +builder.Services.AddAutoApiService(opt => +{ + //NETServiceTestڳӽ̬api + opt.CreateConventional(typeof(YiFrameworkApplicationModule).Assembly); +}); //swagger builder.Services.AddSwaggerServer(); @@ -59,6 +62,9 @@ app.UseHttpsRedirection(); app.UseAuthorization(); app.UseRouting(); + +//ʹö̬api +app.UseAutoApiService(); app.MapControllers(); app.Run();