SlideShare uma empresa Scribd logo
1 de 14
Data centric apps for Web, desktop
and mobile with Entity Framework 5
Diego Vega
Developer Lead
Microsoft
Data Centric Apps with EF5 | Agenda



              What is
 Brief EF
              new in        Demos     Post EF5
overview
               EF5
EF Overview | What is EF?


 • Recommended technology to connect .NET            Microsoft’s
   applications to databases                         Object/Relational
 • LINQ against disparate relational databases       Mapper

 • Make .NET & Windows Azure the best platform for
   data centered apps                                Product goals
 • Be the most productive data access API
EF Overview | Developer Workflows
                         Designer-centric                          Code-centric




                Model first                           Code first
      New       • Create .edmx model in designer      • Define classes and mapping in code
    database    • Generate database from .edmx        • Database auto-created at runtime
                • Classes auto-generated from .edmx


                Database first                        Code first
     Existing   • Reverse engineer into .edmx model   • Reverse engineer into code model
    database
                • Classes auto-generated from .edmx   • Requires EF PowerTools download
EF5 | How we ship it
           EF NuGet Package
           • DbContext, Code First & Migrations
           • Included in VS 2012
           • Works with .NET 4.0 & 4.5, VS 2010 & 2012

           EF Core bits in .NET
           • Updated in .NET 4.5
           • New features like Enums, Spatial, better performance, etc.


           EF Designer in VS
           • Updated in VS 2012
           • New features like multiple diagrams, colorization, DbContext code generation, etc.
EF5 | Major new features

           Both for code-centric and designer-centric developers
           •   Enum support
           •   Spatial data types
           •   Auto-compiled query
           •   Parameter evaluation performance

           Only for designer-centric developers
           •   Table-valued Functions (TVFs)
           •   Multiple diagrams and coloring
           •   Batch import of stored procedures
           •   DbContext code generation
Demo: Park Finder
EF5 | Performance Improvements

Inline LINQ query                          CompiledQuery

return db.People.First(e => e.Id == id);   private static readonly
                                               Func<MyContext, int, Person> findPerson =
                                               CompiledQuery.Compile((MyContext db, int id)
                                               => db.People.First(e => e.Id == id));

                                           …


                                           return findPerson(id);
EF5 | Performance Improvements


// Micro-benchmark: repeated execution of a query by key
using (var db = new MyContext())
{
    for(int id = 0; id < 5000; id++)
    {
        db.People.First(e => e.Id == id);
    }
}
EF5 | Query by key benchmark
results
             2500%


             2000%
Time spent




             1500%


             1000%


             500%


               0%
                          HANDCODED       EF RAW SQL     EF COMPILED       ENTITY SQL     LINQ TO          LINQ TO SQL
                           ADO.NET                          QUERY                         ENTITIES

                     Handcoded ADO.NET   EF Raw SQL    EF Compiled Query   Entity SQL   LINQ to Entities    LINQ to SQL
.NET 4.0                   100%            199%              262%            1518%          2314%             1650%
.NET 4.5                   100%            211%              269%            406%            412%             1350%
EF5 | Web end-to-end benchmark
                          125

                                                  Runs on .NET 4.5 up to 67% faster than on .NET 4.0!
                          100
Average Rows Per Second




                                                                                                                Parameter
                                                                                                          evaluation optimization
                          75

                                                                     Auto-compiled queries
                          50



                          25



                            0
                           8/8/2011   8/15/2011          8/22/2011          8/29/2011        9/5/2011   9/12/2011              9/19/2011
EF6 | Go to my EF6 talk for more!

Open source with contributions   Major new features
Code under Apache 2.0 license     Async query & save
Targeting mid-2013 RTM            Enums, spatial, etc. on .NET 4.0
                                  Code-based configuration
Microsoft
                                  Connection resiliency (retries)
license, branding, quality and
                                  DbContext connection and
