title: How do i design EF5 code first entities with protected/private members DDD style
body: <p>So I am reading this DDD book and at the same time designing a new system. In the DDD book they have an example where the entity have private members such as ID and other values.</p>
  
  <p>Lets say as an example we have a user entity and it has id and a collection of courses it has the right to attend.</p>
  
  <p>Then in DDD style they use something like GrantRightTo(Course c) if we say are on a user entity.
  And that is all good and well, because in the function I can now check any business rules like if the user is signed up to too many courses. Smart!</p>
  
  <p>The alternative being that anyone has permission to the collection of courses but then the controllers need to know business rules which is not good.</p>
  
  <p>Now here is the problem with EF code first, I can't get my collection of courses to be private/protected like my book does it and still be persisted (dbcontext)
  So what to do?</p>
  
  <p>I could of course have the collection public and still have a method like GrantRightTo, but then other developers might do it the wrong way, so not ideal.</p>
  
  <p>What to do?</p>