Browse Source

Merge pull request #1015 from colinin/fix-migrations-dbcontext

fix(migrations): 修复迁移时DI容器不可用(#1011)
pull/1050/head
yx lin 1 year ago
committed by GitHub
parent
commit
639e59298c
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  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