SlideShare ist ein Scribd-Unternehmen logo
1 von 37
What impact will the Entity Framework and Entity Data Model have on application architecture? Eric Nelson Microsoft UK Blog: http://geekswithblogs.net/iupdateable Twitter: http://twitter.com/ericnel and http://twitter.com/ukmsdn Podcast:  http://bit.ly/msdnpodcast Newsletter: http://msdn.microsoft.com/en-gb/flash Slides, links and background “diary” posts can be found on my blog
Agenda ORM Overview and Impact Entity Framework V1 recap  Entity Framework V4 overview Impact of embracing Entity Framework
ORM Overview “Not your fathers ORM”
Why did the industry create ORMs? We started with data in the 70s The first RDBMS were data centric Overtime they received bolt ons for behaviour In the late 90s, programming became object centric Rise of OOP and OOD Behaviour The two approaches didn’t play nice “impedance mismatch” Different type systems Different emphasis Set vs Graph theory Many to Many
One approach – the Object Database
The “winning approach” – Object Relational Mapping Technique for working with relational data as if they were objects in memory Hide away the complexity of the underlying tables and give a uniform way of working with data An Abstraction RDBMS is about data OO is about data + behaviour
What good comes from adopting an ORM Developer productivity Less code Better code than the “average” developer Better database code than the “average” developer Retain database independence
ORM and Code Gen ORMs are highly configurable code gen tools  Made normally by someone else We like code gen Helps with DRY But we sometimes dislike ORMs As they can break YAGNI And they often are “leaky” And we didn’t write them And they aren’t perfect for what we have in mind
ORM is not... The answer to life the universe and everything The absolute fastest way to do everything Supported by many reporting tools Always in step with RDBMS advances
ORM is the Vietnam of Computer Science Ted Neward “there is no good solution to the object/relational mapping problem” Painful tradeoffs Proposed “Integration of relational concepts into the languages”
Impact of adopting an ORM
Impact of adopting an ORM Start with Behaviour or start with Data? Code firstor Map first? Database Independence but at what cost?  Always access via the ORM? No behaviour in the database?
Behaviour in the database? RDBMS can model data and behaviour Stored Procedures Triggers Views User defined types Some RDBMS better than others SQL Server 2005/2008 can run .NET code and you can extend the type system.
Stored Procedures are evil? From the world of Java All about portability and vendor neutrality Stored Procedures were hard to port ANSI SQL std doesnt includes SPs Therefore don’t use Stored Procedures This is changing... From the world of .NET Overuse Incorrect use Lead to “no sps here”
Stored Procedures and ORMS Some ORMs offer little or no support Some offer great support CUDvs CRUD Functions Still a great choice Can solves identified performance bottlenecks Bulk data manipulation Maintenance operations Multiple applications to the same database Security (hmmm....)
ADO.NET Entity Framework v1.0 It arrived slightly under cooked 
ORM on the Windows Platform Many ORMs out there No clear “winner” = relatively little adoption of ORM Developers waiting on Microsoft
The future of ORM on Windows Entity Framework and LINQ to Entities is our strategic technology Big investment into Entity Framework 4.0 in VS2010 Best of LINQ to SQL moves into LINQ to Entities Microsoft is using it Data Services - shipping Reporting Services more Partners supporting it Database Vendors – IBM,OpenLink, DataDirect, Devart etc ORM vendors supporting it Entity Framework is not just about ORM
ADO.NET Entity Framework Tools and services to create an Entity Data Model (EDM) Tools and services for consuming an Entity Data Model
Entity Data Model Entity Data Model Application model Mapped to a persistence store Comprised of three layers: Conceptual (CSDL) Mapping (MSL) Storage (SSDL) Database agnostic Comprised of: Entities Associations Functions Conceptual Mapping Storage
Consuming the EDM 1 2 The ORM - optional Object Services 3 Entity Client
Demo:  Entity Framework
LINQ recap “Bringing relational into the languages” Eliminating the impedance mismatch (No... Not really ) LINQ to SQL is like C# to C++ Tidy, Composable, Associations, Shaped results, Parameterization, Client processing http://linqpad.net/WhyLINQBeatsSQL.aspx
ADO.NET Entity Framework v2.0 An absolutely fantastic release. Did you like it?
ADO.NET Entity Framework v3.0 An amazing release. Who could have thought 3.0 could beat 2.0!
ADO.NET Entity Framework v4.0 And in Visual Studio 2010 and .NET Framework 4.0 we get our fourth release building on the success of 1.0, 2.0 and 3.0 
Lots of new features Better Tools and Design Experience More powerful/flexible runtime And N-Tier Persistence Ignorance Code Only
Better Tools and Design Experience Templated code generation Model First Stored Procedures Pluralization Complex Types Better delete and search
More powerful/flexible runtime Deferred Loading (aka lazy loading) Foreign Keys surfaced More complete LINQ implentation ExecuteStoreQuery EntityFunctions and SqlFunctions Improvements to generated SQL
N-Tier Self Tracking Entities
Persistence Ignorance First class support for Persistence Ignorance  No modifications to your classes!
Code Only Create the database from the classes No model Convention to config
Demo:  Code Gen, MODEL First, SPs, Persistence Ignorance …
Architecturally impactful Improved Code Generation Mode First Stored Procedures EntityFunctions and SQLFunctions Self Tracking Entities Persistence Ignorance Code Only
In Summary
Objects trump Tables Use LINQ  Use an ORM I don’t really care which. But Nhibernate and Entity Framework are good candidates Use an ORM wisely
Resources Slides, links and more http://geekswithblogs.net/iupdateable Entity Framework 4.0 Resources http://bit.ly/ef4resources

