Browse Source

Merge pull request #5372 from abpframework/liangshiwei/patch-1

Update data-filtering.md
pull/5373/head
liangshiwei 6 years ago
committed by GitHub
parent
commit
0070f2d5b8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      docs/en/Data-Filtering.md
  2. 4
      docs/zh-Hans/Data-Filtering.md

6
docs/en/Data-Filtering.md

@ -156,14 +156,14 @@ Best way to implement a custom filter is to override `ShouldFilterEntity` and `
````csharp
protected bool IsActiveFilterEnabled => DataFilter?.IsEnabled<IIsActive>() ?? false;
protected override bool ShouldFilterEntity<TEntity>(IMutableEntityType entityType) where TEntity : class
protected override bool ShouldFilterEntity<TEntity>(IMutableEntityType entityType)
{
if (typeof(IIsActive).IsAssignableFrom(typeof(TEntity)))
{
return true;
}
return base.ShouldFilterEntity<TEntity>();
return base.ShouldFilterEntity<TEntity>(entityType);
}
protected override Expression<Func<TEntity, bool>> CreateFilterExpression<TEntity>()
@ -184,7 +184,7 @@ protected override Expression<Func<TEntity, bool>> CreateFilterExpression<TEntit
````
* Added a `IsActiveFilterEnabled` property to check if `IIsActive` is enabled or not. It internally uses the `IDataFilter` service introduced before.
* Overrided the `ShouldFilterEntity` and `CreateFilterExpression` method, checked if given entity implements the `IIsActive` interface and combines the expressions if necessary.
* Overrided the `ShouldFilterEntity` and `CreateFilterExpression` methods, checked if given entity implements the `IIsActive` interface and combines the expressions if necessary.
### MongoDB

4
docs/zh-Hans/Data-Filtering.md

@ -156,14 +156,14 @@ ABP使用[EF Core的全局过滤](https://docs.microsoft.com/en-us/ef/core/query
````csharp
protected bool IsActiveFilterEnabled => DataFilter?.IsEnabled<IIsActive>() ?? false;
protected override bool ShouldFilterEntity<TEntity>(IMutableEntityType entityType) where TEntity : class
protected override bool ShouldFilterEntity<TEntity>(IMutableEntityType entityType)
{
if (typeof(IIsActive).IsAssignableFrom(typeof(TEntity)))
{
return true;
}
return base.ShouldFilterEntity<TEntity>();
return base.ShouldFilterEntity<TEntity>(entityType);
}
protected override Expression<Func<TEntity, bool>> CreateFilterExpression<TEntity>()

Loading…
Cancel
Save