Browse Source

fix(migrations): 修复迁移时DI容器不可用(#1011)

pull/1015/head
colin 1 year ago
parent
commit
8130ce789b
  1. 3
      aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectionDbContext.cs

3
aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectionDbContext.cs

@ -24,11 +24,14 @@ public abstract class AbpDataProtectionDbContext<TDbContext> : AbpDbContext<TDbC
{ {
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);
if (LazyServiceProvider != null)
{
// TODO: 需要优化表达式树 // TODO: 需要优化表达式树
// optionsBuilder.AddInterceptors(LazyServiceProvider.GetRequiredService<AbpDataProtectedReadEntityInterceptor>()); // optionsBuilder.AddInterceptors(LazyServiceProvider.GetRequiredService<AbpDataProtectedReadEntityInterceptor>());
//optionsBuilder.AddInterceptors(LazyServiceProvider.GetRequiredService<AbpDataProtectedWriteEntityInterceptor>()); //optionsBuilder.AddInterceptors(LazyServiceProvider.GetRequiredService<AbpDataProtectedWriteEntityInterceptor>());
optionsBuilder.AddInterceptors(LazyServiceProvider.GetRequiredService<AbpDataProtectedWritePropertiesInterceptor>()); optionsBuilder.AddInterceptors(LazyServiceProvider.GetRequiredService<AbpDataProtectedWritePropertiesInterceptor>());
} }
}
protected override void ApplyAbpConceptsForAddedEntity(EntityEntry entry) protected override void ApplyAbpConceptsForAddedEntity(EntityEntry entry)
{ {

Loading…
Cancel
Save