From ebe814e8bdf2d05f3d82c120e4c9f1f0c7cbb77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Tue, 12 Oct 2021 17:07:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0startup=E5=90=84=E7=B1=BB?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Yi.Framework.ApiMicroservice/Startup.cs | 10 +++++++++ Yi.Framework/Yi.Framework.Common/Class1.cs | 8 ------- .../IOCOptions/KafkaOptions.cs | 1 - .../Yi.Framework.Core/RabbitMQInvoker.cs | 2 +- .../MiddlewareExtend/RabbitMQExtension.cs | 21 +++++++++++++++++++ .../MiddlewareExtend/RedisExtension.cs | 21 +++++++++++++++++++ 6 files changed, 53 insertions(+), 10 deletions(-) delete mode 100644 Yi.Framework/Yi.Framework.Common/Class1.cs create mode 100644 Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RabbitMQExtension.cs create mode 100644 Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisExtension.cs diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs index 07bfa7b6..e863e697 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs @@ -54,6 +54,16 @@ namespace Yi.Framework.ApiMicroservice #endregion services.AddDataBaseService("SqliteConn"); + #region + //Redis服务配置 + #endregion + services.AddRedisService(); + + #region + //RabbitMQ服务配置 + #endregion + services.AddRabbitMQService(); + //下面这些应自动注入 services.AddScoped(); services.AddScoped(); diff --git a/Yi.Framework/Yi.Framework.Common/Class1.cs b/Yi.Framework/Yi.Framework.Common/Class1.cs deleted file mode 100644 index 0c3f5493..00000000 --- a/Yi.Framework/Yi.Framework.Common/Class1.cs +++ /dev/null @@ -1,8 +0,0 @@ -锘縰sing System; - -namespace Yi.Framework.Common -{ - public class Class1 - { - } -} diff --git a/Yi.Framework/Yi.Framework.Common/IOCOptions/KafkaOptions.cs b/Yi.Framework/Yi.Framework.Common/IOCOptions/KafkaOptions.cs index 7afcc735..cfc6955e 100644 --- a/Yi.Framework/Yi.Framework.Common/IOCOptions/KafkaOptions.cs +++ b/Yi.Framework/Yi.Framework.Common/IOCOptions/KafkaOptions.cs @@ -8,7 +8,6 @@ namespace Yi.Framework.Common.IOCOptions { public class KafkaOptions { - public string BrokerList { get; set; } public string TopicName { get; set; } } diff --git a/Yi.Framework/Yi.Framework.Core/RabbitMQInvoker.cs b/Yi.Framework/Yi.Framework.Core/RabbitMQInvoker.cs index 0b7da2cd..8a6f92d3 100644 --- a/Yi.Framework/Yi.Framework.Core/RabbitMQInvoker.cs +++ b/Yi.Framework/Yi.Framework.Core/RabbitMQInvoker.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using Yi.Framework.Common.IOCOptions; -namespace CC.ElectronicCommerce.Core +namespace Yi.Framework.Core { /// /// 涓涓狤xchange----澶氫釜Queue-----寮勪釜缂撳瓨鏄犲皠鍏崇郴锛屽垵濮嬪寲+鏀寔鍏ㄦ柊缁戝畾 diff --git a/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RabbitMQExtension.cs b/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RabbitMQExtension.cs new file mode 100644 index 00000000..2847fb98 --- /dev/null +++ b/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RabbitMQExtension.cs @@ -0,0 +1,21 @@ +锘縰sing Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.OpenApi.Models; +using System; +using System.IO; +using Yi.Framework.Common.IOCOptions; + +namespace Yi.Framework.WebCore.MiddlewareExtend +{ + /// + /// Redis鎵╁睍 + /// + public static class RabbitMQExtension + { + public static IServiceCollection AddRabbitMQService(this IServiceCollection services) + { + Appsettings.app("RabbitConn"); + return services; + } + } +} diff --git a/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisExtension.cs b/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisExtension.cs new file mode 100644 index 00000000..bfa248d4 --- /dev/null +++ b/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisExtension.cs @@ -0,0 +1,21 @@ +锘縰sing Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.OpenApi.Models; +using System; +using System.IO; +using Yi.Framework.Common.IOCOptions; + +namespace Yi.Framework.WebCore.MiddlewareExtend +{ + /// + /// Redis鎵╁睍 + /// + public static class RedisExtension + { + public static IServiceCollection AddRedisService(this IServiceCollection services) + { + Appsettings.app("RedisConn"); + return services; + } + } +}