Weitere ähnliche Inhalte

Ähnlich wie What Impact Will Entity Framework Have On Architecture

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)David McCarter
 
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)David McCarter
 
Sem tech 2011 v8
Sem tech 2011 v8Sem tech 2011 v8
Sem tech 2011 v8dallemang
 
Object Relational Mapping In Real World Applications
Object Relational Mapping In Real World ApplicationsObject Relational Mapping In Real World Applications
Object Relational Mapping In Real World ApplicationsPhilWinstanley
 
.NET Architecture for Enterprises
.NET Architecture for Enterprises.NET Architecture for Enterprises
.NET Architecture for EnterprisesWade Wegner
 
Ado.net entity framework_4.0
Ado.net entity framework_4.0Ado.net entity framework_4.0
Ado.net entity framework_4.0Rishu Mehra
 
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim RemaniFinding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim RemaniJAXLondon2014
 
Elements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code FirstElements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code FirstEnea Gabriel
 
Multi datastores - CLOSER'14
Multi datastores - CLOSER'14Multi datastores - CLOSER'14
Multi datastores - CLOSER'14Marcos Almeida
 
01 Persistence And Orm
01 Persistence And Orm01 Persistence And Orm
01 Persistence And OrmRanjan Kumar
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity FrameworkHasnain Iqbal
 
Fed Up Of Framework Hype Dcphp
Fed Up Of Framework Hype DcphpFed Up Of Framework Hype Dcphp
Fed Up Of Framework Hype DcphpTony Bibbs
 
Intake 38 data access 4
Intake 38 data access 4Intake 38 data access 4
Intake 38 data access 4Mahmoud Ouf
 
ASAS 2014 - Simon Brown
ASAS 2014 - Simon BrownASAS 2014 - Simon Brown
ASAS 2014 - Simon BrownAvisi B.V.
 

Ähnlich wie What Impact Will Entity Framework Have On Architecture (20)

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)
 
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)
 
Sem tech 2011 v8
Sem tech 2011 v8Sem tech 2011 v8
Sem tech 2011 v8
 
Object Relational Mapping In Real World Applications
Object Relational Mapping In Real World ApplicationsObject Relational Mapping In Real World Applications
Object Relational Mapping In Real World Applications
 
.NET Architecture for Enterprises
.NET Architecture for Enterprises.NET Architecture for Enterprises
.NET Architecture for Enterprises
 
Ado.net entity framework_4.0
Ado.net entity framework_4.0Ado.net entity framework_4.0
Ado.net entity framework_4.0
 
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim RemaniFinding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
 
