SlideShare a Scribd company logo
Architecting
 Smarter Apps
 with Entity
 Framework




Julie Lerman
4/19/2011
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
EF4 Tools for
Persistence Ignorance




                        3
Persistence Ignorance via POCOs
                               Code First

Database First & Model First




                                            4
POCO
            Change Tracking “Snapshot”
                              4.0, 4.1

Person 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
POCO Notes




             6
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
PI/Repositories
                                   Classes
                                                     System.Data.Entity
  Fake
ObjectSet
                               Fake
                          Context & Data A             EDM &
            Fake
       Context & Data B                             ObjectContext


                                    Class
                                      Class
                                 Repositories
                                        Class
                                  Repositories
                                          Class
                                    Repositories
                                     Repositories           UI
     Tests
                                   Unit of Work
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
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

More Related Content

PPT
PHP - Procedural To Object-Oriented
PPTX
Object oriented programming
ODP
Local Dental 360™: Building a Solid Local SEO Foundation with Citations
PDF
A Bit of Design Thinking for Developers
PPT
Social media
PDF
WF and WCF with AppFabric – Application Infrastructure for OnPremise Services
PDF
Alternate JVM Languages
PDF
Ireland Startup Ecosystems
PHP - Procedural To Object-Oriented
Object oriented programming
Local Dental 360™: Building a Solid Local SEO Foundation with Citations
A Bit of Design Thinking for Developers
Social media
WF and WCF with AppFabric – Application Infrastructure for OnPremise Services
Alternate JVM Languages
Ireland Startup Ecosystems

Similar to Architecting Smarter Apps with Entity Framework (20)

PPTX
Entity Framework Today (May 2012)
PPTX
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
PPTX
Entity Framework: Code First and Magic Unicorns
PPTX
Applying EF Code First at Your Job
DOCX
Getting Started with Entity Framework in .NET
PPTX
Entity Framework 4
PPTX
Entity Framework NYC Firestarter
PPTX
Entity Framework: Nakov @ BFU Hackhaton 2015
PPTX
Entity Framework 4
PPTX
Just entity framework
PDF
[FREE PDF sample] Programming Entity Framework DbContext 1st Edition Julia Le...
PPT
Real-world Entity Framework
PDF
Entity Framework Interview Questions PDF By ScholarHat
PDF
Entity Framework 6 Recipes 2nd Edition Brian Driscoll
PPTX
Getting started with entity framework
PPTX
05 entity framework
PPTX
Building N Tier Applications With Entity Framework Services 2010
PPTX
Building data centric applications for web, desktop and mobile with Entity Fr...
DOC
10265 developing data access solutions with microsoft visual studio 2010
PDF
Dawn - Actionscript Library
Entity Framework Today (May 2012)
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
Entity Framework: Code First and Magic Unicorns
Applying EF Code First at Your Job
Getting Started with Entity Framework in .NET
Entity Framework 4
Entity Framework NYC Firestarter
Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework 4
Just entity framework
[FREE PDF sample] Programming Entity Framework DbContext 1st Edition Julia Le...
Real-world Entity Framework
Entity Framework Interview Questions PDF By ScholarHat
Entity Framework 6 Recipes 2nd Edition Brian Driscoll
Getting started with entity framework
05 entity framework
Building N Tier Applications With Entity Framework Services 2010
Building data centric applications for web, desktop and mobile with Entity Fr...
10265 developing data access solutions with microsoft visual studio 2010
Dawn - Actionscript Library
Ad

More from Saltmarch Media (15)

PDF
Concocting an MVC, Data Services and Entity Framework solution for Azure
PDF
Caring about Code Quality
PDF
Learning Open Source Business Intelligence
PDF
Java EE 7: the Voyage of the Cloud Treader
PDF
Is NoSQL The Future of Data Storage?
PDF
Introduction to WCF RIA Services for Silverlight 4 Developers
PDF
Integrated Services for Web Applications
PDF
Gaelyk - Web Apps In Practically No Time
PDF
CDI and Seam 3: an Exciting New Landscape for Java EE Development
PDF
JBoss at Work: Using JBoss AS 6
PDF
“What did I do?” - T-SQL Worst Practices
PDF
Building RESTful Services with WCF 4.0
PDF
Building Facebook Applications on Windows Azure
PDF
Agile Estimation
PDF
A Cocktail of Guice and Seam, the missing ingredients for Java EE 6
Concocting an MVC, Data Services and Entity Framework solution for Azure
Caring about Code Quality
Learning Open Source Business Intelligence
Java EE 7: the Voyage of the Cloud Treader
Is NoSQL The Future of Data Storage?
Introduction to WCF RIA Services for Silverlight 4 Developers
Integrated Services for Web Applications
Gaelyk - Web Apps In Practically No Time
CDI and Seam 3: an Exciting New Landscape for Java EE Development
JBoss at Work: Using JBoss AS 6
“What did I do?” - T-SQL Worst Practices
Building RESTful Services with WCF 4.0
Building Facebook Applications on Windows Azure
Agile Estimation
A Cocktail of Guice and Seam, the missing ingredients for Java EE 6
Ad

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Big Data Technologies - Introduction.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Encapsulation_ Review paper, used for researhc scholars
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Spectral efficient network and resource selection model in 5G networks
20250228 LYD VKU AI Blended-Learning.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Big Data Technologies - Introduction.pptx
sap open course for s4hana steps from ECC to s4
Per capita expenditure prediction using model stacking based on satellite ima...
The Rise and Fall of 3GPP – Time for a Sabbatical?
gpt5_lecture_notes_comprehensive_20250812015547.pdf
cuic standard and advanced reporting.pdf
NewMind AI Weekly Chronicles - August'25-Week II
A comparative analysis of optical character recognition models for extracting...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Diabetes mellitus diagnosis method based random forest with bat algorithm
“AI and Expert System Decision Support & Business Intelligence Systems”
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Chapter 3 Spatial Domain Image Processing.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Encapsulation_ Review paper, used for researhc scholars

Architecting Smarter Apps with Entity Framework

  • 1. Architecting Smarter Apps with Entity Framework Julie Lerman 4/19/2011
  • 2. Julie Lerman consultant/mentor Microsoft MVP, INETA Speaker, ASPInsider, MCP, VTdotNET Leader contact [email protected] www.thedatafarm.com blog theDataFarm.com/blog twitter @julielerman book web site LearnEntityFramework.com
  • 4. Persistence Ignorance via POCOs Code First Database First & Model First 4
  • 5. POCO Change Tracking “Snapshot” 4.0, 4.1 Person 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
  • 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. PI/Repositories Classes System.Data.Entity Fake ObjectSet Fake Context & Data A EDM & Fake Context & Data B ObjectContext Class Class Repositories Class Repositories Class Repositories Repositories UI Tests Unit of Work
  • 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. 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