diff --git a/Directory.Build.props b/Directory.Build.props
index d025984..50d35d0 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -8,6 +8,7 @@
enable
enable
true
+ true
$(NoWarn);1591;EXTEXP0018
$(WarningsNotAsErrors);CS1591
diff --git a/MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/MS.Microservice.Persistence.EFCore.slnx b/MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/MS.Microservice.Persistence.EFCore.slnx
new file mode 100644
index 0000000..4f79666
--- /dev/null
+++ b/MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/MS.Microservice.Persistence.EFCore.slnx
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/MS.Microservice.Infrastructure/DbContext/ActivationDbContext.cs b/MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/ActivationDbContext.cs
similarity index 65%
rename from src/MS.Microservice.Infrastructure/DbContext/ActivationDbContext.cs
rename to MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/ActivationDbContext.cs
index 3f1542d..4a5db48 100644
--- a/src/MS.Microservice.Infrastructure/DbContext/ActivationDbContext.cs
+++ b/MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/ActivationDbContext.cs
@@ -1,295 +1,212 @@
-using MS.Microservice.Core.Domain.Entity;
-using MS.Microservice.Core.Domain.Repository;
-using MS.Microservice.Domain;
-using MS.Microservice.Domain.Aggregates.IdentityModel;
-using MS.Microservice.Domain.Events;
-using MS.Microservice.Infrastructure.EntityConfigurations;
-using MS.Microservice.Infrastructure.Messaging;
-using Wolverine;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Design;
-using Microsoft.EntityFrameworkCore.Storage;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Options;
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.IO;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Action = MS.Microservice.Domain.Aggregates.IdentityModel.Action;
-using EfCoreDbContext = Microsoft.EntityFrameworkCore.DbContext;
-using MS.Microservice.Domain.Aggregates.LogAggregate;
-using System.Collections.Generic;
-
-namespace MS.Microservice.Infrastructure.DbContext
-{
- public class ActivationDbContext : EfCoreDbContext, IUnitOfWork
- {
- public const string DEFAULT_SCHEMA = "fz_platform_activation";
- [NotNull]
- public DbSet? Users { get; set; }
- [NotNull]
- public DbSet? Roles { get; set; }
- [NotNull]
- public DbSet? Actions { get; set; }
- [NotNull]
- public DbSet? RoleActions { get; set; }
- [NotNull]
- public DbSet? Logs { get; set; }
- //public DbSet MerchandiseSubjects { get; set; }
- private readonly IDomainEventDispatcher _domainEventDispatcher;
- private readonly MsPlatformDbContextSettings _platformDbContextOption;
-
- public ActivationDbContext(
- DbContextOptions dbContextOptions,
- IOptions settingsOptions,
- IMessageBus messageBus) : base(dbContextOptions)
- {
- ArgumentNullException.ThrowIfNull(messageBus);
- _domainEventDispatcher = new WolverineDomainEventDispatcher(messageBus);
- _platformDbContextOption = settingsOptions?.Value ?? throw new ArgumentNullException(nameof(settingsOptions));
- }
-
- public ActivationDbContext(
- DbContextOptions dbContextOptions,
- IOptions settingsOptions,
- IDomainEventDispatcher domainEventDispatcher) : base(dbContextOptions)
- {
- _domainEventDispatcher = domainEventDispatcher ?? throw new ArgumentNullException(nameof(domainEventDispatcher));
- _platformDbContextOption = settingsOptions?.Value ?? throw new ArgumentNullException(nameof(settingsOptions));
- }
-
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder.EnableSensitiveDataLogging();
- base.OnConfiguring(optionsBuilder);
- }
-
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- if (_platformDbContextOption.EnabledSoftDeleted)
- {
- EnableSoftDeletedQueryFilter(modelBuilder);
- }
- modelBuilder.ApplyConfiguration(new LogEntityTypeConfiguration());
- //modelBuilder.ApplyConfiguration(new UseActivationDeviceEntityTypeConfiguration());
- modelBuilder.ApplyConfiguration(new IdentityUserEntityTypeConfiguration());
- modelBuilder.ApplyConfiguration(new IdentityRoleEntityTypeConfiguration());
- modelBuilder.ApplyConfiguration(new IdentityActionEntityTypeConfiguration());
- //modelBuilder.ApplyConfigurationsFromAssembly(typeof(ActivateBatchEntityTypeConfiguration).Assembly);
-
- SettingDatetimePrecision(modelBuilder);
- }
-
- private static void SettingDatetimePrecision(ModelBuilder modelBuilder)
- {
- var properties = modelBuilder.Model.GetEntityTypes()
- .SelectMany(t => t.GetProperties());
-
- foreach (var property in properties
- .Where(p => p.ClrType == typeof(DateTime) || p.ClrType == typeof(DateTime?)))
- {
- // EF Core 5
- property.SetPrecision(0);
- }
- }
-
- private static void EnableSoftDeletedQueryFilter(ModelBuilder modelBuilder)
- {
- foreach (var entityType in modelBuilder.Model.GetEntityTypes())
- {
- if (typeof(ISoftDeleted).IsAssignableFrom(entityType.ClrType))
- {
- entityType.AddSoftDeletedQueryFilter();
- }
- }
- }
-
- public override async Task SaveChangesAsync(CancellationToken cancellationToken = default)
- {
- if (_platformDbContextOption.EnabledAutoTimeTracker())
- {
- var entries = ChangeTracker.Entries()
- .Where(e => e.Entity is ICreatedAt || e.Entity is IUpdatedAt)
- .Where(e => e.State == EntityState.Added || e.State == EntityState.Modified);
-
- foreach (var entityEntry in entries)
- {
- if (entityEntry.Entity is IUpdatedAt updatedAt)
- {
- updatedAt.UpdatedAt = DateTime.Now;
- }
-
- if (entityEntry.State == EntityState.Added)
- {
- ((ICreatedAt)entityEntry.Entity).CreatedAt = DateTime.Now;
- }
- }
- }
- return await base.SaveChangesAsync(cancellationToken);
- }
- public async Task SaveEntitiesAsync(CancellationToken cancellationToken = default)
- {
- var domainEntities = ChangeTracker
- .Entries()
- .Select(entry => entry.Entity)
- .OfType()
- .Where(entity => entity.DomainEvents.Count != 0)
- .ToList();
-
- var domainEvents = domainEntities
- .SelectMany(entity => entity.DomainEvents)
- .ToList();
-
- await SaveChangesAsync(cancellationToken);
-
- if (domainEvents.Count != 0)
- {
- await _domainEventDispatcher.DispatchAsync(domainEvents, cancellationToken);
- domainEntities.ForEach(entity => entity.ClearDomainEvents());
- }
-
- return true;
- }
-
- #region 事务
- private IDbContextTransaction? _currentTransaction;
- public async Task BeginTransactionAsync(CancellationToken cancellationToken = default)
- {
- if (_currentTransaction != null)
- {
- return null;
- }
- _currentTransaction = await Database.BeginTransactionAsync(System.Data.IsolationLevel.ReadCommitted, cancellationToken);
-
- return _currentTransaction;
- }
-
- public async Task CommitTransactionAsync([NotNull] IDbContextTransaction transaction, CancellationToken cancellationToken = default)
- {
- ArgumentNullException.ThrowIfNull(transaction);
- if (transaction != _currentTransaction) throw new InvalidOperationException($"Transaction {transaction.TransactionId} is not current");
-
- try
- {
- await SaveChangesAsync(cancellationToken);
- await transaction.CommitAsync(cancellationToken);
- }
- catch
- {
- await _currentTransaction.RollbackAsync(cancellationToken);
- }
- finally
- {
- if (_currentTransaction != null)
- {
- await _currentTransaction.DisposeAsync();
- _currentTransaction = null;
- }
- }
- }
- #endregion
- }
-
- public class ActivationDbContextDesignFactory : IDesignTimeDbContextFactory
- {
- public ActivationDbContext CreateDbContext(string[] args)
- {
- var configuration = BuildConfiguration();
- var connectionString = configuration.GetConnectionString("ActivationConnection")
- ?? throw new InvalidOperationException("ConnectionStrings:ActivationConnection is required.");
- var builder = new DbContextOptionsBuilder()
- //.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString));
- .UseNpgsql(connectionString);
-
- var settings = configuration
- .GetSection(MsPlatformDbContextSettings.SectionName)
- .Get() ?? new MsPlatformDbContextSettings();
-
- return new ActivationDbContext(builder.Options, Options.Create(settings), new NoOpDomainEventDispatcher());
- }
-
- private static IConfigurationRoot BuildConfiguration()
- {
- var builder = new ConfigurationBuilder()
- .SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../Migrators/"))
- .AddJsonFile("appsettings.Development.json", optional: false);
-
- return builder.Build();
- }
-
- ///
- /// A no-op implementation of IMessageBus for design-time DbContext creation
- ///
- class NoMessageBus : IMessageBus
- {
- public string? CorrelationId { get; set; }
- public string? TenantId { get; set; }
-
- public ValueTask SendAsync(T message, DeliveryOptions? options = null)
- {
- return ValueTask.CompletedTask;
- }
-
- public ValueTask PublishAsync(T message, DeliveryOptions? options = null)
- {
- return ValueTask.CompletedTask;
- }
-
- public ValueTask BroadcastToTopicAsync(string topicName, object message, DeliveryOptions? options = null)
- {
- return ValueTask.CompletedTask;
- }
-
- public Task InvokeAsync(object message, CancellationToken cancellation = default, TimeSpan? timeout = null)
- {
- return Task.FromResult(default!);
- }
-
- public Task InvokeAsync(object message, DeliveryOptions options, CancellationToken cancellation = default, TimeSpan? timeout = null)
- {
- return Task.FromResult(default!);
- }
-
- public Task InvokeAsync(object message, CancellationToken cancellation = default, TimeSpan? timeout = null)
- {
- return Task.CompletedTask;
- }
-
- public Task InvokeAsync(object message, DeliveryOptions options, CancellationToken cancellation = default, TimeSpan? timeout = null)
- {
- return Task.CompletedTask;
- }
- public Task InvokeForTenantAsync(string tenantId, object message, CancellationToken cancellation = default, TimeSpan? timeout = null)
- {
- return Task.FromResult(default!);
- }
-
- public Task InvokeForTenantAsync(string tenantId, object message, CancellationToken cancellation = default, TimeSpan? timeout = null)
- {
- return Task.CompletedTask;
- }
-
- public IDestinationEndpoint EndpointFor(string endpointName)
- {
- return null!;
- }
-
- public IDestinationEndpoint EndpointFor(Uri uri)
- {
- return null!;
- }
-
- public IReadOnlyList PreviewSubscriptions(object message, DeliveryOptions? options = null)
- {
- return Array.Empty();
- }
-
- public IReadOnlyList PreviewSubscriptions(object message)
- {
- return Array.Empty();
- }
- }
- }
-}
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Design;
+using Microsoft.EntityFrameworkCore.Storage;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Options;
+using MS.Microservice.Core.Domain.Entity;
+using MS.Microservice.Core.Domain.Repository;
+using MS.Microservice.Domain;
+using MS.Microservice.Domain.Aggregates.IdentityModel;
+using MS.Microservice.Domain.Aggregates.LogAggregate;
+using MS.Microservice.Domain.Events;
+using MS.Microservice.Persistence.EFCore.EntityConfigurations;
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Action = MS.Microservice.Domain.Aggregates.IdentityModel.Action;
+using EfCoreDbContext = Microsoft.EntityFrameworkCore.DbContext;
+
+namespace MS.Microservice.Persistence.EFCore.DbContext
+{
+ public class ActivationDbContext : EfCoreDbContext, IUnitOfWork
+ {
+ public const string DEFAULT_SCHEMA = "fz_platform_activation";
+
+ [NotNull]
+ public DbSet? Users { get; set; }
+
+ [NotNull]
+ public DbSet? Roles { get; set; }
+
+ [NotNull]
+ public DbSet? Actions { get; set; }
+
+ [NotNull]
+ public DbSet? RoleActions { get; set; }
+
+ [NotNull]
+ public DbSet? Logs { get; set; }
+
+ private readonly IDomainEventDispatcher _domainEventDispatcher;
+ private readonly MsPlatformDbContextSettings _platformDbContextOption;
+
+ public ActivationDbContext(
+ DbContextOptions dbContextOptions,
+ IOptions settingsOptions,
+ IDomainEventDispatcher domainEventDispatcher) : base(dbContextOptions)
+ {
+ _domainEventDispatcher = domainEventDispatcher ?? throw new ArgumentNullException(nameof(domainEventDispatcher));
+ _platformDbContextOption = settingsOptions?.Value ?? throw new ArgumentNullException(nameof(settingsOptions));
+ }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.EnableSensitiveDataLogging();
+ base.OnConfiguring(optionsBuilder);
+ }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ if (_platformDbContextOption.EnabledSoftDeleted)
+ {
+ EnableSoftDeletedQueryFilter(modelBuilder);
+ }
+
+ modelBuilder.ApplyConfiguration(new LogEntityTypeConfiguration());
+ modelBuilder.ApplyConfiguration(new IdentityUserEntityTypeConfiguration());
+ modelBuilder.ApplyConfiguration(new IdentityRoleEntityTypeConfiguration());
+ modelBuilder.ApplyConfiguration(new IdentityActionEntityTypeConfiguration());
+
+ SettingDatetimePrecision(modelBuilder);
+ }
+
+ private static void SettingDatetimePrecision(ModelBuilder modelBuilder)
+ {
+ var properties = modelBuilder.Model.GetEntityTypes()
+ .SelectMany(t => t.GetProperties());
+
+ foreach (var property in properties
+ .Where(p => p.ClrType == typeof(DateTime) || p.ClrType == typeof(DateTime?)))
+ {
+ property.SetPrecision(0);
+ }
+ }
+
+ private static void EnableSoftDeletedQueryFilter(ModelBuilder modelBuilder)
+ {
+ foreach (var entityType in modelBuilder.Model.GetEntityTypes())
+ {
+ if (typeof(ISoftDeleted).IsAssignableFrom(entityType.ClrType))
+ {
+ entityType.AddSoftDeletedQueryFilter();
+ }
+ }
+ }
+
+ public override async Task SaveChangesAsync(CancellationToken cancellationToken = default)
+ {
+ if (_platformDbContextOption.EnabledAutoTimeTracker())
+ {
+ var entries = ChangeTracker.Entries()
+ .Where(e => e.Entity is ICreatedAt || e.Entity is IUpdatedAt)
+ .Where(e => e.State == EntityState.Added || e.State == EntityState.Modified);
+
+ foreach (var entityEntry in entries)
+ {
+ if (entityEntry.Entity is IUpdatedAt updatedAt)
+ {
+ updatedAt.UpdatedAt = DateTime.Now;
+ }
+
+ if (entityEntry.State == EntityState.Added)
+ {
+ ((ICreatedAt)entityEntry.Entity).CreatedAt = DateTime.Now;
+ }
+ }
+ }
+
+ return await base.SaveChangesAsync(cancellationToken);
+ }
+
+ public async Task SaveEntitiesAsync(CancellationToken cancellationToken = default)
+ {
+ var domainEntities = ChangeTracker
+ .Entries()
+ .Select(entry => entry.Entity)
+ .OfType()
+ .Where(entity => entity.DomainEvents.Count != 0)
+ .ToList();
+
+ var domainEvents = domainEntities
+ .SelectMany(entity => entity.DomainEvents)
+ .ToList();
+
+ await SaveChangesAsync(cancellationToken);
+
+ if (domainEvents.Count != 0)
+ {
+ await _domainEventDispatcher.DispatchAsync(domainEvents, cancellationToken);
+ domainEntities.ForEach(entity => entity.ClearDomainEvents());
+ }
+
+ return true;
+ }
+
+ private IDbContextTransaction? _currentTransaction;
+
+ public async Task BeginTransactionAsync(CancellationToken cancellationToken = default)
+ {
+ if (_currentTransaction != null)
+ {
+ return null;
+ }
+
+ _currentTransaction = await Database.BeginTransactionAsync(System.Data.IsolationLevel.ReadCommitted, cancellationToken);
+ return _currentTransaction;
+ }
+
+ public async Task CommitTransactionAsync([NotNull] IDbContextTransaction transaction, CancellationToken cancellationToken = default)
+ {
+ ArgumentNullException.ThrowIfNull(transaction);
+ if (transaction != _currentTransaction) throw new InvalidOperationException($"Transaction {transaction.TransactionId} is not current");
+
+ try
+ {
+ await SaveChangesAsync(cancellationToken);
+ await transaction.CommitAsync(cancellationToken);
+ }
+ catch
+ {
+ await _currentTransaction.RollbackAsync(cancellationToken);
+ }
+ finally
+ {
+ if (_currentTransaction != null)
+ {
+ await _currentTransaction.DisposeAsync();
+ _currentTransaction = null;
+ }
+ }
+ }
+ }
+
+ public class ActivationDbContextDesignFactory : IDesignTimeDbContextFactory
+ {
+ public ActivationDbContext CreateDbContext(string[] args)
+ {
+ var configuration = BuildConfiguration();
+ var connectionString = configuration.GetConnectionString("ActivationConnection")
+ ?? throw new InvalidOperationException("ConnectionStrings:ActivationConnection is required.");
+ var builder = new DbContextOptionsBuilder()
+ .UseNpgsql(connectionString);
+
+ var settings = configuration
+ .GetSection(MsPlatformDbContextSettings.SectionName)
+ .Get() ?? new MsPlatformDbContextSettings();
+
+ return new ActivationDbContext(builder.Options, Options.Create(settings), new NoOpDomainEventDispatcher());
+ }
+
+ private static IConfigurationRoot BuildConfiguration()
+ {
+ var builder = new ConfigurationBuilder()
+ .SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../Migrators/"))
+ .AddJsonFile("appsettings.Development.json", optional: false);
+
+ return builder.Build();
+ }
+ }
+}
diff --git a/src/MS.Microservice.Infrastructure/DbContext/EFCoreQueryableExtensions.cs b/MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/EFCoreQueryableExtensions.cs
similarity index 90%
rename from src/MS.Microservice.Infrastructure/DbContext/EFCoreQueryableExtensions.cs
rename to MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/EFCoreQueryableExtensions.cs
index 3165d06..c3d080d 100644
--- a/src/MS.Microservice.Infrastructure/DbContext/EFCoreQueryableExtensions.cs
+++ b/MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/EFCoreQueryableExtensions.cs
@@ -1,10 +1,10 @@
-using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
using MS.Microservice.Core.Specification;
-using NPOI.SS.Formula.Functions;
+using MS.Microservice.Persistence.EFCore;
using System;
using System.Linq;
-namespace MS.Microservice.Infrastructure.DbContext;
+namespace MS.Microservice.Persistence.EFCore.DbContext;
///
/// EF Core 查询扩展方法
@@ -18,25 +18,21 @@ public static partial class EfCoreQueryableExtensions
///
public IQueryable ApplySpecification(ISpecification spec, bool evaluateCriteriaOnly = false)
{
- // EF Core 特性应用
if (spec.IgnoreQueryFilters)
query = query.IgnoreQueryFilters();
- // Where 条件
if (spec.Criteria is not null)
query = query.Where(spec.Criteria);
if (evaluateCriteriaOnly)
return query;
- // Include - 使用访问者模式,无反射
var includeVisitor = new EfCoreIncludeVisitor();
foreach (var include in spec.Includes)
{
query = include.Accept(includeVisitor, query);
}
- // 排序
IOrderedQueryable? orderedQuery = null;
foreach (var order in spec.OrderExpressions)
{
@@ -61,7 +57,6 @@ public IQueryable ApplySpecification(ISpecification spec, bool evaluateCri
}
}
- // 分页
if (spec.IsPagingEnabled)
{
if (spec.Skip.HasValue) query = query.Skip(spec.Skip.Value);
@@ -87,4 +82,4 @@ public IQueryable ApplySpecification(ISpecification spec)
return appliedQuery.Select(spec.Selector);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/MS.Microservice.Infrastructure/DbContext/FzPlatformDbContextSettings.cs b/MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/MsPlatformDbContextSettings.cs
similarity index 90%
rename from src/MS.Microservice.Infrastructure/DbContext/FzPlatformDbContextSettings.cs
rename to MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/MsPlatformDbContextSettings.cs
index 9b82a61..d3dc28b 100644
--- a/src/MS.Microservice.Infrastructure/DbContext/FzPlatformDbContextSettings.cs
+++ b/MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/MsPlatformDbContextSettings.cs
@@ -1,18 +1,19 @@
-namespace MS.Microservice.Infrastructure.DbContext
-{
+namespace MS.Microservice.Persistence.EFCore.DbContext
+{
public class MsPlatformDbContextSettings
{
public const string SectionName = "FzPlatformDbContextSettings";
///
- /// 自动开启时间追踪,实体更新时,自动更新时间字段,详见以及
- ///
- public string AutoTimeTracker { get; set; } = "Disabled";
- ///
- /// 是否开启软删除
- ///
- public bool EnabledSoftDeleted { get; set; } = true;
-
- internal bool EnabledAutoTimeTracker() => AutoTimeTracker == "Enabled";
- }
-}
+ /// 自动开启时间追踪,实体更新时,自动更新时间字段,详见以及
+ ///
+ public string AutoTimeTracker { get; set; } = "Disabled";
+
+ ///
+ /// 是否开启软删除
+ ///
+ public bool EnabledSoftDeleted { get; set; } = true;
+
+ internal bool EnabledAutoTimeTracker() => AutoTimeTracker == "Enabled";
+ }
+}
diff --git a/src/MS.Microservice.Infrastructure/DbContext/SoftDeleteQueryExtensions.cs b/MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/SoftDeleteQueryExtensions.cs
similarity index 89%
rename from src/MS.Microservice.Infrastructure/DbContext/SoftDeleteQueryExtensions.cs
rename to MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/SoftDeleteQueryExtensions.cs
index 4305312..cace7c7 100644
--- a/src/MS.Microservice.Infrastructure/DbContext/SoftDeleteQueryExtensions.cs
+++ b/MS.Microservice.Persistence/MS.Microservice.Persistence.EFCore/src/MS.Microservice.Persistence.EFCore/DbContext/SoftDeleteQueryExtensions.cs
@@ -1,35 +1,35 @@
-using MS.Microservice.Core.Domain.Entity;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata;
-using System;
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace MS.Microservice.Infrastructure.DbContext
-{
- public static partial class SoftDeletedQueryExtensions
- {
- extension(IMutableEntityType entityData)
- {
- public void AddSoftDeletedQueryFilter()
- {
- var methodToCall = typeof(SoftDeletedQueryExtensions)?
- .GetMethod(nameof(GetSoftDeleteFilter),
- BindingFlags.NonPublic | BindingFlags.Static)?
- .MakeGenericMethod(entityData.ClrType);
- var filter = methodToCall?.Invoke(null, Array.Empty