xf 1 жил өмнө
parent
commit
972371356f

+ 6 - 3
src/Sharing.Api/StartupExtensions.cs

@@ -5,6 +5,7 @@ using MediatR.NotificationPublishers;
 using Serilog;
 using Serilog;
 using Sharing.Application;
 using Sharing.Application;
 using Sharing.Province;
 using Sharing.Province;
+using Sharing.Province.Handlers.HuiJu;
 using Sharing.Repository.Extensions;
 using Sharing.Repository.Extensions;
 using XF.Domain.Dependency;
 using XF.Domain.Dependency;
 using XF.Domain.Filters;
 using XF.Domain.Filters;
@@ -63,15 +64,17 @@ internal static class StartupExtensions
         services.RegisterMapper();
         services.RegisterMapper();
 
 
         //mediatr
         //mediatr
-        services.AddMediatR(cfg => {
-            cfg.RegisterServicesFromAssemblyContaining<Program>();
+        services.AddMediatR(cfg =>
+        {
+            cfg.RegisterServicesFromAssembly(typeof(StartupExtensions).Assembly);
             cfg.NotificationPublisher = new TaskWhenAllPublisher(); // this will be singleton
             cfg.NotificationPublisher = new TaskWhenAllPublisher(); // this will be singleton
             cfg.NotificationPublisherType = typeof(TaskWhenAllPublisher); // this will be the ServiceLifetime
             cfg.NotificationPublisherType = typeof(TaskWhenAllPublisher); // this will be the ServiceLifetime
+            cfg.RegisterProvinceServices();
         });
         });
 
 
         //sqlsugar
         //sqlsugar
         services.AddSqlSugar(configuration, "Sharing");
         services.AddSqlSugar(configuration, "Sharing");
-        
+
         //cache
         //cache
         services.AddCache(d =>
         services.AddCache(d =>
         {
         {

+ 0 - 2
src/Sharing.Province/Controllers/ProvinceController.cs

@@ -57,8 +57,6 @@ namespace Sharing.Province.Controllers
         [AllowAnonymous]
         [AllowAnonymous]
         public async Task<string> GetCaseResultReceive([FromBody] KnowledgeInfoSendInfo dto)
         public async Task<string> GetCaseResultReceive([FromBody] KnowledgeInfoSendInfo dto)
         {
         {
-            await _mediator.Publish(new OrderCreatedNotification(new SubmitCaseInfo()));
-
             var data = _mapper.Map<GetKnowledgeInfoSend>(dto);
             var data = _mapper.Map<GetKnowledgeInfoSend>(dto);
 
 
             //将上报信息写入本地库
             //将上报信息写入本地库

+ 5 - 0
src/Sharing.Province/StartupExtensions.cs

@@ -13,5 +13,10 @@ namespace Sharing.Province
         {
         {
             return services;
             return services;
         }
         }
+
+        public static void RegisterProvinceServices(this MediatRServiceConfiguration config)
+        {
+            config.RegisterServicesFromAssembly(typeof(StartupExtensions).Assembly);
+        }
     }
     }
 }
 }