support                            transaction improvements
                                  Code First
                                      Custom conventions
                                      CUD stored procedure support
                                  Tooling consolidation
EF | Resources

Vote                             Follow
 ef.mswish.net                     @efmagicunicorns
Learn                               @divega
 msdn.com/data/ef                  facebook.com/efmagicunicorns
Contribute                          blogs.msdn.com/adonet
 entityframework.codeplex.com      blogs.msdn.com/diego

Mais conteúdo relacionado

Mais procurados

Mais procurados (8)

.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
 
Zend Products and PHP for IBMi
Zend Products and PHP for IBMi  Zend Products and PHP for IBMi
Zend Products and PHP for IBMi
 
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 
Unit Tests are Overrated (NDCOslo 2013)
Unit Tests are Overrated (NDCOslo 2013)Unit Tests are Overrated (NDCOslo 2013)
Unit Tests are Overrated (NDCOslo 2013)
 
Zend Framework
Zend FrameworkZend Framework
Zend Framework
 
272 rosenblum word2007-ssp2008
272 rosenblum word2007-ssp2008272 rosenblum word2007-ssp2008
272 rosenblum word2007-ssp2008
 
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 

Semelhante a Building data centric applications for web, desktop and mobile with Entity Framework 5

Overview Of .Net 4.0 Sanjay Vyas
Overview Of .Net 4.0   Sanjay VyasOverview Of .Net 4.0   Sanjay Vyas
Overview Of .Net 4.0 Sanjay Vyas
rsnarayanan
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Framework
Doncho Minkov
 
Lap Around Entity Framework
Lap Around Entity FrameworkLap Around Entity Framework
Lap Around Entity Framework
Jaliya Udagedara
 
Lap Around Entity Framework
Lap Around Entity FrameworkLap Around Entity Framework
Lap Around Entity Framework
Jaliya Udagedara
 

Semelhante a Building data centric applications for web, desktop and mobile with Entity Framework 5 (20)

Deep Dive into Entity Framework 6.0
Deep Dive into Entity Framework 6.0Deep Dive into Entity Framework 6.0
Deep Dive into Entity Framework 6.0
 
Entity Framework Today (May 2012)
Entity Framework Today (May 2012)Entity Framework Today (May 2012)
Entity Framework Today (May 2012)
 
Applying EF Code First at Your Job
Applying EF Code First at Your JobApplying EF Code First at Your Job
Applying EF Code First at Your Job
 
70487.pdf
70487.pdf70487.pdf
70487.pdf
 
Leverage Entity Framework 7 in Business Application Design
Leverage Entity Framework 7 in Business Application Design Leverage Entity Framework 7 in Business Application Design
Leverage Entity Framework 7 in Business Application Design
 
Ow
OwOw
Ow
 
Overview Of .Net 4.0 Sanjay Vyas
Overview Of .Net 4.0   Sanjay VyasOverview Of .Net 4.0   Sanjay Vyas
Overview Of .Net 4.0 Sanjay Vyas
 
Intro to VS 2010 & .Net 4.0
Intro to VS 2010 & .Net 4.0Intro to VS 2010 & .Net 4.0
Intro to VS 2010 & .Net 4.0
 
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
 
Entity Framework Core 1.0
Entity Framework Core 1.0Entity Framework Core 1.0
Entity Framework Core 1.0
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overview
 
Using entity framework core in .net
Using entity framework core in .netUsing entity framework core in .net
Using entity framework core in .net
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Framework
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Framework
 
Presenter manual J2EE (specially for summer interns)
Presenter manual  J2EE (specially for summer interns)Presenter manual  J2EE (specially for summer interns)
Presenter manual J2EE (specially for summer interns)
 
Lap Around Entity Framework
Lap Around Entity FrameworkLap Around Entity Framework
Lap Around Entity Framework
 
Lap Around Entity Framework
Lap Around Entity FrameworkLap Around Entity Framework
Lap Around Entity Framework
 
