Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

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

2,053 views

Published on

More info on Techdays.be

  • Be the first to comment

  • Be the first to like this

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

  1. 1. Data centric apps for Web, desktopand mobile with Entity Framework 5Diego VegaDeveloper LeadMicrosoft
  2. 2. Data Centric Apps with EF5 | Agenda What is Brief EF new in Demos Post EF5overview EF5
  3. 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. 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. 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. 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. 7. Demo: Park Finder
  8. 8. EF5 | Performance ImprovementsInline LINQ query CompiledQueryreturn 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);
  9. 9. EF5 | Performance Improvements// Micro-benchmark: repeated execution of a query by keyusing (var db = new MyContext()){ for(int id = 0; id < 5000; id++) { db.People.First(e => e.Id == id); }}
  10. 10. EF5 | Query by key benchmarkresults 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%
  11. 11. EF5 | Web end-to-end benchmark 125 Runs on .NET 4.5 up to 67% faster than on .NET 4.0! 100Average 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
  12. 12. EF6 | Go to my EF6 talk for more!Open source with contributions Major new featuresCode under Apache 2.0 license  Async query & saveTargeting mid-2013 RTM  Enums, spatial, etc. on .NET 4.0  Code-based configurationMicrosoft  Connection resiliency (retries)license, branding, quality and  DbContext connection andsupport transaction improvements  Code First  Custom conventions  CUD stored procedure support  Tooling consolidation
  13. 13. EF | ResourcesVote Follow ef.mswish.net  @efmagicunicornsLearn  @divega msdn.com/data/ef  facebook.com/efmagicunicornsContribute  blogs.msdn.com/adonet entityframework.codeplex.com  blogs.msdn.com/diego

×