Extend DataFilter implementation #7706
Open
+492
−51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I would like to propose some updates to the DataFilter implementation. The changes should be non-breaking as the base functionality remains the same, with an additional
IsActive
attribute along with some additional useful methods.I have made a number of changes but my main motivation is to know which filters are currently 'active' (being used within a disposable scope). Having access to information about the filters is also very useful.
Because DataFilter is
ISingletonDependency
the cached filters are kept in memory after their first use. TheIsEnabled
property isn't a reliable source because the defaultIsEnabled
value can be changed per filter withAbpDataFilterOptions
. I tried making theDataFilter
Scoped; but the scope can change within a request so the filters reset.I have added various tests to ensure these work within all common scenarios and I've added documentation to guide developers for the correct use of each method.
Initially, I intend to use this in conjunction with the abp-queryfilter-test project I am working on (mentioned here) - where you can the proposed changes in use.
Changes include: