Skip to content

Instantly share code, notes, and snippets.

@Teddybiers
Created April 25, 2018 09:16
Show Gist options
  • Save Teddybiers/506aa4847b95fe1bbccf3786502e1460 to your computer and use it in GitHub Desktop.
Save Teddybiers/506aa4847b95fe1bbccf3786502e1460 to your computer and use it in GitHub Desktop.
Default Query Scope
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