Skip to content

Commit 13c74ab

Browse files
authored
Create ef6-query-db-set-filter-by-as-no-filter.md
1 parent a82e501 commit 13c74ab

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
Permalink: ef6-query-db-set-filter-by-as-no-filter
3+
---
4+
5+
# EF+ Query Filter AsNoFilter
6+
7+
You can bypass all filters by using AsNoFilter method in a query if a special scenario doesn't require filtering.
8+
9+
{% include template-example.html %}
10+
```csharp
11+
12+
// using Z.EntityFramework.Plus; // Don't forget to include this.
13+
var ctx = new EntitiesContext();
14+
15+
this.DbSetFilter<Customer>(q => q.Where(x => x.IsActive));
16+
17+
// SELECT * FROM Customer WHERE IsActive = true
18+
var list = ctx.Customers.ToList();
19+
20+
// SELECT * FROM Customer
21+
var list = ctx.Customers.AsNoDbSetFilter().ToList();
22+
23+
```
24+
[Try it](https://dotnetfiddle.net/ZIA1kt)

0 commit comments

Comments
 (0)