From 68009f37ab236f0e05e76a62c135685def6048a5 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Sat, 26 Mar 2022 15:09:21 +0800 Subject: [PATCH] fix: remove the unique constraint for foreign keys --- .../LINGYUN.Abp.WebHooks.csproj | 2 +- .../LINGYUN/Abp/Webhooks/AbpWebhooksModule.cs | 28 +++++++++++++-- .../Abp/Webhooks/DefaultWebhookPublisher.cs | 8 +++-- .../Abp/Webhooks/DefaultWebhookSender.cs | 3 +- .../Webhooks/WebhookSubscriptionManager.cs | 3 +- .../Localization/Resources/en.json | 4 ++- .../Localization/Resources/zh-Hans.json | 4 ++- .../DefaultWebhookManager.cs | 36 ++++++++----------- .../WebhookSubscriptionsStore.cs | 25 +++++++------ .../Webhooks/WebhooksDefinitionProvider.cs | 22 ++++++++++++ .../Webhooks/WebhooksNames.cs | 6 ++++ ...agementDbContextModelCreatingExtensions.cs | 3 ++ ...dd-Module-WebHooks-Management.Designer.cs} | 5 ++- ...6064231_Add-Module-WebHooks-Management.cs} | 3 +- ...agementMigrationsDbContextModelSnapshot.cs | 3 +- ...ksManagementHttpApiHostModule.Configure.cs | 7 +++- .../WebhooksManagementHttpApiHostModule.cs | 2 +- 17 files changed, 113 insertions(+), 51 deletions(-) create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksDefinitionProvider.cs create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksNames.cs rename aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/{20220326052244_Add-Module-WebHooks-Management.Designer.cs => 20220326064231_Add-Module-WebHooks-Management.Designer.cs} (95%) rename aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/{20220326052244_Add-Module-WebHooks-Management.cs => 20220326064231_Add-Module-WebHooks-Management.cs} (96%) diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN.Abp.WebHooks.csproj b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN.Abp.WebHooks.csproj index ca6031c7a..2cd64673f 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN.Abp.WebHooks.csproj +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN.Abp.WebHooks.csproj @@ -9,7 +9,7 @@ - + diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/AbpWebhooksModule.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/AbpWebhooksModule.cs index 03af8e4ef..deabfcd79 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/AbpWebhooksModule.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/AbpWebhooksModule.cs @@ -1,4 +1,7 @@ -using Volo.Abp.BackgroundJobs; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using Volo.Abp.BackgroundJobs; using Volo.Abp.Features; using Volo.Abp.Guids; using Volo.Abp.Http.Client; @@ -6,7 +9,9 @@ using Volo.Abp.Modularity; namespace LINGYUN.Abp.Webhooks; -[DependsOn(typeof(AbpBackgroundJobsAbstractionsModule))] +//[DependsOn(typeof(AbpBackgroundJobsAbstractionsModule))] +// 防止未引用实现无法发布到后台作业 +[DependsOn(typeof(AbpBackgroundJobsModule))] [DependsOn(typeof(AbpFeaturesModule))] [DependsOn(typeof(AbpGuidsModule))] [DependsOn(typeof(AbpHttpClientModule))] @@ -14,5 +19,24 @@ public class AbpWebhooksModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { + AutoAddDefinitionProviders(context.Services); + } + + private static void AutoAddDefinitionProviders(IServiceCollection services) + { + var definitionProviders = new List(); + + services.OnRegistred(context => + { + if (typeof(WebhookDefinitionProvider).IsAssignableFrom(context.ImplementationType)) + { + definitionProviders.Add(context.ImplementationType); + } + }); + + services.Configure(options => + { + options.DefinitionProviders.AddIfNotContains(definitionProviders); + }); } } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/DefaultWebhookPublisher.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/DefaultWebhookPublisher.cs index 176614535..59ed0b102 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/DefaultWebhookPublisher.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/DefaultWebhookPublisher.cs @@ -6,10 +6,11 @@ using System.Threading.Tasks; using Volo.Abp.BackgroundJobs; using Volo.Abp.Guids; using Volo.Abp.MultiTenancy; +using Volo.Abp.DependencyInjection; namespace LINGYUN.Abp.Webhooks { - public class DefaultWebhookPublisher : IWebhookPublisher + public class DefaultWebhookPublisher : IWebhookPublisher, ITransientDependency { public IWebhookEventStore WebhookEventStore { get; set; } @@ -128,13 +129,14 @@ namespace LINGYUN.Abp.Webhooks { var webhookInfo = new WebhookEvent { - Id = _guidGenerator.Create(), WebhookName = webhookName, Data = JsonConvert.SerializeObject(data), TenantId = tenantId }; - await WebhookEventStore.InsertAndGetIdAsync(webhookInfo); + var webhookId = await WebhookEventStore.InsertAndGetIdAsync(webhookInfo); + webhookInfo.Id = webhookId; + return webhookInfo; } } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/DefaultWebhookSender.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/DefaultWebhookSender.cs index 2dc939dc7..29ce6cb96 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/DefaultWebhookSender.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/DefaultWebhookSender.cs @@ -5,10 +5,11 @@ using System; using System.Net; using System.Net.Http; using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; namespace LINGYUN.Abp.Webhooks { - public class DefaultWebhookSender : IWebhookSender + public class DefaultWebhookSender : IWebhookSender, ITransientDependency { public ILogger Logger { protected get; set; } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookSubscriptionManager.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookSubscriptionManager.cs index 9db42f506..fe1a9c697 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookSubscriptionManager.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookSubscriptionManager.cs @@ -3,12 +3,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp.Authorization; +using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; using Volo.Abp.Uow; namespace LINGYUN.Abp.Webhooks { - public class WebhookSubscriptionManager : IWebhookSubscriptionManager + public class WebhookSubscriptionManager : IWebhookSubscriptionManager, ITransientDependency { public IWebhookSubscriptionsStore WebhookSubscriptionsStore { get; set; } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json index 653188d9b..5e4cfe7f2 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json @@ -3,6 +3,8 @@ "texts": { "Features:WebhooksManagement": "Webhooks", "Permission:WebhooksManagement": "Webhooks", - "Permission:ManageSettings": "Manage Settings" + "Permission:ManageSettings": "Manage Settings", + "DisplayName:CheckConnect": "Check Connect", + "Description:CheckConnect": "When a third-party service is connected, it is used to check whether the communication is normal." } } \ No newline at end of file diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json index bfcd4d2a2..bd1941dd4 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json @@ -3,6 +3,8 @@ "texts": { "Features:WebhooksManagement": "Webhooks", "Permission:WebhooksManagement": "Webhooks", - "Permission:ManageSettings": "管理设置" + "Permission:ManageSettings": "管理设置", + "DisplayName:CheckConnect": "检查连接", + "Description:CheckConnect": "第三方服务接入时,用于检查是否通讯正常." } } \ No newline at end of file diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DefaultWebhookManager.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DefaultWebhookManager.cs index 8b8b56129..c0ab03de1 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DefaultWebhookManager.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DefaultWebhookManager.cs @@ -29,40 +29,32 @@ public class DefaultWebhookManager : WebhookManager, ITransientDependency WebhookSendAttemptRepository = webhookSendAttemptRepository; } + [UnitOfWork] public async override Task InsertAndGetIdWebhookSendAttemptAsync(WebhookSenderArgs webhookSenderArgs) { - using (var uow = UnitOfWorkManager.Begin()) + using (CurrentTenant.Change(webhookSenderArgs.TenantId)) { - using (CurrentTenant.Change(webhookSenderArgs.TenantId)) - { - var record = new WebhookSendRecord( - GuidGenerator.Create(), - webhookSenderArgs.WebhookEventId, - webhookSenderArgs.WebhookSubscriptionId, - webhookSenderArgs.TenantId); + var record = new WebhookSendRecord( + GuidGenerator.Create(), + webhookSenderArgs.WebhookEventId, + webhookSenderArgs.WebhookSubscriptionId, + webhookSenderArgs.TenantId); - await WebhookSendAttemptRepository.InsertAsync(record); + await WebhookSendAttemptRepository.InsertAsync(record); - await uow.SaveChangesAsync(); - - return record.Id; - } + return record.Id; } } + [UnitOfWork] public async override Task StoreResponseOnWebhookSendAttemptAsync(Guid webhookSendAttemptId, Guid? tenantId, HttpStatusCode? statusCode, string content) { - using (var uow = UnitOfWorkManager.Begin()) + using (CurrentTenant.Change(tenantId)) { - using (CurrentTenant.Change(tenantId)) - { - var record = await WebhookSendAttemptRepository.GetAsync(webhookSendAttemptId); - record.SetResponse(content, statusCode); - - await WebhookSendAttemptRepository.UpdateAsync(record); + var record = await WebhookSendAttemptRepository.GetAsync(webhookSendAttemptId); + record.SetResponse(content, statusCode); - await uow.SaveChangesAsync(); - } + await WebhookSendAttemptRepository.UpdateAsync(record); } } } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionsStore.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionsStore.cs index c25467ef6..fb14c7bae 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionsStore.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionsStore.cs @@ -36,7 +36,9 @@ public class WebhookSubscriptionsStore : DomainService, IWebhookSubscriptionsSto { var queryable = await SubscriptionRepository.GetQueryableAsync(); - var subscriptions = await AsyncExecuter.ToListAsync(queryable.Where(x => x.TenantId == tenantId)); + queryable = queryable.Where(x => x.TenantId == tenantId); + + var subscriptions = await AsyncExecuter.ToListAsync(queryable); return subscriptions.Select(subscription => subscription.ToWebhookSubscriptionInfo()).ToList(); } @@ -49,11 +51,12 @@ public class WebhookSubscriptionsStore : DomainService, IWebhookSubscriptionsSto { var queryable = await SubscriptionRepository.GetQueryableAsync(); - var subscriptions = await AsyncExecuter.ToListAsync( - queryable.Where(x => + queryable = queryable.Where(x => x.TenantId == tenantId && x.IsActive && - x.Webhooks.Contains("\"" + webhookName + "\""))); + x.Webhooks.Contains("\"" + webhookName + "\"")); + + var subscriptions = await AsyncExecuter.ToListAsync(queryable); return subscriptions.Select(subscription => subscription.ToWebhookSubscriptionInfo()).ToList(); } @@ -79,11 +82,12 @@ public class WebhookSubscriptionsStore : DomainService, IWebhookSubscriptionsSto { var queryable = await SubscriptionRepository.GetQueryableAsync(); - var subscriptions = await AsyncExecuter.ToListAsync( - queryable.Where(x => + queryable = queryable.Where(x => x.IsActive && tenantIds.Contains(x.TenantId) && - x.Webhooks.Contains("\"" + webhookName + "\""))); + x.Webhooks.Contains("\"" + webhookName + "\"")); + + var subscriptions = await AsyncExecuter.ToListAsync(queryable); return subscriptions.Select(subscription => subscription.ToWebhookSubscriptionInfo()).ToList(); } @@ -124,11 +128,12 @@ public class WebhookSubscriptionsStore : DomainService, IWebhookSubscriptionsSto { var queryable = await SubscriptionRepository.GetQueryableAsync(); - return await AsyncExecuter.AnyAsync( - queryable.Where(x => + queryable = queryable.Where(x => x.TenantId == tenantId && x.IsActive && - x.Webhooks.Contains("\"" + webhookName + "\""))); + x.Webhooks.Contains("\"" + webhookName + "\"")); + + return await AsyncExecuter.AnyAsync(queryable); } } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksDefinitionProvider.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksDefinitionProvider.cs new file mode 100644 index 000000000..9b5e7ce48 --- /dev/null +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksDefinitionProvider.cs @@ -0,0 +1,22 @@ +using LINGYUN.Abp.Webhooks; +using LINGYUN.Abp.WebhooksManagement.Localization; +using Volo.Abp.Localization; + +namespace LINGYUN.Abp.WebhooksManagement.Webhooks; + +public class WebhooksDefinitionProvider : WebhookDefinitionProvider +{ + public override void Define(IWebhookDefinitionContext context) + { + context.Add( + new WebhookDefinition( + WebhooksNames.CheckConnect, + L("DisplayName:CheckConnect"), + L("Description:CheckConnect"))); + } + + private static ILocalizableString L(string name) + { + return LocalizableString.Create(name); + } +} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksNames.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksNames.cs new file mode 100644 index 000000000..8b185a686 --- /dev/null +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksNames.cs @@ -0,0 +1,6 @@ +namespace LINGYUN.Abp.WebhooksManagement.Webhooks; + +public static class WebhooksNames +{ + public const string CheckConnect = "Abp.Webhooks.CheckConnect"; +} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/WebhooksManagementDbContextModelCreatingExtensions.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/WebhooksManagementDbContextModelCreatingExtensions.cs index 6b6080dbe..a7b9a96e7 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/WebhooksManagementDbContextModelCreatingExtensions.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/WebhooksManagementDbContextModelCreatingExtensions.cs @@ -48,6 +48,9 @@ public static class WebhooksManagementDbContextModelCreatingExtensions .WithOne() .HasForeignKey(fk => fk.WebhookEventId) .HasPrincipalKey(pk => pk.Id ); + + b.HasIndex(p => p.WebhookEventId) + .IsUnique(false); }); builder.Entity(b => diff --git a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326052244_Add-Module-WebHooks-Management.Designer.cs b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326064231_Add-Module-WebHooks-Management.Designer.cs similarity index 95% rename from aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326052244_Add-Module-WebHooks-Management.Designer.cs rename to aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326064231_Add-Module-WebHooks-Management.Designer.cs index 51f1c05d3..1da62c921 100644 --- a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326052244_Add-Module-WebHooks-Management.Designer.cs +++ b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326064231_Add-Module-WebHooks-Management.Designer.cs @@ -12,7 +12,7 @@ using Volo.Abp.EntityFrameworkCore; namespace LY.MicroService.WebhooksManagement.Migrations { [DbContext(typeof(WebhooksManagementMigrationsDbContext))] - [Migration("20220326052244_Add-Module-WebHooks-Management")] + [Migration("20220326064231_Add-Module-WebHooks-Management")] partial class AddModuleWebHooksManagement { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -97,8 +97,7 @@ namespace LY.MicroService.WebhooksManagement.Migrations b.HasKey("Id"); - b.HasIndex("WebhookEventId") - .IsUnique(); + b.HasIndex("WebhookEventId"); b.ToTable("AbpWebhooksSendAttempts", (string)null); }); diff --git a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326052244_Add-Module-WebHooks-Management.cs b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326064231_Add-Module-WebHooks-Management.cs similarity index 96% rename from aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326052244_Add-Module-WebHooks-Management.cs rename to aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326064231_Add-Module-WebHooks-Management.cs index e2065582a..e11276c96 100644 --- a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326052244_Add-Module-WebHooks-Management.cs +++ b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220326064231_Add-Module-WebHooks-Management.cs @@ -85,8 +85,7 @@ namespace LY.MicroService.WebhooksManagement.Migrations migrationBuilder.CreateIndex( name: "IX_AbpWebhooksSendAttempts_WebhookEventId", table: "AbpWebhooksSendAttempts", - column: "WebhookEventId", - unique: true); + column: "WebhookEventId"); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs index aeb9e8c96..6acaca8a1 100644 --- a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs @@ -95,8 +95,7 @@ namespace LY.MicroService.WebhooksManagement.Migrations b.HasKey("Id"); - b.HasIndex("WebhookEventId") - .IsUnique(); + b.HasIndex("WebhookEventId"); b.ToTable("AbpWebhooksSendAttempts", (string)null); }); diff --git a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.Configure.cs b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.Configure.cs index be2cbca09..72ff2bbef 100644 --- a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.Configure.cs @@ -81,7 +81,12 @@ public partial class WebhooksManagementHttpApiHostModule // 配置Ef Configure(options => { - options.UseMySQL(); + //options.UseMySQL(); + options.Configure(cfg => + { + cfg.UseMySQL(); + cfg.DbContextOptions.EnableSensitiveDataLogging(); + }); }); } diff --git a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.cs index ec561d610..cd3d2e9be 100644 --- a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.cs @@ -86,7 +86,7 @@ public partial class WebhooksManagementHttpApiHostModule : AbpModule ConfigureSeedWorker(context.Services, hostingEnvironment.IsDevelopment()); ConfigureSecurity(context.Services, configuration, hostingEnvironment.IsDevelopment()); - // context.Services.AddAlwaysAllowAuthorization(); + context.Services.AddAlwaysAllowAuthorization(); } public override void OnApplicationInitialization(ApplicationInitializationContext context)