Created
July 22, 2021 21:18
-
-
Save manoj-choudhari-git/5e20e3eb91b6bade43560c698a941345 to your computer and use it in GitHub Desktop.
.NET - Entity Framework Core - Global Filters Demo
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
public class UniversityContext : DbContext | |
{ | |
public UniversityContext(DbContextOptions<UniversityContext> options) | |
: base(options) | |
{ | |
} | |
protected override void OnModelCreating(ModelBuilder modelBuilder) | |
{ | |
modelBuilder.Entity<Student>().HasQueryFilter(s => !s.IsDeleted); | |
} | |
public DbSet<Student> Students { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment