SlideShare a Scribd company logo
1 of 22
EF in the Enterprise:
Architecting the Data Layer

Julie Lerman
thedatafarm.com
@julielerman
Boston Code Camp March 2013
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

Julie Lerman, Boston Code Camp March 2013
                                            book web site
                                            LearnEntityFramework.com
My (best laid) plan


Where EF fits into your architecture
Repository Pattern(s)
Benefits of a Unit of Work
Bounded DbContext for small models
Unit Testing with Entity Framework
Julie Lerman, Boston Code Camp March 2013
Demo
                         Ware
Julie Lerman, Boston Code Camp March 2013
UI
                                            Logic
                                                    LINQ




                            Database
Julie Lerman, Boston Code Camp March 2013
Separation of Concerns


     Extensible
     Adaptable                             Sensible
     Testable
     Maintainable

Julie Lerman, Boston Code Camp March 2013
UI
                                       Service Layer
                                             Bus Layer
Tests
             Repository/Unit of Work
                                   LINQ
Tests

                         Data Layer                      EF

                         Database
 Julie Lerman, Boston Code Camp March 2013
Considering the domain
        Typical Model/DbContext




Julie Lerman, Boston Code Camp March 2013
“bounded context”


                  Delimits the applicability of a particular
                                  model.

                      BOUNDING CONTEXTS gives team
                                  members
                     a clear and shared understanding of
                          what has to be consistent
                                     and
                      what can develop independently.
Julie Lerman, Boston Code Camp March 2013
Focused DbContexts




Julie Lerman, Boston Code Camp March 2013   DB   DB
Focused DbContext




Julie Lerman, Boston Code Camp March 2013   DB   DB
Repository Essential:


                   Encapsulate
                    Redundant
                   Data Access
                      Code
Julie Lerman, Boston Code Camp March 2013
UI
                                       Service Layer
                                             Bus Layer
Tests
             Repository/Unit of Work
                                   LINQ
Tests

                         Data Layer                      EF

                         Database
 Julie Lerman, Boston Code Camp March 2013
Basic Repository
                                            Get




                        Remove                     Store



                                            Send
Julie Lerman, Boston Code Camp March 2013
                                             to
                                             DB
Many variations…


                                                     One repo
                               One repo                 per
                               per type?              object
                                                      graph?
                                             Read
                                            repos?
                                             Write    One repo
                                            repos?      per
                                                      context?
Julie Lerman, Boston Code Camp March 2013
Get


                                                             Get

     Re
    move
                                        Store


                                                 Remove               Store
                      Send
                      to DB


                                                            Send
                                                            to DB
                                Get                                       Customer
               Rem
                                                Store     Aggregate            Orders
               ove
                                                            Root
                                Send
                                 to
                                 DB
Julie Lerman, Boston Code Camp March 2013
                                                                              Addresses
Testing with EF in the Mix


 Integration/                               •EF only or Database?
  Interaction                               •Using database:
     Tests                                    DropCreateDatabaseAlways


                                            •No EF involved: Inconsequential
  Unit Tests                                •EF in the way:
                                               Abstraction/Interfaces
Julie Lerman, Boston Code Camp March 2013
Testability
                                              Classes      System.Data
Fake                                                          .Entity
DbSet
                                      Fake
                 Fake
                    Context & DataA                        Metadata &
        Context & Data B                                   DbContexts



  Tests
Julie Lerman, Boston Code Camp March 2013   Unit of Work
                                                              UI
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

Julie Lerman, Boston Code Camp March 2013
                                            book web site
                                            LearnEntityFramework.com
Julie Lerman, Boston Code Camp March 2013
Resources

      Pluralsight On-Demand Training: pluralsight.com
      MSDN Developer Center: msdn.com/data/ef
      EF Team: blogs.msdn.com/adonet
      LearnEntityFramework.com
      Programming Entity Framework: DbContext
              by Julie Lerman and Rowan Miller, O’Reilly Media, Feb 22 2012
      Domain Driven Design
              By Eric Evans, Addison-Wesley, 2004
              http://domaindrivendesign.org/
              “Implementing Domain Driven Design”, Vaughn Vernon, 2013
      Separation of Concerns
Julie Lerman, Boston Code Camp March 2013

More Related Content

Viewers also liked

Momentos didácticos.
Momentos didácticos.Momentos didácticos.
Momentos didácticos.valladolid31
 
Clasificación de los textos personales
Clasificación de los textos personalesClasificación de los textos personales
Clasificación de los textos personalesMtra. Zoraida Gpe. Mtz
 
EF6 or EF Core? How Do I Choose?
EF6 or EF Core? How Do I Choose?EF6 or EF Core? How Do I Choose?
EF6 or EF Core? How Do I Choose?Julie Lerman
 
