Skip to content

Instantly share code, notes, and snippets.

View dukesteen's full-sized avatar

Duke dukesteen

  • FinChamps
  • France
View GitHub Profile
@dukesteen
dukesteen / QueryFilterEtensions.cs
Last active November 15, 2025 23:32
EFCore Named Query Filter on interface that is applied to entity
using System.Linq.Expressions;
namespace Timespace.Api.Database.Extensions;
internal sealed class ReplacingExpressionVisitor(Expression oldExpression, Expression newExpression) : ExpressionVisitor
{
public override Expression? Visit(Expression? node)
{
// If the current node is the one we're looking for, return the new expression.
return node == oldExpression ? newExpression : base.Visit(node);