Elements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code FirstElements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code First
 
Multi datastores - CLOSER'14
Multi datastores - CLOSER'14Multi datastores - CLOSER'14
Multi datastores - CLOSER'14
 
01 Persistence And Orm
01 Persistence And Orm01 Persistence And Orm
01 Persistence And Orm
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Framework
 
Data vault what's Next: Part 2
Data vault what's Next: Part 2Data vault what's Next: Part 2
Data vault what's Next: Part 2
 
ch02models.pptx
ch02models.pptxch02models.pptx
ch02models.pptx
 
ch02models.pptx
ch02models.pptxch02models.pptx
ch02models.pptx
 
Fed Up Of Framework Hype Dcphp
Fed Up Of Framework Hype DcphpFed Up Of Framework Hype Dcphp
Fed Up Of Framework Hype Dcphp
 
Entity framework
Entity frameworkEntity framework
Entity framework
 
Intake 38 data access 4
Intake 38 data access 4Intake 38 data access 4
Intake 38 data access 4
 
Dsm presentation (english)
Dsm presentation (english)Dsm presentation (english)
Dsm presentation (english)
 
Intake 37 ef1
Intake 37 ef1Intake 37 ef1
Intake 37 ef1
 
ASAS 2014 - Simon Brown
ASAS 2014 - Simon BrownASAS 2014 - Simon Brown
ASAS 2014 - Simon Brown
 

Mehr von Eric Nelson

SQL Azure Dec 2010 Update
SQL Azure Dec 2010 UpdateSQL Azure Dec 2010 Update
SQL Azure Dec 2010 UpdateEric Nelson
 
SQL Azure Dec Update
SQL Azure Dec UpdateSQL Azure Dec Update
SQL Azure Dec UpdateEric Nelson
 
Windows Azure Platform in 30mins by ericnel
Windows Azure Platform in 30mins by ericnelWindows Azure Platform in 30mins by ericnel
Windows Azure Platform in 30mins by ericnelEric Nelson
 
Technology Roadmap by ericnel
Technology Roadmap by ericnelTechnology Roadmap by ericnel
Technology Roadmap by ericnelEric Nelson
 
Windows Azure Platform in 30mins by ericnel
Windows Azure Platform in 30mins by ericnelWindows Azure Platform in 30mins by ericnel
Windows Azure Platform in 30mins by ericnelEric Nelson
 
10 things ever architect should know about the Windows Azure Platform - ericnel
10 things ever architect should know about the Windows Azure Platform -  ericnel10 things ever architect should know about the Windows Azure Platform -  ericnel
10 things ever architect should know about the Windows Azure Platform - ericnelEric Nelson
 
Lap around the Windows Azure Platform - ericnel
Lap around the Windows Azure Platform - ericnelLap around the Windows Azure Platform - ericnel
Lap around the Windows Azure Platform - ericnelEric Nelson
 
Windows Azure Platform best practices by ericnel
Windows Azure Platform best practices by ericnelWindows Azure Platform best practices by ericnel
Windows Azure Platform best practices by ericnelEric Nelson
 
Windows Azure Platform: Articles from the Trenches, Volume One
Windows Azure Platform: Articles from the Trenches, Volume OneWindows Azure Platform: Articles from the Trenches, Volume One
Windows Azure Platform: Articles from the Trenches, Volume OneEric Nelson
 
Looking at the clouds through dirty windows
Looking at the clouds through dirty windows Looking at the clouds through dirty windows
Looking at the clouds through dirty windows Eric Nelson
 
SQL Azure Overview for Bizspark day
SQL Azure Overview for Bizspark daySQL Azure Overview for Bizspark day
SQL Azure Overview for Bizspark dayEric Nelson
 
Building An Application For Windows Azure And Sql Azure
Building An Application For Windows Azure And Sql AzureBuilding An Application For Windows Azure And Sql Azure
Building An Application For Windows Azure And Sql AzureEric Nelson
 
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 2010Eric Nelson
 
Windows Azure In 30mins for none technical audience
Windows Azure In 30mins for none technical audienceWindows Azure In 30mins for none technical audience
Windows Azure In 30mins for none technical audienceEric Nelson
 
