我正在尝试为IMayHaveCreator配置新的数据过滤器。我看到了ISoftDelete的例子,并做了同样的事情。
在MyAppEntityFrameworkCoreModule中,ive为过滤器添加了另一种配置方法,但它不起作用
public class SimplyAirEntityFrameworkCoreModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
SimplyAirEfCoreEntityExtensionMappings.Configure();
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<SimplyAirDbContext>(options =>
{
/* Remove "includeAllEntities: true" to create
* default repositories only for aggregate roots */
options.AddDefaultRepositories(includeAllEntities: true);
});
Configure<AbpDbContextOptions>(options =>
{
/* The main point to change your DBMS.
* See also SimplyAirMigrationsDbContextFactory for EF Core tooling. */
options.UseNpgsql();
});
Configure<AbpDataFilterOptions>(options =>
{
options.DefaultStates[typeof(IMayHaveCreator)] = new DataFilterState(isEnabled: true);
});
}
}我是不是做错了什么
发布于 2021-09-03 21:11:22
我已经设法实现了它。解决方案是在dbContext中为该接口添加CreateFilterExpression和ShouldFilterEntity方法覆盖
https://stackoverflow.com/questions/69037539
复制相似问题