Recensión "Enfermería infantil y dislexia"
Recensión "Enfermería infantil y dislexia"Recensión "Enfermería infantil y dislexia"
Recensión "Enfermería infantil y dislexia"EloNoe
 
GUÍA PARA EL DISEÑO DE PUENTES CON VIGAS Y LOSAS
GUÍA PARA EL DISEÑO DE PUENTES CON VIGAS Y LOSASGUÍA PARA EL DISEÑO DE PUENTES CON VIGAS Y LOSAS
GUÍA PARA EL DISEÑO DE PUENTES CON VIGAS Y LOSASAlberto Arias
 

Viewers also liked (8)

Momentos didácticos.
Momentos didácticos.Momentos didácticos.
Momentos didácticos.
 
классный час культура
классный час культураклассный час культура
классный час культура
 
Metodologia
MetodologiaMetodologia
Metodologia
 
Informe Bijao
Informe BijaoInforme Bijao
Informe Bijao
 
Clasificación de los textos personales
Clasificación de los textos personalesClasificación de los textos personales
Clasificación de los textos personales
 
EF6 or EF Core? How Do I Choose?
EF6 or EF Core? How Do I Choose?EF6 or EF Core? How Do I Choose?
EF6 or EF Core? How Do I Choose?
 
Recensión "Enfermería infantil y dislexia"
Recensión "Enfermería infantil y dislexia"Recensión "Enfermería infantil y dislexia"
Recensión "Enfermería infantil y dislexia"
 
GUÍA PARA EL DISEÑO DE PUENTES CON VIGAS Y LOSAS
GUÍA PARA EL DISEÑO DE PUENTES CON VIGAS Y LOSASGUÍA PARA EL DISEÑO DE PUENTES CON VIGAS Y LOSAS
GUÍA PARA EL DISEÑO DE PUENTES CON VIGAS Y LOSAS
 

More from Julie Lerman

EF Core in Containerized ASP.NET Core APIs
EF Core in Containerized ASP.NET Core APIsEF Core in Containerized ASP.NET Core APIs
EF Core in Containerized ASP.NET Core APIsJulie Lerman
 
Domain-Driven Design with Tender Loving Care (DDD with TLC)
Domain-Driven Design with Tender Loving Care (DDD with TLC)Domain-Driven Design with Tender Loving Care (DDD with TLC)
Domain-Driven Design with Tender Loving Care (DDD with TLC)Julie Lerman
 
What's New in Visual Studio 2017
What's New in Visual Studio 2017What's New in Visual Studio 2017
What's New in Visual Studio 2017Julie Lerman
 
A Tour of EF Core's (1.1) Most Interesting & Important Features
A Tour of EF Core's (1.1) Most Interesting & Important FeaturesA Tour of EF Core's (1.1) Most Interesting & Important Features
A Tour of EF Core's (1.1) Most Interesting & Important FeaturesJulie Lerman
 
Microsoft for developers open source and cross platform
Microsoft for developers  open source and cross platformMicrosoft for developers  open source and cross platform
Microsoft for developers open source and cross platformJulie Lerman
 
Entity Framework and Domain Driven Design
Entity Framework and Domain Driven DesignEntity Framework and Domain Driven Design
Entity Framework and Domain Driven DesignJulie Lerman
 
Entity Framework Today (May 2012)
Entity Framework Today (May 2012)Entity Framework Today (May 2012)
Entity Framework Today (May 2012)Julie Lerman
 
Working With Sql Azure from Entity Framework On-Premises (Julia Lerman)
Working With Sql Azure from Entity Framework On-Premises (Julia Lerman)Working With Sql Azure from Entity Framework On-Premises (Julia Lerman)
Working With Sql Azure from Entity Framework On-Premises (Julia Lerman)Julie Lerman
 
Perspectives on Entity Framework, Julie Lerman
Perspectives on Entity Framework, Julie LermanPerspectives on Entity Framework, Julie Lerman
Perspectives on Entity Framework, Julie LermanJulie Lerman
 
Entity Framework NYC Firestarter
Entity Framework NYC FirestarterEntity Framework NYC Firestarter
Entity Framework NYC FirestarterJulie Lerman
 
Getting Persistence Ignorant with Entity Framework, Julie Lerman
Getting Persistence Ignorant with Entity Framework, Julie LermanGetting Persistence Ignorant with Entity Framework, Julie Lerman
Getting Persistence Ignorant with Entity Framework, Julie LermanJulie Lerman
 
