<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/apply-global-query-filters-in-ef-core-lgtxthc3p" -->

---
title: Apply Global Query Filters in EF Core | daily.dev
description: Entity Framework Core's Query Filters let developers define a global LINQ predicate at the entity level so common filtering rules, like excluding soft-deleted...
canonical: https://daily.dev/posts/apply-global-query-filters-in-ef-core-lgtxthc3p
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Apply Global Query Filters in EF Core | daily.dev
og:description: Entity Framework Core's Query Filters let developers define a global LINQ predicate at the entity level so common filtering rules, like excluding soft-deleted...
og:url: https://daily.dev/posts/apply-global-query-filters-in-ef-core-lgtxthc3p
og:image: https://api.daily.dev/og/posts/LGTXtHc3p.png
og:image:alt: Apply Global Query Filters in EF Core
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Apply Global Query Filters in EF Core

**[NikolaTech](https://daily.dev/sources/nikolatech)** · 4 min read · 0 upvotes · 0 comments

## Summary

Entity Framework Core's Query Filters let developers define a global LINQ predicate at the entity level so common filtering rules, like excluding soft-deleted records or enforcing multi-tenant data isolation, are automatically applied to every query without repeating conditions manually. The post walks through defining a filter with HasQueryFilter in OnModelCreating using a Product entity with an IsDeleted flag, notes that only one filter can be set per entity (multiple conditions must be chained with &&), and shows how to bypass a filter for a specific query using IgnoreQueryFilters.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://nikolatech.net/blogs/global-query-filter-ef-core>

## Questions this post answers

### How do I apply a global soft-delete filter in EF Core so I don't have to repeat it in every query?

Use HasQueryFilter inside OnModelCreating (or an EntityTypeConfiguration) to define a LINQ predicate that EF Core automatically applies to every query for that entity, including queries through navigation properties or Include. For example, modelBuilder.Entity<Product>().HasQueryFilter(p => !p.IsDeleted) excludes soft-deleted products everywhere without manual conditions.

_daily.dev surfaces practical EF Core patterns like this for developers tightening up data access layers._

### Can I have more than one HasQueryFilter on the same EF Core entity?

No, only one query filter can be set per entity in EF Core. If multiple conditions are needed, such as soft-delete and tenant checks, they must be combined into a single expression using the && operator inside one HasQueryFilter call.

_Developers designing multi-tenant or soft-delete logic can track EF Core gotchas like this via daily.dev._

### How do I bypass a global query filter for a specific EF Core query?

Call IgnoreQueryFilters() on the query, such as dbContext.Products.IgnoreQueryFilters().ToListAsync(), and EF Core skips the globally configured filter for that particular query while still applying it everywhere else.

_daily.dev helps .NET developers keep up with EF Core query techniques as data access needs evolve._

## Similar posts on daily.dev

- [Global Query Filters in EF Core](https://daily.dev/posts/global-query-filters-in-ef-core-cwq8yucpe) · Waseem .NET Newsletter · 1 upvotes · 0 comments
- [6 EF Core Query Mistakes That Get Expensive in Production](https://daily.dev/posts/6-ef-core-query-mistakes-that-get-expensive-in-production-5cpkulovz) · Waseem .NET Newsletter · 9 upvotes · 0 comments
- [Dynamic Filtering, Sorting, and Pagination With Specifications](https://daily.dev/posts/dynamic-filtering-sorting-and-pagination-with-specifications-drb7w0tsk) · We Are .NET · 5 upvotes · 0 comments
- [Second-Level Caching in EF Core 10: The Complete Guide](https://daily.dev/posts/second-level-caching-in-ef-core-10-the-complete-guide-bvdnj7ehj) · Code with Mukesh · 0 upvotes · 0 comments

---

Tags: [#.net](https://daily.dev/tags/.net), [#c#](https://daily.dev/tags/c#), [#multi-tenancy](https://daily.dev/tags/multi-tenancy)

[View this post on daily.dev](https://daily.dev/posts/apply-global-query-filters-in-ef-core-lgtxthc3p)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Apply Global Query Filters in EF Core","url":"https://daily.dev/posts/apply-global-query-filters-in-ef-core-lgtxthc3p","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/apply-global-query-filters-in-ef-core-lgtxthc3p"},"datePublished":"2026-10-04T13:05:47.923Z","dateModified":"2026-10-04T13:13:08.730Z","description":"Entity Framework Core's Query Filters let developers define a global LINQ predicate at the entity level so common filtering rules, like excluding soft-deleted...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f65ada5cef58f1d4ca35df9fe06ee30a?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f65ada5cef58f1d4ca35df9fe06ee30a?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"NikolaTech","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"NikolaTech","logo":"https://media.daily.dev/image/upload/s--1h2fO6FL--/f_auto,q_auto/v1791119050/logos/nikolatech?_a=BAMAMicg0","url":"https://daily.dev/sources/nikolatech"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/apply-global-query-filters-in-ef-core-lgtxthc3p","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":".net,c#,multi-tenancy","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"NikolaTech","item":"https://daily.dev/sources/nikolatech"},{"@type":"ListItem","position":3,"name":"Apply Global Query Filters in EF Core"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/apply-global-query-filters-in-ef-core-lgtxthc3p#faq","mainEntity":[{"@type":"Question","name":"How do I apply a global soft-delete filter in EF Core so I don't have to repeat it in every query?","acceptedAnswer":{"@type":"Answer","text":"Use HasQueryFilter inside OnModelCreating (or an EntityTypeConfiguration) to define a LINQ predicate that EF Core automatically applies to every query for that entity, including queries through navigation properties or Include. For example, modelBuilder.Entity<Product>().HasQueryFilter(p => !p.IsDeleted) excludes soft-deleted products everywhere without manual conditions. daily.dev surfaces practical EF Core patterns like this for developers tightening up data access layers."}},{"@type":"Question","name":"Can I have more than one HasQueryFilter on the same EF Core entity?","acceptedAnswer":{"@type":"Answer","text":"No, only one query filter can be set per entity in EF Core. If multiple conditions are needed, such as soft-delete and tenant checks, they must be combined into a single expression using the && operator inside one HasQueryFilter call. Developers designing multi-tenant or soft-delete logic can track EF Core gotchas like this via daily.dev."}},{"@type":"Question","name":"How do I bypass a global query filter for a specific EF Core query?","acceptedAnswer":{"@type":"Answer","text":"Call IgnoreQueryFilters() on the query, such as dbContext.Products.IgnoreQueryFilters().ToListAsync(), and EF Core skips the globally configured filter for that particular query while still applying it everywhere else. daily.dev helps .NET developers keep up with EF Core query techniques as data access needs evolve."}}]}
```

