Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Entity framework-4.1-code-first

2,523 views

Published on

Session Was given at Amman Code Camp at 14 May,2011

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

Entity framework-4.1-code-first

  1. 1. Entity Framework 4.1<br />“Code First” & DbContext<br />Omar Qadan<br />twitter.com/omarq<br />
  2. 2. What Is ORM<br />
  3. 3. ORM’s in .NET World<br />Some Open Source <br />SubSonic<br />Nhibernate<br />…<br />Some Commercial<br />And the majority waiting microsft<br />
  4. 4. Microsoft Answer <br />LinqToSQL<br />Entity Framework<br />Persistence Ignorance ??<br />
  5. 5. EF Approaches<br />Database First<br />Model First<br />Code First<br />
  6. 6. Database First<br />Existing Database / DBA<br />Maximum control<br />Full T4 Template support (Self Tracking etc.)<br />Not great with large models (50+ tables)<br />Source Control merging headaches (XML)<br />
  7. 7. Model First<br />Generate Database / Migrate<br />Like to “Draw” model / Designer Fan<br />Less database centric<br />Full T4 Template support<br />Source Control merging nightmare (XML)<br />
  8. 8. Code First<br />Code Oriented / Dumb down DB<br />No automated migration support (vNext)<br />No T4 Template support / Self Tracking (yet)<br />Source Control Branch friendly<br />Cross EDMX easy<br />No SP’s, Compiled Queries<br />
  9. 9. Should have been V1<br />Simplifies<br />Discoverability<br />Does not replace <br />Needed backward compatibility<br />Wraps ObjectContext<br />ObjectContext accessible<br />DbContext<br />DbSet<br />ObjectContext<br />ObjectSet<br />Entity Client<br />Conceptual / Mapping / Logical<br />DbContext & DbSet<br />Recommended for all approaches<br />Use ObjectContext only when needed.<br />
  10. 10. Features<br />Fluent API<br />COC<br />DBContext API<br />
  11. 11. Demo<br />
  12. 12. Wrapup / Questions<br />

×