SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Using POCOS in Entity Framework 4Part 1 Julie Lerman thedatafarm.com/blog jlerman@thedatafarm.com Julia Lerman  October 17th 2009, New England Code Camp 12
Note to Viewers This is Part 1 of a two part presentation. Part 2 covers testing and other patterns and how EF4 supports them. It was presented by Jamie Phillips. You can find his presentation at http://devblog.petrellyn.com/?p=189 Julia Lerman  October 17th 2009, New England Code Camp 12
Julie Lerman Julia Lerman  October 17th 2009, New England Code Camp 12 website theDataFarm.com blog & twitter theDataFarm.com/blog@julielermanVT book web site LearnEntityFramework.com consultant/mentor Microsoft MVP, INETA Speaker,ASPInsider, MCP, VTdotNET Leader
Agenda Standard EntityObject Classes Simple POCO Classes POCO and Proxies Generate POCO Classes with T4 Code-Only Development  Julia Lerman  October 17th 2009, New England Code Camp 12
EF1 & Default EF4 Gen’d Classes CustomTool=EntityModelCodeGenerator Julia Lerman  October 17th 2009, New England Code Camp 12
POCO: Plain Old CLR Object Define your classes Not bound to other APIs e.g. no inheritance from EntityObject Classes are reusable Simplifies testing and more… Julia Lerman  October 17th 2009, New England Code Camp 12
How Does EF4 Support POCO? EntityObjects interact with context For POCO, context does all of the work Classes don’t need to know about context Help provided by Special context methods Additional support via proxies Julia Lerman  October 17th 2009, New England Code Camp 12
Basic POCO Support Turn off code generation from EDMX “Convention” will auto-map classes/entities Julia Lerman  October 17th 2009, New England Code Camp 12
POCO and Other EF Features Complex Types: Supported Use a class (no structs) to represent the type Lazy Loading Declare property as virtual EF uses a proxy instance at runtime to load Explicit Loading ObjectContext.LoadProperty(myObj,”PropertyName”) ObjectCOntext.LoadProperty(myObj, o=>o.property) Julia Lerman  October 17th 2009, New England Code Camp 12
Change Tracking Options Snapshot Default change tracking Collected with DetectChanges is called Notification based virtual properties use Proxies Proxies can provide notification to context Julia Lerman  October 17th 2009, New England Code Camp 12
POCO Classes from Model Julia Lerman  October 17th 2009, New England Code Camp 12 T4 Text Template Transformation Toolkit
Code-Only Design Part of the Feature CTP No model at all Metadata is inferred from classes Convention by Default EF will rely 100% on presumptions Configuration Follows Tweak configurations to modify behavior Julia Lerman  October 17th 2009, New England Code Camp 12
Self-Tracking Entities Part of Feature CTP T4 Template to create specialized POCO classes EntityState is tracked by entity Specialized methods that know what to expect from the classes Julia Lerman  October 17th 2009, New England Code Camp 12
Resources LearnEntityFramework.com/resources blogs.msdn.com/adonet, efdesign, dsimmons, alexj, more... msdn.microsoft.com/data Gateway to whitepapers, forums, documentation Julia Lerman  October 17th 2009, New England Code Camp 12
Contact Julia Lerman  October 17th 2009, New England Code Camp 12 website theDataFarm.com blog & twitter theDataFarm.com/blog@julielermanVT book web site LearnEntityFramework.com consultant/mentor Microsoft MVP, INETA Speaker,ASPInsider, MCP, VTdotNET Leader

Weitere ähnliche Inhalte

Was ist angesagt?

Lecture 3 java basics
Lecture 3 java basicsLecture 3 java basics
Lecture 3 java basics
the_wumberlog
 
python training | python course | python online training
python training |  python course |  python online trainingpython training |  python course |  python online training
python training | python course | python online training
Nancy Thomas
 

Was ist angesagt? (10)

Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Raspberry using Python Session 1
Raspberry using Python Session 1Raspberry using Python Session 1
Raspberry using Python Session 1
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Lecture 3 java basics
Lecture 3 java basicsLecture 3 java basics
Lecture 3 java basics
 
Python45 2
Python45 2Python45 2
Python45 2
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An Introduction
 
207 le boeuf_en
207 le boeuf_en207 le boeuf_en
207 le boeuf_en
 
python training | python course | python online training
python training |  python course |  python online trainingpython training |  python course |  python online training
python training | python course | python online training
 
