ADO.NET Entity Framework DevDays

4,442 views
4,307 views

Published on

ADO.NET Entity Framework DevDays

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,442
On SlideShare
0
From Embeds
0
Number of Embeds
26
Actions
Shares
0
Downloads
202
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

ADO.NET Entity Framework DevDays

  1. 2. ADO.NET ENTITY FRAMEWORK <ul><li>Mike Taulty </li></ul><ul><li>Developer & Platform Group </li></ul><ul><li>Microsoft UK </li></ul><ul><li>[email_address] </li></ul><ul><li>http://www.miketaulty.com </li></ul>
  2. 3. Entity Framework – Key Facts <ul><li>Extension to the ADO.NET Provider Model </li></ul><ul><ul><li>Pluggable to support any database </li></ul></ul><ul><li>Functionality </li></ul><ul><ul><li>Abstracts a model from your store schema </li></ul></ul><ul><ul><li>Offers Object Relational Mapping/LINQ and ADO.NET APIs </li></ul></ul><ul><li>Status </li></ul><ul><ul><li>Coming in Visual Studio 2008 Sp1, Summer 2008 </li></ul></ul><ul><ul><li>Currently in VS 2008 Sp1 Beta 1 </li></ul></ul><ul><ul><ul><li>3 previous independent betas </li></ul></ul></ul>
  3. 4. ADO.NET Entity Framework SQL Provider Oracle Provider ... Entity Provider Conceptual Model Store Model Map ADO.NET API ORM API Connection Command DataReader ObjectContext ObjectQuery
  4. 5. ADO.NET Entity Framework SQL Provider Oracle Provider ... ADO.NET API Entity Provider Conceptual Model Store Model Map ORM API
  5. 6. LINQ to SQL? LINQ to Entities? LINQ to SQL LINQ to Entities Database Support SQL Server Many Object Relational Mapping Capabilities Simple Complex Requires Attributed .NET Code No Yes Status Released Beta
  6. 7. DEMO <ul><li>Programming Entity Framework with LINQ </li></ul>
  7. 8. Key Classes State Management Connection provider Metadata MSL SSDL CSDL CRUD
  8. 9. LINQ to Entities – Lots of Topics
  9. 10. ADO.NET Entity Framework SQL Provider Oracle Provider ... ADO.NET API ORM API Entity Provider Conceptual Model Store Model Map
  10. 11. DEMO <ul><li>Manipulating our Conceptual Model </li></ul>
  11. 12. ADO.NET Entity Framework SQL Provider Oracle Provider ... ORM API Entity Provider Conceptual Model Store Model Map ADO.NET API
  12. 13. DEMO <ul><li>Programming with Entity SQL and ADO.NET </li></ul>
  13. 14. EF Providers in Progress Vendor DB Support Microsoft SQL Server Core Lab Oracle, MySQL, PostgreSQL, SQLite IBM DB2, Informix Dynamic Server MySQL AB MySQL Npgsql PostgreSQL OpenLink Many via OpenLink ODBC or JDBC Phoenix SQLite DataDirect Oracle, Sybase, SQL Server, DB2 Firebird Firebird
  14. 15. Resources <ul><li>New Data Developer Site </li></ul><ul><ul><li>http://www.datadeveloper.net </li></ul></ul><ul><li>ADO.NET Team Blog </li></ul><ul><ul><li>http://blogs.msdn.com/adonet </li></ul></ul><ul><li>My website  </li></ul><ul><ul><li>http://www.miketaulty.com ( search Entity ) </li></ul></ul>
  15. 16. ADO.NET ENTITY FRAMEWORK <ul><li>Mike Taulty </li></ul><ul><li>Developer & Platform Group </li></ul><ul><li>Microsoft UK </li></ul><ul><li>[email_address] </li></ul><ul><li>http://www.miketaulty.com </li></ul>
  16. 18. ADO.NET Today App Code Customers ADO.NET Providers SQL Server Oracle ... DataReader Customers Oracle Command Execute Provider Specific (PL/SQL) “ SELECT * FROM CUSTOMERS” Customers
  17. 19. ADO.NET Entity Framework Customers Conceptual Model UKCustomer UKPremiumCustomer Map
  18. 20. ADO.NET Entity Framework App Code Customers ADO.NET Providers* SQL Server Oracle ... Oracle Entity Provider DataReader UKCustomer Command Execute Conceptual Model UKCustomer UKPremiumCustomer Map Provider Agnostic (ESQL) “ SELECT * FROM UKCUSTOMER” UKCustomer
  19. 21. ADO.NET Entity Framework .NET Entity Provider (Entity SQL) Command Connection Reader EF Store .NET Data Provider V2.0 Command Connection Reader Adapter EF Conceptual Model Entity Entity relationship Store Model (SSDL) Entity Data Model (CSDL) Mapping (MSL) EF Programming Model Object Relational Mapping LINQ
  20. 22. Programming with Entity SQL <ul><li>The EntityClient provides the usual </li></ul><ul><ul><li>Connection, Command, DataReader </li></ul></ul><ul><li>There is no EntityDataAdapter </li></ul><ul><ul><li>V1.0 the model is read-only </li></ul></ul><ul><li>Entity SQL has some additional constructs to expose the underlying conceptual model </li></ul>
  21. 23. DEMO <ul><li>Programming with Entity SQL </li></ul>
  22. 24. Mapping Examples ( 1 – Splitting ) Mapping Type=“G” Type=“B” Store Good Customers ID FirstName LastName Bad Customers ID ForeName Surname Customers CustomerId First Last Type Entities
  23. 25. Mapping Examples ( 2 – TPH ) Store Entities Mapping PremiumCustomer Overdraft AccountManager * Framework also supports TPT Customer CustomerId First Last Customers ID FirstName LastName IsPremium Overdraft AccountManager ?
  24. 26. Mapping Examples ( 3 – View + SPs ) Store Entities Mapping ClientView1 select c.id, c.name from customers c where c.country = ‘UK’ p_DeleteUkCustomer p_UpdateUkCustomer p_InsertUkCustomer UkCustomer CustomerId Name
  25. 27. DEMO <ul><li>Querying Different Models with Entity SQL </li></ul>
  26. 28. Programming with LINQ to Entities <ul><li>New Data Access ORM API implemented in assembly </li></ul><ul><ul><li>System.Data.Entity.dll </li></ul></ul><ul><li>Many Namespaces </li></ul><ul><ul><li>System.Data.Entity </li></ul></ul><ul><ul><li>System.Data.Objects </li></ul></ul><ul><ul><li>... </li></ul></ul><ul><li>Object Relational Mapping API can be used with or without LINQ </li></ul>
  27. 29. DEMO <ul><li>Programming with LINQ to Entities </li></ul>

×