Building n-Tier ASP.NET WebForms with Entity Framework 4, Lerman
Building n-Tier ASP.NET WebForms with Entity Framework 4, LermanBuilding n-Tier ASP.NET WebForms with Entity Framework 4, Lerman
Building n-Tier ASP.NET WebForms with Entity Framework 4, LermanJulie Lerman
 
Persistence Ignorance in Entity Framework 4, Julie Lerman
Persistence Ignorance in Entity Framework 4, Julie LermanPersistence Ignorance in Entity Framework 4, Julie Lerman
Persistence Ignorance in Entity Framework 4, Julie LermanJulie Lerman
 
Persistence Ignorance in Entity Framework 4, Julie Lerman
Persistence Ignorance in Entity Framework 4, Julie LermanPersistence Ignorance in Entity Framework 4, Julie Lerman
Persistence Ignorance in Entity Framework 4, Julie LermanJulie Lerman
 
Entity Framework 4 and WCF
Entity Framework 4 and WCFEntity Framework 4 and WCF
Entity Framework 4 and WCFJulie Lerman
 
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)Julie Lerman
 
AgileEntity Framework 4
AgileEntity Framework 4AgileEntity Framework 4
AgileEntity Framework 4Julie Lerman
 
Lerman Adx303 Entity Framework 4 In Aspnet
Lerman Adx303 Entity Framework 4 In AspnetLerman Adx303 Entity Framework 4 In Aspnet
Lerman Adx303 Entity Framework 4 In AspnetJulie Lerman
 
Lerman Vvs14 Ef Tips And Tricks
Lerman Vvs14  Ef Tips And TricksLerman Vvs14  Ef Tips And Tricks
Lerman Vvs14 Ef Tips And TricksJulie Lerman
 

More from Julie Lerman (20)

EF Core in Containerized ASP.NET Core APIs
EF Core in Containerized ASP.NET Core APIsEF Core in Containerized ASP.NET Core APIs
EF Core in Containerized ASP.NET Core APIs
 
Domain-Driven Design with Tender Loving Care (DDD with TLC)
Domain-Driven Design with Tender Loving Care (DDD with TLC)Domain-Driven Design with Tender Loving Care (DDD with TLC)
Domain-Driven Design with Tender Loving Care (DDD with TLC)
 
What's New in Visual Studio 2017
What's New in Visual Studio 2017What's New in Visual Studio 2017
What's New in Visual Studio 2017
 
A Tour of EF Core's (1.1) Most Interesting & Important Features
A Tour of EF Core's (1.1) Most Interesting & Important FeaturesA Tour of EF Core's (1.1) Most Interesting & Important Features
A Tour of EF Core's (1.1) Most Interesting & Important Features
 
Microsoft for developers open source and cross platform
Microsoft for developers  open source and cross platformMicrosoft for developers  open source and cross platform
Microsoft for developers open source and cross platform
 
Entity Framework and Domain Driven Design
Entity Framework and Domain Driven DesignEntity Framework and Domain Driven Design
Entity Framework and Domain Driven Design
 
RavenDB Overview
RavenDB OverviewRavenDB Overview
RavenDB Overview
 
Entity Framework Today (May 2012)
Entity Framework Today (May 2012)Entity Framework Today (May 2012)
Entity Framework Today (May 2012)
 
Working With Sql Azure from Entity Framework On-Premises (Julia Lerman)
Working With Sql Azure from Entity Framework On-Premises (Julia Lerman)Working With Sql Azure from Entity Framework On-Premises (Julia Lerman)
Working With Sql Azure from Entity Framework On-Premises (Julia Lerman)
 
Perspectives on Entity Framework, Julie Lerman
Perspectives on Entity Framework, Julie LermanPerspectives on Entity Framework, Julie Lerman
Perspectives on Entity Framework, Julie Lerman
 
Entity Framework NYC Firestarter
Entity Framework NYC FirestarterEntity Framework NYC Firestarter
Entity Framework NYC Firestarter
 
Getting Persistence Ignorant with Entity Framework, Julie Lerman
Getting Persistence Ignorant with Entity Framework, Julie LermanGetting Persistence Ignorant with Entity Framework, Julie Lerman
Getting Persistence Ignorant with Entity Framework, Julie Lerman
 
Building n-Tier ASP.NET WebForms with Entity Framework 4, Lerman
Building n-Tier ASP.NET WebForms with Entity Framework 4, LermanBuilding n-Tier ASP.NET WebForms with Entity Framework 4, Lerman
Building n-Tier ASP.NET WebForms with Entity Framework 4, Lerman
 
Persistence Ignorance in Entity Framework 4, Julie Lerman
Persistence Ignorance in Entity Framework 4, Julie LermanPersistence Ignorance in Entity Framework 4, Julie Lerman
Persistence Ignorance in Entity Framework 4, Julie Lerman
 
