Created
April 25, 2018 09:16
-
-
Save Teddybiers/506aa4847b95fe1bbccf3786502e1460 to your computer and use it in GitHub Desktop.
Default Query Scope
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnModelCreating(ModelBuilder modelBuilder) | |
{ | |
modelBuilder.Entity<Posts>().HasQueryFilter(p => p.IsActive); | |
} | |
// To ignore default filter | |
var posts = db.Posts | |
.IgnoreQueryFilters() | |
.ToList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment