SlideShare une entreprise Scribd logo
1  sur  13
Entity Framework 4.1 “Code First” & DbContext Omar Qadan twitter.com/omarq
What Is ORM
ORM’s in .NET World Some Open Source  SubSonic Nhibernate … Some Commercial And the majority waiting microsft
Microsoft Answer  LinqToSQL Entity Framework Persistence Ignorance  ??
EF Approaches Database First Model First Code First
Database First Existing Database / DBA Maximum control Full T4 Template support (Self Tracking etc.) Not great with large models (50+ tables) Source Control merging headaches (XML)
Model First Generate Database / Migrate Like to “Draw” model / Designer Fan Less database centric Full T4 Template support Source Control merging nightmare (XML)
Code First Code Oriented / Dumb down DB No automated migration support (vNext) No T4 Template support / Self Tracking (yet) Source Control Branch friendly Cross EDMX easy No SP’s, Compiled Queries
Should have been V1 Simplifies Discoverability Does not replace  Needed backward compatibility Wraps ObjectContext ObjectContext accessible DbContext DbSet ObjectContext ObjectSet Entity Client Conceptual / Mapping / Logical DbContext & DbSet Recommended for all approaches Use ObjectContext only when needed.
Features Fluent API COC DBContext API
Demo
Wrapup / Questions
Resources You can find Slides for EF4.1 Code First and DB Context here http://www.slideshare.net/omarq/entity-framework41codefirst  and the code is here http://msdn.microsoft.com/en-us/data/gg685467 Entity Framework Videos http://msdn.microsoft.com/en-us/data/cc300162 Nuget.org the NuGet Package Manager  Elmahhttp://code.google.com/p/elmah/ Glimpse http://getglimpse.com/ Nerddinner reloaded http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx Microsoft Web Platform Installer  http://www.microsoft.com/web/downloads/platform.aspx

Contenu connexe

En vedette (11)

Copia de las adicciones
Copia de las adiccionesCopia de las adicciones
Copia de las adicciones
 
00 historia-video
00 historia-video00 historia-video
00 historia-video
 
Las adicciones
Las adiccionesLas adicciones
Las adicciones
 
Las adicciones
Las adiccionesLas adicciones
Las adicciones
 
Genghis khan
Genghis khanGenghis khan
Genghis khan
 
Embedding flash video
Embedding flash videoEmbedding flash video
Embedding flash video
 
Working with sound and video
Working with sound and videoWorking with sound and video
Working with sound and video
 
Genghis khan
Genghis khanGenghis khan
Genghis khan
 
La propiedad prototype en la programación orientada a objetos con JavaScript
La propiedad prototype en la programación orientada a objetos con JavaScriptLa propiedad prototype en la programación orientada a objetos con JavaScript
La propiedad prototype en la programación orientada a objetos con JavaScript
 
Concept mapping (prezentare diseminare Comenius)
Concept mapping (prezentare diseminare Comenius)Concept mapping (prezentare diseminare Comenius)
Concept mapping (prezentare diseminare Comenius)
 
Apuntes: Crear examenes en Moodle
Apuntes: Crear examenes en MoodleApuntes: Crear examenes en Moodle
Apuntes: Crear examenes en Moodle
 

Similaire à Entity framework-4.1-code-first

refORM: Death to ORMs in .NET
refORM: Death to ORMs in .NETrefORM: Death to ORMs in .NET
refORM: Death to ORMs in .NET
James Hughes
 
Erlang plus BDB: Disrupting the Conventional Web Wisdom
Erlang plus BDB: Disrupting the Conventional Web WisdomErlang plus BDB: Disrupting the Conventional Web Wisdom
Erlang plus BDB: Disrupting the Conventional Web Wisdom
guest3933de
 

Similaire à Entity framework-4.1-code-first (20)

Domain oriented development
Domain oriented developmentDomain oriented development
Domain oriented development
 
Programming
Programming Programming
Programming
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)
 
refORM: Death to ORMs in .NET
refORM: Death to ORMs in .NETrefORM: Death to ORMs in .NET
refORM: Death to ORMs in .NET
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)
 
Entity Framework V1 and V2
Entity Framework V1 and V2Entity Framework V1 and V2
Entity Framework V1 and V2
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overview
 
Introducing Entity Framework 4.0
Introducing Entity Framework 4.0Introducing Entity Framework 4.0
Introducing Entity Framework 4.0
 
Kohana 3.1
Kohana 3.1Kohana 3.1
Kohana 3.1
 
PHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the codePHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the code
 
Entity Framework 4 In Microsoft Visual Studio 2010
Entity Framework 4 In Microsoft Visual Studio 2010Entity Framework 4 In Microsoft Visual Studio 2010
Entity Framework 4 In Microsoft Visual Studio 2010
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
 
Web browser
Web browserWeb browser
Web browser
 
Dot Net Core
Dot Net CoreDot Net Core
Dot Net Core
 
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
 
Flickr Services
Flickr ServicesFlickr Services
Flickr Services
 
Flickr Services
Flickr ServicesFlickr Services
Flickr Services
 
Entity Framework 4
Entity Framework 4Entity Framework 4
Entity Framework 4
 
Everyone loves PHP
Everyone loves PHPEveryone loves PHP
Everyone loves PHP
 
Erlang plus BDB: Disrupting the Conventional Web Wisdom
Erlang plus BDB: Disrupting the Conventional Web WisdomErlang plus BDB: Disrupting the Conventional Web Wisdom
Erlang plus BDB: Disrupting the Conventional Web Wisdom
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Entity framework-4.1-code-first

  • 1. Entity Framework 4.1 “Code First” & DbContext Omar Qadan twitter.com/omarq
  • 3. ORM’s in .NET World Some Open Source SubSonic Nhibernate … Some Commercial And the majority waiting microsft
  • 4. Microsoft Answer LinqToSQL Entity Framework Persistence Ignorance ??
  • 5. EF Approaches Database First Model First Code First
  • 6. Database First Existing Database / DBA Maximum control Full T4 Template support (Self Tracking etc.) Not great with large models (50+ tables) Source Control merging headaches (XML)
  • 7. Model First Generate Database / Migrate Like to “Draw” model / Designer Fan Less database centric Full T4 Template support Source Control merging nightmare (XML)
  • 8. Code First Code Oriented / Dumb down DB No automated migration support (vNext) No T4 Template support / Self Tracking (yet) Source Control Branch friendly Cross EDMX easy No SP’s, Compiled Queries
  • 9. Should have been V1 Simplifies Discoverability Does not replace Needed backward compatibility Wraps ObjectContext ObjectContext accessible DbContext DbSet ObjectContext ObjectSet Entity Client Conceptual / Mapping / Logical DbContext & DbSet Recommended for all approaches Use ObjectContext only when needed.
  • 10. Features Fluent API COC DBContext API
  • 11. Demo
  • 13. Resources You can find Slides for EF4.1 Code First and DB Context here http://www.slideshare.net/omarq/entity-framework41codefirst and the code is here http://msdn.microsoft.com/en-us/data/gg685467 Entity Framework Videos http://msdn.microsoft.com/en-us/data/cc300162 Nuget.org the NuGet Package Manager Elmahhttp://code.google.com/p/elmah/ Glimpse http://getglimpse.com/ Nerddinner reloaded http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx Microsoft Web Platform Installer http://www.microsoft.com/web/downloads/platform.aspx