java: basics, user input, data type, constructor
java:  basics, user input, data type, constructorjava:  basics, user input, data type, constructor
java: basics, user input, data type, constructor
 
From Java to Kotlin
From Java to KotlinFrom Java to Kotlin
From Java to Kotlin
 

Ă„hnlich wie Using Entity Framework's New POCO Features: Part 1, by Julie Lerman

Selenium webdriver course content rakesh hansalia
Selenium webdriver course content rakesh hansaliaSelenium webdriver course content rakesh hansalia
Selenium webdriver course content rakesh hansalia
Rakesh Hansalia
 

Ă„hnlich wie Using Entity Framework's New POCO Features: Part 1, by Julie Lerman (20)

What's New in Entity Framework 4, by Julie Lerman
What's New in Entity Framework 4, by Julie LermanWhat's New in Entity Framework 4, by Julie Lerman
What's New in Entity Framework 4, by Julie Lerman
 
Entity Framework NYC Firestarter
Entity Framework NYC FirestarterEntity Framework NYC Firestarter
Entity Framework NYC Firestarter
 
Spring ActionScript
Spring ActionScriptSpring ActionScript
Spring ActionScript
 
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)
 
Selenium training-course-content-syllabus-credo systemz
Selenium training-course-content-syllabus-credo systemzSelenium training-course-content-syllabus-credo systemz
Selenium training-course-content-syllabus-credo systemz
 
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
 
Selenium training12 1
Selenium training12 1Selenium training12 1
Selenium training12 1
 
Selenium training-course-content
Selenium training-course-contentSelenium training-course-content
Selenium training-course-content
 
Selenium training12 1
Selenium training12 1Selenium training12 1
Selenium training12 1
 
EclipseCon 2009: TmL Tutorial
EclipseCon 2009: TmL TutorialEclipseCon 2009: TmL Tutorial
EclipseCon 2009: TmL Tutorial
 
Selenium webdriver course content rakesh hansalia
Selenium webdriver course content rakesh hansaliaSelenium webdriver course content rakesh hansalia
Selenium webdriver course content rakesh hansalia
 
Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium  Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium
 
Lerman Vvs13 Entity Framework 4 And Wcf
Lerman Vvs13 Entity Framework 4 And WcfLerman Vvs13 Entity Framework 4 And Wcf
Lerman Vvs13 Entity Framework 4 And Wcf
 
Python training course_content
Python training course_contentPython training course_content
Python training course_content
 
Python training-course-content
Python training-course-contentPython training-course-content
Python training-course-content
 
Entity Framework 4 In Microsoft Visual Studio 2010 - ericnel
Entity Framework 4 In Microsoft Visual Studio 2010 - ericnelEntity Framework 4 In Microsoft Visual Studio 2010 - ericnel
Entity Framework 4 In Microsoft Visual Studio 2010 - ericnel
 
Zero redeployment with JRebel
Zero redeployment with JRebelZero redeployment with JRebel
Zero redeployment with JRebel
 
Entity Framework Today (May 2012)
Entity Framework Today (May 2012)Entity Framework Today (May 2012)
Entity Framework Today (May 2012)
 
Ios fundamentals with ObjectiveC
Ios fundamentals with ObjectiveCIos fundamentals with ObjectiveC
Ios fundamentals with ObjectiveC
 

Mehr von Julie Lerman

Julie Lerman: Entity Framework FTQs (Frequently Tweeted Questions)
Julie Lerman: Entity Framework FTQs (Frequently Tweeted Questions)Julie Lerman: Entity Framework FTQs (Frequently Tweeted Questions)
Julie Lerman: Entity Framework FTQs (Frequently Tweeted Questions)
Julie Lerman
 
Julie Lerman Entity Framework in the Enterprise (Boston Code Camp March 2013)
Julie Lerman Entity Framework in the Enterprise (Boston Code Camp March 2013)Julie Lerman Entity Framework in the Enterprise (Boston Code Camp March 2013)
Julie Lerman Entity Framework in the Enterprise (Boston Code Camp March 2013)
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
 

Mehr von Julie Lerman (19)

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
 
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?
 
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
 
Julie Lerman: Entity Framework FTQs (Frequently Tweeted Questions)
Julie Lerman: Entity Framework FTQs (Frequently Tweeted Questions)Julie Lerman: Entity Framework FTQs (Frequently Tweeted Questions)
Julie Lerman: Entity Framework FTQs (Frequently Tweeted Questions)
 
