Hi,
Currently I am writing a web application in MVC 4. I am using a generic repository pattern. It works well. So I have something like the followings,
public class AddressRepository : IAddressRepository
{
private AISDbContext context = new AISDbContext();
public IQueryable<Address> GetAddresses()
{
return context.Address;
}
}
But now I need to add something that filters the data more. Based on the logged in user's role, this data should be more filtered.
something like this..
public IQueryable<Address> GetAddresses()
{
return context.Address.where(x=>x.haspermissions = CURENTUSER.Role);
}
Now I could always add another function like this, but I want to try an be general. I want to know if I can just use the first bit of code and inherit from another class, that just applies the security trimming. This way I do not have to rewrite all my queries,
I simply ...
Go to the complete details ...