Persistence Ignorance in Entity Framework 4, Julie Lerman
Persistence Ignorance in Entity Framework 4, Julie LermanPersistence Ignorance in Entity Framework 4, Julie Lerman
Persistence Ignorance in Entity Framework 4, Julie Lerman
 
Entity Framework 4 and WCF
Entity Framework 4 and WCFEntity Framework 4 and WCF
Entity Framework 4 and WCF
 
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
 
AgileEntity Framework 4
AgileEntity Framework 4AgileEntity Framework 4
AgileEntity Framework 4
 
Lerman Adx303 Entity Framework 4 In Aspnet
Lerman Adx303 Entity Framework 4 In AspnetLerman Adx303 Entity Framework 4 In Aspnet
Lerman Adx303 Entity Framework 4 In Aspnet
 
Lerman Vvs14 Ef Tips And Tricks
Lerman Vvs14  Ef Tips And TricksLerman Vvs14  Ef Tips And Tricks
Lerman Vvs14 Ef Tips And Tricks
 

Recently uploaded

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 

Recently uploaded (20)

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 

Architecting the Data Layer with EF in the Enterprise

  • 1. EF in the Enterprise: Architecting the Data Layer Julie Lerman thedatafarm.com @julielerman Boston Code Camp March 2013
  • 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 Julie Lerman, Boston Code Camp March 2013 book web site LearnEntityFramework.com
  • 3. My (best laid) plan Where EF fits into your architecture Repository Pattern(s) Benefits of a Unit of Work Bounded DbContext for small models Unit Testing with Entity Framework Julie Lerman, Boston Code Camp March 2013
  • 4. Demo Ware Julie Lerman, Boston Code Camp March 2013
  • 5. UI Logic LINQ Database Julie Lerman, Boston Code Camp March 2013
  • 6. Separation of Concerns Extensible Adaptable Sensible Testable Maintainable Julie Lerman, Boston Code Camp March 2013
  • 7. UI Service Layer Bus Layer Tests Repository/Unit of Work LINQ Tests Data Layer EF Database Julie Lerman, Boston Code Camp March 2013
  • 8. Considering the domain Typical Model/DbContext Julie Lerman, Boston Code Camp March 2013
  • 9. “bounded context” Delimits the applicability of a particular model. BOUNDING CONTEXTS gives team members a clear and shared understanding of what has to be consistent and what can develop independently. Julie Lerman, Boston Code Camp March 2013
  • 10.
  • 11. Focused DbContexts Julie Lerman, Boston Code Camp March 2013 DB DB
  • 12. Focused DbContext Julie Lerman, Boston Code Camp March 2013 DB DB
  • 13. Repository Essential: Encapsulate Redundant Data Access Code Julie Lerman, Boston Code Camp March 2013
  • 14. UI Service Layer Bus Layer Tests Repository/Unit of Work LINQ Tests Data Layer EF Database Julie Lerman, Boston Code Camp March 2013
  • 15. Basic Repository Get Remove Store Send Julie Lerman, Boston Code Camp March 2013 to DB
  • 16. Many variations… One repo One repo per per type? object graph? Read repos? Write One repo repos? per context? Julie Lerman, Boston Code Camp March 2013
  • 17. Get Get Re move Store Remove Store Send to DB Send to DB Get Customer Rem Store Aggregate Orders ove Root Send to DB Julie Lerman, Boston Code Camp March 2013 Addresses
  • 18. Testing with EF in the Mix Integration/ •EF only or Database? Interaction •Using database: Tests DropCreateDatabaseAlways •No EF involved: Inconsequential Unit Tests •EF in the way: Abstraction/Interfaces Julie Lerman, Boston Code Camp March 2013
  • 19. Testability Classes System.Data Fake .Entity DbSet Fake Fake Context & DataA Metadata & Context & Data B DbContexts Tests Julie Lerman, Boston Code Camp March 2013 Unit of Work UI
  • 20. 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 Julie Lerman, Boston Code Camp March 2013 book web site LearnEntityFramework.com
  • 21. Julie Lerman, Boston Code Camp March 2013
  • 22. Resources  Pluralsight On-Demand Training: pluralsight.com  MSDN Developer Center: msdn.com/data/ef  EF Team: blogs.msdn.com/adonet  LearnEntityFramework.com  Programming Entity Framework: DbContext  by Julie Lerman and Rowan Miller, O’Reilly Media, Feb 22 2012  Domain Driven Design  By Eric Evans, Addison-Wesley, 2004  http://domaindrivendesign.org/  “Implementing Domain Driven Design”, Vaughn Vernon, 2013  Separation of Concerns Julie Lerman, Boston Code Camp March 2013