| | |
| | | using log4net; |
| | |  |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using Microsoft.OpenApi.Models; |
| | | using System; |
| | |
| | | /// </summary> |
| | | public static class SwaggerSetup |
| | | { |
| | | |
| | | private static readonly ILog log = |
| | | LogManager.GetLogger(typeof(SwaggerSetup)); |
| | | /// <summary> |
| | | /// Swagger |
| | | /// </summary> |
| | |
| | | { |
| | | if (services == null) throw new ArgumentNullException(nameof(services)); |
| | | |
| | | var basePath = AppContext.BaseDirectory; |
| | | var basePath = AppDomain.CurrentDomain.BaseDirectory; |
| | | //var basePath2 = Microsoft.DotNet.PlatformAbstractions.ApplicationEnvironment.ApplicationBasePath; |
| | | var ApiName = AppSettings.app(new string[] { "ApiName" }); |
| | | |
| | |
| | | c.UseInlineDefinitionsForEnums(); |
| | | try |
| | | { |
| | | //è¿ä¸ªå°±æ¯ååé
ç½®çxmlæä»¶å |
| | | //var xmlPath = Path.Combine(basePath, "Blog.Core.xml"); |
| | | var xmlPath = Path.Combine(basePath, "WIDESEA_WMSServer.xml"); |
| | | //é»è®¤ç第äºä¸ªåæ°æ¯falseï¼è¿ä¸ªæ¯controllerçæ³¨éï¼è®°å¾ä¿®æ¹ |
| | | //c.IncludeXmlComments(xmlPath, true); |
| | | c.IncludeXmlComments(xmlPath, true); |
| | | |
| | | //è¿ä¸ªå°±æ¯Modelå±çxmlæä»¶å |
| | | //var xmlModelPath = Path.Combine(basePath, "Blog.Core.Model.xml"); |
| | | //c.IncludeXmlComments(xmlModelPath); |
| | | var xmlModelPath = Path.Combine(basePath, "WIDESEA_Model.xml"); |
| | | c.IncludeXmlComments(xmlModelPath); |
| | | |
| | | var xmlDTOPath = Path.Combine(basePath, "WIDESEA_DTO.xml"); |
| | | c.IncludeXmlComments(xmlDTOPath); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | log.Error("Blog.Core.xmlåBlog.Core.Model.xml 丢失ï¼è¯·æ£æ¥å¹¶æ·è´ã\n" + ex.Message); |
| | | //log.Error("Blog.Core.xmlåBlog.Core.Model.xml 丢失ï¼è¯·æ£æ¥å¹¶æ·è´ã\n" + ex.Message); |
| | | } |
| | | |
| | | // å¼å¯å æå°é |