Dev305 Entity Framework 4 Emergency Slides
Dev305 Entity Framework 4 Emergency SlidesDev305 Entity Framework 4 Emergency Slides
Dev305 Entity Framework 4 Emergency SlidesEric Nelson
 
Design Considerations For Storing With Windows Azure
Design Considerations For Storing With Windows AzureDesign Considerations For Storing With Windows Azure
Design Considerations For Storing With Windows AzureEric Nelson
 
Windows Azure Overview
Windows Azure OverviewWindows Azure Overview
Windows Azure OverviewEric Nelson
 
SQL Data Service Overview
SQL Data Service OverviewSQL Data Service Overview
SQL Data Service OverviewEric Nelson
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 OverviewEric Nelson
 

Mehr von Eric Nelson (19)

SQL Azure Dec 2010 Update
SQL Azure Dec 2010 UpdateSQL Azure Dec 2010 Update
SQL Azure Dec 2010 Update
 
SQL Azure Dec Update
SQL Azure Dec UpdateSQL Azure Dec Update
SQL Azure Dec Update
 
Windows Azure Platform in 30mins by ericnel
Windows Azure Platform in 30mins by ericnelWindows Azure Platform in 30mins by ericnel
Windows Azure Platform in 30mins by ericnel
 
Technology Roadmap by ericnel
Technology Roadmap by ericnelTechnology Roadmap by ericnel
Technology Roadmap by ericnel
 
Windows Azure Platform in 30mins by ericnel
Windows Azure Platform in 30mins by ericnelWindows Azure Platform in 30mins by ericnel
Windows Azure Platform in 30mins by ericnel
 
10 things ever architect should know about the Windows Azure Platform - ericnel
10 things ever architect should know about the Windows Azure Platform -  ericnel10 things ever architect should know about the Windows Azure Platform -  ericnel
10 things ever architect should know about the Windows Azure Platform - ericnel
 
Lap around the Windows Azure Platform - ericnel
Lap around the Windows Azure Platform - ericnelLap around the Windows Azure Platform - ericnel
Lap around the Windows Azure Platform - ericnel
 
Windows Azure Platform best practices by ericnel
Windows Azure Platform best practices by ericnelWindows Azure Platform best practices by ericnel
Windows Azure Platform best practices by ericnel
 
Windows Azure Platform: Articles from the Trenches, Volume One
Windows Azure Platform: Articles from the Trenches, Volume OneWindows Azure Platform: Articles from the Trenches, Volume One
Windows Azure Platform: Articles from the Trenches, Volume One
 
Looking at the clouds through dirty windows
Looking at the clouds through dirty windows Looking at the clouds through dirty windows
Looking at the clouds through dirty windows
 
SQL Azure Overview for Bizspark day
SQL Azure Overview for Bizspark daySQL Azure Overview for Bizspark day
SQL Azure Overview for Bizspark day
 
Building An Application For Windows Azure And Sql Azure
Building An Application For Windows Azure And Sql AzureBuilding An Application For Windows Azure And Sql Azure
Building An Application For Windows Azure And Sql Azure
 
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
 
Windows Azure In 30mins for none technical audience
Windows Azure In 30mins for none technical audienceWindows Azure In 30mins for none technical audience
Windows Azure In 30mins for none technical audience
 
Dev305 Entity Framework 4 Emergency Slides
Dev305 Entity Framework 4 Emergency SlidesDev305 Entity Framework 4 Emergency Slides
Dev305 Entity Framework 4 Emergency Slides
 
Design Considerations For Storing With Windows Azure
Design Considerations For Storing With Windows AzureDesign Considerations For Storing With Windows Azure
Design Considerations For Storing With Windows Azure
 
Windows Azure Overview
Windows Azure OverviewWindows Azure Overview
Windows Azure Overview
 
SQL Data Service Overview
SQL Data Service OverviewSQL Data Service Overview
SQL Data Service Overview
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
 

Kürzlich hochgeladen

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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 organizationRadu Cotescu
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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 Servicegiselly40
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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 textsMaria Levchenko
 
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
 

Kürzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 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
 
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
 

