EntityFramework.Guardian is a extension point for Entity Framework DbContext in order to implement Database Security by hooking database operations.
Documentation is available here entityframeworkguardian.readthedocs.io
Install NuGet package from Package Manager Console:
PM> Install-Package EntityFramework.Guardian
In your application use this:
var dbContext = new AppDbContext();
var guardianKernel = new GuardianKernel();
dbContext.GuardBy(guardianKernel);
guardianKernel.UseInMemoryPermission(...)
After call of GuardBy DbContext will not allow to do anything in database. After call of UseInMemoryPermission function, DbContext will allow only operation allowed by permission passed to it.