From ed84cef3749c5f2ac9f9093a7cb50dc55c5dd852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 20 Nov 2021 18:59:44 +0300 Subject: [PATCH] Change how to replace the payment dbcontext. --- .../EventHubEntityFrameworkCoreModule.cs | 6 +----- .../EntityFrameworkCore/Payment/EventHubPaymentDbContext.cs | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubEntityFrameworkCoreModule.cs b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubEntityFrameworkCoreModule.cs index 6b6ea90..4135599 100644 --- a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubEntityFrameworkCoreModule.cs +++ b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubEntityFrameworkCoreModule.cs @@ -48,11 +48,7 @@ namespace EventHub.EntityFrameworkCore }); /* Registering the payment dbcontext and replacing the module's dbcontext */ - context.Services.AddAbpDbContext(options => - { - options.ReplaceDbContext(); - options.AddDefaultRepositories(); - }); + context.Services.AddAbpDbContext(); Configure(options => { diff --git a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Payment/EventHubPaymentDbContext.cs b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Payment/EventHubPaymentDbContext.cs index a97cb02..5fb930d 100644 --- a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Payment/EventHubPaymentDbContext.cs +++ b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Payment/EventHubPaymentDbContext.cs @@ -3,10 +3,12 @@ using Payment; using Payment.EntityFrameworkCore; using Payment.PaymentRequests; using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; using Volo.Abp.EntityFrameworkCore; namespace EventHub.EntityFrameworkCore.Payment { + [ReplaceDbContext(typeof(IPaymentDbContext))] [ConnectionStringName(PaymentDbProperties.ConnectionStringName)] public class EventHubPaymentDbContext : AbpDbContext, IPaymentDbContext {