Learn Entity Framework in a day with Code First, Model First and Database First
Learn Entity Framework in a day with Code First, Model First and Database FirstLearn Entity Framework in a day with Code First, Model First and Database First
Learn Entity Framework in a day with Code First, Model First and Database First
 
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 Data Access Technologies
Microsoft Data Access TechnologiesMicrosoft Data Access Technologies
Microsoft Data Access Technologies
 

Mais de Microsoft Developer Network (MSDN) - Belgium and Luxembourg

Mais de Microsoft Developer Network (MSDN) - Belgium and Luxembourg (20)

Code in the Cloud - Ghent - 20 February 2015
Code in the Cloud - Ghent - 20 February 2015Code in the Cloud - Ghent - 20 February 2015
Code in the Cloud - Ghent - 20 February 2015
 
Executive Summit for ISV & Application builders - January 2015
Executive Summit for ISV & Application builders - January 2015Executive Summit for ISV & Application builders - January 2015
Executive Summit for ISV & Application builders - January 2015
 
Executive Summit for ISV & Application builders - Internet of Things
Executive Summit for ISV & Application builders - Internet of ThingsExecutive Summit for ISV & Application builders - Internet of Things
Executive Summit for ISV & Application builders - Internet of Things
 
Executive Summit for ISV & Application builders - January 2015
Executive Summit for ISV & Application builders - January 2015Executive Summit for ISV & Application builders - January 2015
Executive Summit for ISV & Application builders - January 2015
 
Code in the Cloud - December 8th 2014
Code in the Cloud - December 8th 2014Code in the Cloud - December 8th 2014
Code in the Cloud - December 8th 2014
 
Adam azure presentation
Adam   azure presentationAdam   azure presentation
Adam azure presentation
 
release management
release managementrelease management
release management
 
cloud value for application development
cloud value for application developmentcloud value for application development
cloud value for application development
 
Modern lifecycle management practices
Modern lifecycle management practicesModern lifecycle management practices
Modern lifecycle management practices
 
Belgian visual studio launch 2013
Belgian visual studio launch 2013Belgian visual studio launch 2013
Belgian visual studio launch 2013
 
Windows Azure Virtually Speaking
Windows Azure Virtually SpeakingWindows Azure Virtually Speaking
Windows Azure Virtually Speaking
 
Inside the Microsoft TechDays Belgium Apps
Inside the Microsoft TechDays Belgium AppsInside the Microsoft TechDays Belgium Apps
Inside the Microsoft TechDays Belgium Apps
 
TechDays 2013 Developer Keynote
TechDays 2013 Developer KeynoteTechDays 2013 Developer Keynote
TechDays 2013 Developer Keynote
 
Windows Phone 8 Security Deep Dive
Windows Phone 8 Security Deep DiveWindows Phone 8 Security Deep Dive
Windows Phone 8 Security Deep Dive
 
Applied MVVM in Windows 8 apps: not your typical MVVM session!
Applied MVVM in Windows 8 apps: not your typical MVVM session!Applied MVVM in Windows 8 apps: not your typical MVVM session!
Applied MVVM in Windows 8 apps: not your typical MVVM session!
 
Building SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.jsBuilding SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.js
 
Deep Dive and Best Practices for Windows Azure Storage Services
Deep Dive and Best Practices for Windows Azure Storage ServicesDeep Dive and Best Practices for Windows Azure Storage Services
Deep Dive and Best Practices for Windows Azure Storage Services
 
Bart De Smet Unplugged
Bart De Smet UnpluggedBart De Smet Unplugged
Bart De Smet Unplugged
 
Putting the Microsoft Design Language to work
Putting the Microsoft Design Language to workPutting the Microsoft Design Language to work
Putting the Microsoft Design Language to work
 
Cloud enable your Windows Store Apps with Mobile Services
Cloud enable your Windows Store Apps with Mobile ServicesCloud enable your Windows Store Apps with Mobile Services
Cloud enable your Windows Store Apps with Mobile Services
 