What Impact Will Entity Framework Have On Architecture

  • 1. What impact will the Entity Framework and Entity Data Model have on application architecture? Eric Nelson Microsoft UK Blog: http://geekswithblogs.net/iupdateable Twitter: http://twitter.com/ericnel and http://twitter.com/ukmsdn Podcast: http://bit.ly/msdnpodcast Newsletter: http://msdn.microsoft.com/en-gb/flash Slides, links and background “diary” posts can be found on my blog
  • 2. Agenda ORM Overview and Impact Entity Framework V1 recap Entity Framework V4 overview Impact of embracing Entity Framework
  • 3. ORM Overview “Not your fathers ORM”
  • 4. Why did the industry create ORMs? We started with data in the 70s The first RDBMS were data centric Overtime they received bolt ons for behaviour In the late 90s, programming became object centric Rise of OOP and OOD Behaviour The two approaches didn’t play nice “impedance mismatch” Different type systems Different emphasis Set vs Graph theory Many to Many
  • 5. One approach – the Object Database
  • 6. The “winning approach” – Object Relational Mapping Technique for working with relational data as if they were objects in memory Hide away the complexity of the underlying tables and give a uniform way of working with data An Abstraction RDBMS is about data OO is about data + behaviour
  • 7. What good comes from adopting an ORM Developer productivity Less code Better code than the “average” developer Better database code than the “average” developer Retain database independence
  • 8. ORM and Code Gen ORMs are highly configurable code gen tools Made normally by someone else We like code gen Helps with DRY But we sometimes dislike ORMs As they can break YAGNI And they often are “leaky” And we didn’t write them And they aren’t perfect for what we have in mind
  • 9. ORM is not... The answer to life the universe and everything The absolute fastest way to do everything Supported by many reporting tools Always in step with RDBMS advances
  • 10. ORM is the Vietnam of Computer Science Ted Neward “there is no good solution to the object/relational mapping problem” Painful tradeoffs Proposed “Integration of relational concepts into the languages”
  • 12. Impact of adopting an ORM Start with Behaviour or start with Data? Code firstor Map first? Database Independence but at what cost? Always access via the ORM? No behaviour in the database?
  • 13. Behaviour in the database? RDBMS can model data and behaviour Stored Procedures Triggers Views User defined types Some RDBMS better than others SQL Server 2005/2008 can run .NET code and you can extend the type system.
  • 14. Stored Procedures are evil? From the world of Java All about portability and vendor neutrality Stored Procedures were hard to port ANSI SQL std doesnt includes SPs Therefore don’t use Stored Procedures This is changing... From the world of .NET Overuse Incorrect use Lead to “no sps here”
  • 15. Stored Procedures and ORMS Some ORMs offer little or no support Some offer great support CUDvs CRUD Functions Still a great choice Can solves identified performance bottlenecks Bulk data manipulation Maintenance operations Multiple applications to the same database Security (hmmm....)
  • 16. ADO.NET Entity Framework v1.0 It arrived slightly under cooked 
  • 17. ORM on the Windows Platform Many ORMs out there No clear “winner” = relatively little adoption of ORM Developers waiting on Microsoft
  • 18. The future of ORM on Windows Entity Framework and LINQ to Entities is our strategic technology Big investment into Entity Framework 4.0 in VS2010 Best of LINQ to SQL moves into LINQ to Entities Microsoft is using it Data Services - shipping Reporting Services more Partners supporting it Database Vendors – IBM,OpenLink, DataDirect, Devart etc ORM vendors supporting it Entity Framework is not just about ORM
  • 19. ADO.NET Entity Framework Tools and services to create an Entity Data Model (EDM) Tools and services for consuming an Entity Data Model
  • 20. Entity Data Model Entity Data Model Application model Mapped to a persistence store Comprised of three layers: Conceptual (CSDL) Mapping (MSL) Storage (SSDL) Database agnostic Comprised of: Entities Associations Functions Conceptual Mapping Storage
  • 21. Consuming the EDM 1 2 The ORM - optional Object Services 3 Entity Client
  • 22. Demo: Entity Framework
  • 23. LINQ recap “Bringing relational into the languages” Eliminating the impedance mismatch (No... Not really ) LINQ to SQL is like C# to C++ Tidy, Composable, Associations, Shaped results, Parameterization, Client processing http://linqpad.net/WhyLINQBeatsSQL.aspx
  • 24. ADO.NET Entity Framework v2.0 An absolutely fantastic release. Did you like it?
  • 25. ADO.NET Entity Framework v3.0 An amazing release. Who could have thought 3.0 could beat 2.0!
  • 26. ADO.NET Entity Framework v4.0 And in Visual Studio 2010 and .NET Framework 4.0 we get our fourth release building on the success of 1.0, 2.0 and 3.0 
  • 27. Lots of new features Better Tools and Design Experience More powerful/flexible runtime And N-Tier Persistence Ignorance Code Only
  • 28. Better Tools and Design Experience Templated code generation Model First Stored Procedures Pluralization Complex Types Better delete and search
  • 29. More powerful/flexible runtime Deferred Loading (aka lazy loading) Foreign Keys surfaced More complete LINQ implentation ExecuteStoreQuery EntityFunctions and SqlFunctions Improvements to generated SQL
  • 31. Persistence Ignorance First class support for Persistence Ignorance No modifications to your classes!
  • 32. Code Only Create the database from the classes No model Convention to config
  • 33. Demo: Code Gen, MODEL First, SPs, Persistence Ignorance …
  • 34. Architecturally impactful Improved Code Generation Mode First Stored Procedures EntityFunctions and SQLFunctions Self Tracking Entities Persistence Ignorance Code Only
  • 36. Objects trump Tables Use LINQ Use an ORM I don’t really care which. But Nhibernate and Entity Framework are good candidates Use an ORM wisely
  • 37. Resources Slides, links and more http://geekswithblogs.net/iupdateable Entity Framework 4.0 Resources http://bit.ly/ef4resources