Julie Lerman Entity Framework in the Enterprise (Boston Code Camp March 2013)
Julie Lerman Entity Framework in the Enterprise (Boston Code Camp March 2013)Julie Lerman Entity Framework in the Enterprise (Boston Code Camp March 2013)
Julie Lerman Entity Framework in the Enterprise (Boston Code Camp March 2013)
 
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
 
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
 
Entity Framework 4 and WCF
Entity Framework 4 and WCFEntity Framework 4 and WCF
Entity Framework 4 and WCF
 
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
 
Data in the Azure Cloud, by Julie Lerman
Data in the Azure Cloud, by Julie LermanData in the Azure Cloud, by Julie Lerman
Data in the Azure Cloud, by Julie Lerman
 

KĂĽrzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

KĂĽrzlich hochgeladen (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

Using Entity Framework's New POCO Features: Part 1, by Julie Lerman

  • 1. Using POCOS in Entity Framework 4Part 1 Julie Lerman thedatafarm.com/blog jlerman@thedatafarm.com Julia Lerman October 17th 2009, New England Code Camp 12
  • 2. Note to Viewers This is Part 1 of a two part presentation. Part 2 covers testing and other patterns and how EF4 supports them. It was presented by Jamie Phillips. You can find his presentation at http://devblog.petrellyn.com/?p=189 Julia Lerman October 17th 2009, New England Code Camp 12
  • 3. Julie Lerman Julia Lerman October 17th 2009, New England Code Camp 12 website theDataFarm.com blog & twitter theDataFarm.com/blog@julielermanVT book web site LearnEntityFramework.com consultant/mentor Microsoft MVP, INETA Speaker,ASPInsider, MCP, VTdotNET Leader
  • 4. Agenda Standard EntityObject Classes Simple POCO Classes POCO and Proxies Generate POCO Classes with T4 Code-Only Development Julia Lerman October 17th 2009, New England Code Camp 12
  • 5. EF1 & Default EF4 Gen’d Classes CustomTool=EntityModelCodeGenerator Julia Lerman October 17th 2009, New England Code Camp 12
  • 6. POCO: Plain Old CLR Object Define your classes Not bound to other APIs e.g. no inheritance from EntityObject Classes are reusable Simplifies testing and more… Julia Lerman October 17th 2009, New England Code Camp 12
  • 7. How Does EF4 Support POCO? EntityObjects interact with context For POCO, context does all of the work Classes don’t need to know about context Help provided by Special context methods Additional support via proxies Julia Lerman October 17th 2009, New England Code Camp 12
  • 8. Basic POCO Support Turn off code generation from EDMX “Convention” will auto-map classes/entities Julia Lerman October 17th 2009, New England Code Camp 12
  • 9. POCO and Other EF Features Complex Types: Supported Use a class (no structs) to represent the type Lazy Loading Declare property as virtual EF uses a proxy instance at runtime to load Explicit Loading ObjectContext.LoadProperty(myObj,”PropertyName”) ObjectCOntext.LoadProperty(myObj, o=>o.property) Julia Lerman October 17th 2009, New England Code Camp 12
  • 10. Change Tracking Options Snapshot Default change tracking Collected with DetectChanges is called Notification based virtual properties use Proxies Proxies can provide notification to context Julia Lerman October 17th 2009, New England Code Camp 12
  • 11. POCO Classes from Model Julia Lerman October 17th 2009, New England Code Camp 12 T4 Text Template Transformation Toolkit
  • 12. Code-Only Design Part of the Feature CTP No model at all Metadata is inferred from classes Convention by Default EF will rely 100% on presumptions Configuration Follows Tweak configurations to modify behavior Julia Lerman October 17th 2009, New England Code Camp 12
  • 13. Self-Tracking Entities Part of Feature CTP T4 Template to create specialized POCO classes EntityState is tracked by entity Specialized methods that know what to expect from the classes Julia Lerman October 17th 2009, New England Code Camp 12
  • 14. Resources LearnEntityFramework.com/resources blogs.msdn.com/adonet, efdesign, dsimmons, alexj, more... msdn.microsoft.com/data Gateway to whitepapers, forums, documentation Julia Lerman October 17th 2009, New England Code Camp 12
  • 15. Contact Julia Lerman October 17th 2009, New England Code Camp 12 website theDataFarm.com blog & twitter theDataFarm.com/blog@julielermanVT book web site LearnEntityFramework.com consultant/mentor Microsoft MVP, INETA Speaker,ASPInsider, MCP, VTdotNET Leader