Architecting Smarter Apps with Entity Framework

1,517 views

Published on

EF4 introduced new features that opens up the possibilities to build smarter, more flexible and maintainable applications. When combining the new POCO support, the IObjectSet interface, foreign key support and more, you can now create persistence ignorant entities, repositories, unit tests and other key development patterns. In this session we'll take a look at the new features as we evolve a classically anti-pattern rich demo app into one that leverages the more agile patterns. You'll leave with ideas about how you can integrate Entity Framework into your applications without giving up the coding practices you've worked so hard to develop..

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,517
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Architecting Smarter Apps with Entity Framework

  1. 1. Architecting Smarter Apps with Entity FrameworkJulie Lerman4/19/2011
  2. 2. Julie Lerman consultant/mentor Microsoft MVP, INETA Speaker, ASPInsider, MCP, VTdotNET Leader contact jlerman@theDataFarm.com www.thedatafarm.com blog theDataFarm.com/blog twitter @julielerman book web site LearnEntityFramework.com
  3. 3. EF4 Tools forPersistence Ignorance 3
  4. 4. Persistence Ignorance via POCOs Code FirstDatabase First & Model First 4
  5. 5. POCO Change Tracking “Snapshot” 4.0, 4.1Person Object ObjectContext State info Order Object State info Detail Object State info Detail Object State info Order Object State info Detail Object State info Detail Object State info
  6. 6. POCO Notes 6
  7. 7. IObjectSet/IDbSet for Separation• Set with Collection-like behavior – Add, Attach, Delete, etc.• ObjectSet/DbSet – Concrete class – Implements IObjectSet/IDbSet – Inherits ObjectQuery• Extensions to recreate EF specific methods – Include
  8. 8. PI/Repositories Classes System.Data.Entity FakeObjectSet Fake Context & Data A EDM & Fake Context & Data B ObjectContext Class Class Repositories Class Repositories Class Repositories Repositories UI Tests Unit of Work
  9. 9. Summary• EF Defaults are great for quick drag & drop apps• EF can be used in testable, reusable architecture• Use POCOs to separate domain classes from data access• IObjectSet/IDbSet for building for agnostic repositories• Consider loss of framework specific features e.g., Include 9
  10. 10. Resources• Book blog: learnentityframework.com• MSDN EF Dev Center: msdn.com/data/ef• EF Team Blog: blogs.msdn.com/adonet• Agile Entity Framework 4 Repository Blog Series – http://bit.ly/2VaFrr• Testability and Entity Framework 4.0, Scott Allen, http://msdn.microsoft.com/en-us/ff714955.aspx 10

×