Building data centric applications for web, desktop and mobile with Entity Framework 5

  • 1. Data centric apps for Web, desktop and mobile with Entity Framework 5 Diego Vega Developer Lead Microsoft
  • 2. Data Centric Apps with EF5 | Agenda What is Brief EF new in Demos Post EF5 overview EF5
  • 3. EF Overview | What is EF? • Recommended technology to connect .NET Microsoft’s applications to databases Object/Relational • LINQ against disparate relational databases Mapper • Make .NET & Windows Azure the best platform for data centered apps Product goals • Be the most productive data access API
  • 4. EF Overview | Developer Workflows Designer-centric Code-centric Model first Code first New • Create .edmx model in designer • Define classes and mapping in code database • Generate database from .edmx • Database auto-created at runtime • Classes auto-generated from .edmx Database first Code first Existing • Reverse engineer into .edmx model • Reverse engineer into code model database • Classes auto-generated from .edmx • Requires EF PowerTools download
  • 5. EF5 | How we ship it EF NuGet Package • DbContext, Code First & Migrations • Included in VS 2012 • Works with .NET 4.0 & 4.5, VS 2010 & 2012 EF Core bits in .NET • Updated in .NET 4.5 • New features like Enums, Spatial, better performance, etc. EF Designer in VS • Updated in VS 2012 • New features like multiple diagrams, colorization, DbContext code generation, etc.
  • 6. EF5 | Major new features Both for code-centric and designer-centric developers • Enum support • Spatial data types • Auto-compiled query • Parameter evaluation performance Only for designer-centric developers • Table-valued Functions (TVFs) • Multiple diagrams and coloring • Batch import of stored procedures • DbContext code generation
  • 7.
  • 9. EF5 | Performance Improvements Inline LINQ query CompiledQuery return db.People.First(e => e.Id == id); private static readonly Func<MyContext, int, Person> findPerson = CompiledQuery.Compile((MyContext db, int id) => db.People.First(e => e.Id == id)); … return findPerson(id);
  • 10. EF5 | Performance Improvements // Micro-benchmark: repeated execution of a query by key using (var db = new MyContext()) { for(int id = 0; id < 5000; id++) { db.People.First(e => e.Id == id); } }
  • 11. EF5 | Query by key benchmark results 2500% 2000% Time spent 1500% 1000% 500% 0% HANDCODED EF RAW SQL EF COMPILED ENTITY SQL LINQ TO LINQ TO SQL ADO.NET QUERY ENTITIES Handcoded ADO.NET EF Raw SQL EF Compiled Query Entity SQL LINQ to Entities LINQ to SQL .NET 4.0 100% 199% 262% 1518% 2314% 1650% .NET 4.5 100% 211% 269% 406% 412% 1350%
  • 12. EF5 | Web end-to-end benchmark 125 Runs on .NET 4.5 up to 67% faster than on .NET 4.0! 100 Average Rows Per Second Parameter evaluation optimization 75 Auto-compiled queries 50 25 0 8/8/2011 8/15/2011 8/22/2011 8/29/2011 9/5/2011 9/12/2011 9/19/2011
  • 13. EF6 | Go to my EF6 talk for more! Open source with contributions Major new features Code under Apache 2.0 license  Async query & save Targeting mid-2013 RTM  Enums, spatial, etc. on .NET 4.0  Code-based configuration Microsoft  Connection resiliency (retries) license, branding, quality and  DbContext connection and support transaction improvements  Code First  Custom conventions  CUD stored procedure support  Tooling consolidation
  • 14. EF | Resources Vote Follow  ef.mswish.net  @efmagicunicorns Learn  @divega  msdn.com/data/ef  facebook.com/efmagicunicorns Contribute  blogs.msdn.com/adonet  entityframework.codeplex.com  blogs.msdn.com/diego