Hinweis der Redaktion

  1. http://en.wikipedia.org/wiki/Object-relational_impedance_mismatchhttp://www.agiledata.org/essays/impedanceMismatch.htmlTechnical and Culturalhttp://en.wikipedia.org/wiki/Abstraction_layerhttp://en.wikipedia.org/wiki/Abstraction_(computer_science)
  2. Started in 70sODBMS 19852004 rise with open sourcedb4o
  3. http://en.wikipedia.org/wiki/Abstraction_layerhttp://en.wikipedia.org/wiki/Abstraction_(computer_science)
  4. DRY http://en.wikipedia.org/wiki/Don%27t_repeat_yourself YAGNI http://en.wikipedia.org/wiki/You_ain%27t_gonna_need_itLeaky http://en.wikipedia.org/wiki/Leaky_abstraction Joel http://www.joelonsoftware.com/articles/LeakyAbstractions.html Rebuff http://www.advogato.org/person/Bram/diary.html?start=43
  5. http://www.codinghorror.com/blog/archives/000621.htmlA rebuff http://www.codeproject.com/KB/architecture/ORM_Vietnam.aspx
  6. Anti in the MS camp http://weblogs.asp.net/fbouma/archive/2003/11/18/38178.aspx
  7. LLBLGen Pro http://www.llblgen.com/Nhibernatehttp://www.hibernate.org/343.htmlEntitySpaceshttp://www.entityspaces.net/Portal/Default.aspxOpen Access http://www.telerik.com/products/orm.aspxDevForcehttp://www.ideablade.com/XPO http://www.devexpress.com/Products/NET/ORM/Lightspeedhttp://www.mindscape.co.nz/products/LightSpeed/default.aspxPlus many, many moreOf 31 .NET ORMs in 2003, 9 lasted to 2008
  8. DevForce now target Entity Framework, replacing their ownLLBLGen v3 will target Entity Framework as well as their ownDevart Entity Developer
  9. Talking Points: When we talk about the Entity Framework, we’re actually talking about two things: The Entity Data Model (EDM) The Entity Framework It’s important to delineate the two as separate, but complementing technologies The EDM is a set of layers that make up your application’s model, as well as it’s mapping to an underlying data store. Made up of three files: CSDL (Conceptual Schema Definition Language) MSL (Mapping Specification Language) SSDL (Storage Schema Definition Language) This separation of concerns allows great flexibility: Model your application the way you want regardless of the state/structure of its underlying data store Normalize your database as much as you need without worrying about affecting the interface of the application’s object model The EDM represents a re-useable application model that can be leveraged from within many applications/environments and persisted across numerous databases. The Entity Data Model is RDMS agnostic, and numerous database vendors are currently developing providers: Oracle, DB2, MySQL, PostgreSQL, VistaDB, SQLite, Sybase, Informix, etc. The Entity Data Model primarily of three main concepts: Entities, which represent your domain objects. Associations, which represent a relationship between two entities. Functions, which represent stored procedures or UDFs in your database that can be mapped to model-level functionality. Because there will be plenty of situations where you’ll need to use stored procedures, the Entity Data Model allows you to map functions in your model to a store procedure in your database. This is useful because you can leverage a stored procedure without having to write ADO.NET code to call it, you can simply call a function on your model. EDM functions are represented as methods on your ObjectContext class.
  10. Estimated Time: 3 minutesTalking Points: This diagram helps to illustrate how each of the Entity Framework’s query options relate to each other. At the core of it all is the database-specific provider. This layer is what translates the query into the SQL flavor required for the underlying data source. Above that is the Entity Client API, which takes the Entity Framework query and passes in down to the database specific provider. If you want to use the Entity Client API directly, you see that you’re only query option is Entity SQL, and because it sits below Object Services, you don’t get any of its benefits. If you want to materialize your queries as objects, and get things like change tracking, identity mapping, relationship loading, etc. then you would use object services, that delegates its queries down to the Entity Client layer. When using Object Services you can leverage both Entity SQL and LINQ to make your queries.
  11. Code GenIn V1 we had EntityClassGenerator which could be configured using eventsHard (it used CodeDom)Inflexible (not much control)In V2 we will haveTemplatedEntityClassGenerator and will ship default T4 templatesCustomization via ToolsUses Workflow FoundationComplex typesPluralizationPublic abstract PluralizationServiceDefault implementation is English OnlyDefault rules:EntityTypes / ComplexTypes are singularizedEntitySets are pluralizedNavigation Properties based on cardinalityStored ProceduresStored Procedures as functionsMapping support for stored procedure resultComplex type as return typeScalar and void return typeEntity CUD using Stored ProceduresNo need to have SPs for all CUD
  12. Foreign KeysIndependent Association – v1 Product p = new Product { ID = 1,       Name = "Bovril",       Category = context.Categories                        .Single(c => c.Name == "Food") }; context.SaveChanges(); FK Association – v2 Product p = new Product     {         ID = 1,         Name = "Bovril",         CategoryID = 13     };     context.Products.AddObject(p);     context.SaveChanges();Deferred LoadingCan do lazy loadContext.deferredloading=true Model Level using ESQL<Function Name=“CustomerFullName” ReturnType=“String”><Parameter Name=“customer” Type=“MyModel.customer”> <DefiningExpression>customer.FirstName + ‘ ‘ + customer.LastName </DefiningExpression> </Function>Enables from c in ctx.Customers select c.FullName()CLR Level [EdmFunction("MyModel", "CustomerFullName")] public static string FullName(this customer c) { return String.Format("{0} {1}", c.FirstName, c.LastName); }Enables Console.WriteLine(c.FullName());Inline Functions in ESQL using Northwind;function AmountPurchased(c Customer) as Sum (c.Sales.Amt)function AmountReturned(c Customer) as Sum (c.Returns.Amt)function AmountConsumed(c Customer) as                                                                     AmountPurchased(c) – AmountReturned(c)select AmountConsumed(c) from Customers as c;
  13. Code OnlyNo XML files, no model!Convention to configE.g. Convention: xxxID to a primary key, schema=dboE.g. Config: On map to schema sys and class property to table column[TableMapping(Schema=“sys”,TableName=“MyDBTable”][ColumnMapping(PropertyName=“MyClassProp1”, ColumnName=“table_column1”)][Key(PropertyName=“MyClassProp1”)]public objectset<MyThing> MyThings...