title: Repository pattern with Entity framework
body: <p>Repository pattern is used to abstract from particular database and object-relation-mapping technology(like EF) used. So I can easily replace (for example) my Entity framework mappings with Linq to SQL in the future if I decide to do so.</p>
  
  <p>But when I use EF I have my entity classes from the model - that is they are generated from that visual diagram. If I use this generated entity classes in my repository and then decide to replace EF by something else then I will delete that visual entity diagram and that means also to delete classes right ?</p>
  
  <p>The point I'm addressing is that my repository will be dependent on Entity framework, that is on data access layer because it will use classes generated by EF.</p>
  
  <p>How do I remove this dependency ?</p>
  
  <p>Also note that I use EF primarily because of its ability to generate everything from that visual diagram - I just design the diagram and let it generate database for me with all the foreign keys etc. I like that very much and don't want to even think about SQL commands.</p>