Skip to content

added action to filter#17

Merged
lukaferlez merged 2 commits intolukaferlez:masterfrom
matijahudin999:added-action-to-filter
Feb 26, 2026
Merged

added action to filter#17
lukaferlez merged 2 commits intolukaferlez:masterfrom
matijahudin999:added-action-to-filter

Conversation

@matijahudin999
Copy link
Contributor

Added an Action parameter to Filter in Entity.cs to allow for greater control of what happens to the DB query.

@lukaferlez
Copy link
Owner

This change is going to break a lot of existing implementation and usages, as you can see from the amount of test you need to change. This shouldn't be done.

Non breakable way is to introduce a new protected virtual method that would return the fields for mapping, so that the code looks like

Filter(...)
{
   foreach(var field in GetFilterConditions(filter)
   {
   ...
   }
}

protected virtual GetFilterConditions(TFilter filter)
{
	var changeTrack = filter as IChangeTrack;
	if (changeTrack == null)
		return [];

	return changeTrack.Changed;
}

Then the if someone wants to play around with that collection they can override that method and do

protected override GetFilterConditions(TFilter filter)
{
	var changed = base.GetFilterConditions(filter);

	!!DO YOU THING!!

	return changed;
}

@matijahudin999
Copy link
Contributor Author

Refactored and written a filter that treats a datetime property as dateonly for the purpose of comparison

@lukaferlez lukaferlez merged commit 4faf93c into lukaferlez:master Feb 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants