Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Sure you can do it. The important thing to do is to block direct access to the object context (preventing users from building their own ObjectQuery), and instead give the client a narrower gateway within which to access and mutate entities. We do it with the <a href="http://www.martinfowler.com/eaaCatalog/repository.html" rel="nofollow noreferrer">Entity Repository pattern</a>. You can find an <a href="http://codeinsanity.com/archive/2008/08/11/the-repository-pattern.aspx" rel="nofollow noreferrer" title="The Repository Pattern…">example implementation of this pattern for the entity framework in this blog post</a>. Again, the key is blocking access to the object context. Note that the object context class is partial. So you should be able to prevent "unauthorized" means of instantiating it, namely, outside of your repository assembly.</p> <p>However, there are subtleties to consider. If you implement row-level view security on a certain entity type via the repository pattern, then you must consider other means by which a client could access the same entities. For example, via navigational relationships. You may need to make some of those relationships private, which you can do in your model. You also have the option of <a href="http://msmvps.com/blogs/matthieu/archive/2008/10/01/ef-how-to-do-a-recursive-include.aspx" rel="nofollow noreferrer" title="EF: how to do a recursive include?">specifying a custom query</a> or stored procedure for loading/saving entities. Stored procedures tend to be DB server specific, but SQL can be written in a generic manner.</p> <p>While I don't agree that this cannot be done with the Entity Framework, I do agree with the "do it on the DB server" comments insofar as you should implement <a href="http://en.wikipedia.org/wiki/Defense_in_Depth_(computing)" rel="nofollow noreferrer">defense in depth</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload