title: Entity framework: disable delete globally
body: <p>We are starting a new application. We want to use Entity Framework. We are little afraid of deleting sql rows accidentally (especially by set related data accidentally etc.)</p>
  
  <p>I thought to disable every delete, since we just mark every row with "validUntil" column and never delete rows.</p>
  
  <p>I saw <a href="https://stackoverflow.com/q/20309150/3202422">that it can done by roles in sql</a>, but I want that all logic and control will be just in code.</p>
  
  <p>Maybe in Entity Framework core there is new feature to enable that? I know that it can still write row sql with EF, but we don't afraid of such case.</p>
  
  <p>I also tried remove setters of entities relationships to be more relax, but it broke the normal functionality of EF, and did not look like a good idea.</p>
  
  <p>I saw in the above link a recommendation to use the Repository Pattern, but <a href="https://softwareengineering.stackexchange.com/a/220126">here</a> it looks like it is not good practice.</p>
  
  <p>How can I work safely with EF? 
  thanks!</p>