From 750352dba796c514e4c5960c9fb666cb1d47562a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com>
Date: Tue, 12 Apr 2022 22:12:11 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0automapper=E7=9A=84=E4=BE=9D?=
=?UTF-8?q?=E8=B5=96=E6=B3=A8=E5=85=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs | 6 +++++-
.../Yi.Framework.ApiMicroservice/configuration.json | 4 ++--
.../MiddlewareExtend/AutoMapperExtension.cs | 5 +++--
.../MiddlewareExtend/HealthCheckExtension.cs | 2 +-
.../Yi.Framework.WebCore/Utility/CustomHostingStartup.cs | 6 +++++-
5 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs
index 87abaf09..a2623cf8 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs
@@ -57,6 +57,10 @@ builder.Services.AddSqlsugarServer();
#endregion
builder.Services.AddQuartzService();
#region
+//AutoMapper注入
+#endregion
+builder.Services.AddAutoMapperService();
+#region
//控制器+过滤器配置
#endregion
builder.Services.AddControllers(optios => {
@@ -150,7 +154,7 @@ app.UseCorsService();
#region
//健康检查注入
#endregion
-app.UseHealthCheckMiddleware();
+app.UseHealthCheckService();
#region
//鉴权注入
#endregion
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/configuration.json b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/configuration.json
index a8d7b639..4431edcd 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/configuration.json
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/configuration.json
@@ -2,7 +2,7 @@
"apollo": {
"AppId": "ApiMicroservice",
"Env": "DEV",
- "MetaServer": "http://119.91.207.67:18080",
- "ConfigServer": [ "http://119.91.207.67:18080" ]
+ "MetaServer": "http://[xxxx]:18080",
+ "ConfigServer": [ "http://[xxxx]:18080" ]
}
}
\ No newline at end of file
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/AutoMapperExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/AutoMapperExtension.cs
index daefb162..f8f34417 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/AutoMapperExtension.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/AutoMapperExtension.cs
@@ -2,6 +2,7 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.IO;
+using Yi.Framework.WebCore.Mapper;
namespace Yi.Framework.WebCore.MiddlewareExtend
{
@@ -10,9 +11,9 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
///
public static class AutoMapperExtension
{
- public static IServiceCollection AddAutoMapperExtensionService(this IServiceCollection services,Type type)
+ public static IServiceCollection AddAutoMapperService(this IServiceCollection services)
{
- services.AddAutoMapper(type);
+ services.AddAutoMapper(typeof(AutoMapperProfile));
return services;
}
}
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/HealthCheckExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/HealthCheckExtension.cs
index 0a489f8a..a8658784 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/HealthCheckExtension.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/HealthCheckExtension.cs
@@ -20,7 +20,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
///
/// 榛樿鏄/Health
///
- public static void UseHealthCheckMiddleware(this IApplicationBuilder app, string checkPath = "/Health")
+ public static void UseHealthCheckService(this IApplicationBuilder app, string checkPath = "/Health")
{
if (Appsettings.appBool("HealthCheck_Enabled"))
{
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/Utility/CustomHostingStartup.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/Utility/CustomHostingStartup.cs
index 58fcabb7..02400da8 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/Utility/CustomHostingStartup.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/Utility/CustomHostingStartup.cs
@@ -8,13 +8,17 @@ using System.Linq;
using System.Threading.Tasks;
[assembly: HostingStartup(typeof(Yi.Framework.WebCore.Utility.CustomHostingStartup))]
+//杩欓噷鏀句笂鍚姩绫讳笅鐨刣ll锛屽嵆鑷姩渚靛叆浜嗭紝褰撶劧鎴戜滑鐜板湪涓嶄細杩欐牱鍋氥
namespace Yi.Framework.WebCore.Utility
{
///
/// 蹇呴』瀹炵幇IHostingStartup鎺ュ彛
/// 蹇呴』鏍囪HostingStartup鐗规
///
- /// 灏卞儚鏈ㄩ┈涓鏍
+ /// 浣犲皬瀛愶紒杩樻槸琚綘鍙戠幇浜嗗晩锛屾暀浣犱竴鎷涢獨鎿嶄綔锛佽繖鏄竴涓睂鐨勪笢瑗匡紒
+ ///
+ /// 鎴戜滑绉板畠涓猴細 鏃犱镜娉ㄥ叆锛 瀹冨交澶村交灏惧氨鏄竴涓湪椹梾姣掞紒
+ ///
///
public class CustomHostingStartup : IHostingStartup
{