Dynamic views in the EF (e.g. pre-filtered data)
- public or private data "owned" by the user
- public data owned by anyone in the system (including the user)
- data owned by named groups of users
Is there something I can do in the EF where I can possibly do dynamic views? I was thinking of perhaps:
var allBooks = from book in AllBooks select book;
var myBooks = from book in MyBooks (yet this data came from the same table) select book;
var publicBooks = from book in PublicBooks select book;
or possibly using entity inheritance:
var myBooks = from book in Books where book is MyBook(userId);
^^ would the above work if I instantiate myBook with the userID and have a condition in the EM that dictates that MyBooks are only those books where OwnerID == UserID ?
I would like "MyBooks" to be able to pick up either through context (wishful thinking) or through parameter (e.g. MyBooks(userId)) the Id of the requesting user and return the list of books accordingly.
I am looking to make my queries easy to read, and sometimes I spend so many lines of code getting the scope of the source of the query adjusted that I often lose site of the original point of the query.

