Well, here goes another noob question: So I made this app where different customer have access to their accounts. Everything is ok, they login, by roles I can get who gets what though entity framework. The thing is, with time, the database will grow A LOT. For example: Customers have access to their "bills to pay". For now, there are only a couple thousand of them and a simple "Where" lambda expression can do the trick. But as said, the base will grow. The scenario: Every record, has a "company" field, which determines the company which the record belongs to. Users have roles, where I store what companies that specific user can access data. So one user can access multiple companies data if it is configured this way. My question is: Is there a way to initialize entity framework scope passing on the user's roles so the scope contains data which "belong" to that user? Something like:
using (MyThingy scope = new MyThingy(user.Roles))
{
//scope.Bills here will contain only bills which "payer" or "holder"
//are companies within user.Roles
List<Bill> billsToPay = scope.Bills.Where(c =>
c.DueDate == DateTime.Now);
}
So, is it possible? If so, what would be the best approach?