From 0fcf172192143141c78c0f9361b5e6237a6e2077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Sat, 16 Apr 2022 00:16:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2swaggerui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- WebFirst/database/sqlite.db | Bin 139264 -> 139264 bytes .../Config/SwaggerDoc.xml | 6 -- .../Controllers/RoleController.cs | 28 ++++++++ .../yi-sqlsugar-dev.db | Bin 28672 -> 28672 bytes .../MiddlewareExtend/SwaggerExtension.cs | 60 +++++++++--------- 6 files changed, 59 insertions(+), 37 deletions(-) create mode 100644 Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs diff --git a/README.md b/README.md index 1fb3416e..c42e4fff 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Yi框架-一套与SqlSugar一样爽的.Net6低代码开源框架。 适合.Net6学习、Sqlsugar学习 、项目二次开发。 集大成者,终究轮子 -Yi框架最新版本标签:`v1.0.1` 更新时间:2022/4/15 +Yi框架最新版本标签:`v1.0.2` 更新时间:2022/4/16 (项目与Sqlsugar同步更新,但这作者老杰哥代码天天爆肝到凌晨两点,我们也尽量会跟上他的脚步。更新频繁,所以可watching持续关注。) diff --git a/WebFirst/database/sqlite.db b/WebFirst/database/sqlite.db index b2cc0ab3a96a95c01951b9f5f03bca6ea556ba0a..54a747c154c26f6bded128eb9c60649d23980a0b 100644 GIT binary patch delta 41 ocmZoTz|nAkV}i6`C<6n75)i{c+C&{=#?Z!u)&$0_2}}#*0l3Er4FCWD delta 41 ocmZoTz|nAkV}i6`5Ca2)5)i{c%0wMw#-PT8)&$0_2}}#*0k|d!1poj5 diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index cd8585fa..de3a063a 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -93,11 +93,5 @@ - - - 自由导航属性 - - - diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs new file mode 100644 index 00000000..cd030960 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Yi.Framework.Common.Models; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; +using Yi.Framework.WebCore; +using Yi.Framework.WebCore.AttributeExtend; +using Yi.Framework.WebCore.AuthorizationPolicy; + +namespace Yi.Framework.ApiMicroservice.Controllers +{ + [ApiController] + [Route("api/[controller]/[action]")] + public class RoleController : BaseCrudController + { + private IRoleService _iRoleService; + public RoleController(ILogger logger, IRoleService iRoleService) : base(logger, iRoleService) + { + _iRoleService = iRoleService; + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index a7bd1cea37e75b9538e3112579a0af8c171d1943..b852b0be791296ea07fddc85718ef665c5ddf27e 100644 GIT binary patch delta 230 zcmZp8z}WDBae_3X&O{k!MxBibOY}LI_;)by-{Ie}SArO@8d{AEjEr;* rOmq#+6buZk3@oioP4!GnjEqc-EGIvYmqoQy5@IRD2)LzTK=%Rwg*7}x delta 113 zcmZp8z}WDBae_3X`a~ILM)i#eOZ3?o`R_3B-`OnaaEX8N9eWKR{|f{E7a;!{|HKI* tV%*GZoT6-zWs!#jn0Of&7#R7VGw?r$NC&V_ejYE2rh^BjBkYg>BLLz`A;$m! diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SwaggerExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SwaggerExtension.cs index 5eb04bca..fb3657c7 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SwaggerExtension.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SwaggerExtension.cs @@ -62,16 +62,16 @@ namespace Yi.Framework.WebCore.MiddlewareExtend }, Array.Empty() } }); - c.AddServer(new OpenApiServer() - { - Url = "https://ccnetcore.com", - Description = "Yi-Framework" - }); - c.CustomOperationIds(apiDesc => - { - var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor; - return controllerAction.ActionName; - }); + //c.AddServer(new OpenApiServer() + //{ + // Url = "https://ccnetcore.com", + // Description = "Yi-Framework" + //}); + //c.CustomOperationIds(apiDesc => + //{ + // var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor; + // return controllerAction.ActionName; + //}); }); #endregion @@ -85,27 +85,12 @@ namespace Yi.Framework.WebCore.MiddlewareExtend app.UseSwagger(); - app.UseKnife4UI(c => - { - c.RoutePrefix = "swagger"; // serve the UI at root - if (swaggerModels.Length == 0) - { - c.SwaggerEndpoint("/v1/swagger.json", "Yi.Framework"); - } - else - { - foreach (var k in swaggerModels) - { - c.SwaggerEndpoint(k.url, k.name); - } - } - }); - - //app.UseSwaggerUI(c => + //app.UseKnife4UI(c => //{ + // c.RoutePrefix = "swagger"; // serve the UI at root // if (swaggerModels.Length == 0) // { - // c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework"); + // c.SwaggerEndpoint("/v1/swagger.json", "Yi.Framework"); // } // else // { @@ -114,10 +99,25 @@ namespace Yi.Framework.WebCore.MiddlewareExtend // c.SwaggerEndpoint(k.url, k.name); // } // } + //}); - //} + app.UseSwaggerUI(c => + { + if (swaggerModels.Length == 0) + { + c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework"); + } + else + { + foreach (var k in swaggerModels) + { + c.SwaggerEndpoint(k.url, k.name); + } + } - //); + } + + ); } }