SlideShare a Scribd company logo
1 of 39
Eric Nelson
Developer & Platform Group
Microsoft Ltd
eric.nelson@microsoft.com
http://geekswithblogs.net/IUpdateable
http://twitter.com/ericnel
Microsoft UK MSDN Flash Newsletter
Every two weeks, pure joy enters your Inbox 


                                                                  MSDN Flash Podcast Pilot
                                                                  For feedback
                                                                  http://bit.ly/flashpod1
 http://msdn.microsoft.com/uk/flash




                                      MSDN Flash eBook
                                      13 of the “Best Technical                             Technical Authors wanted
                                      Articles of 2008”
                                                                                            for the Flash – 400 to 500
                                      http://bit.ly/flashebook1
                                                                                            words. Fancy it?
ORMs
  Swift look at history and future of ORM on
  Windows
Entity Framework – with demos
  Entity Data Model
  Entity Services
  Object Services
Entity Framework v2 – with no demos
  Overview of POCO, Model First etc
Accessing data in 1990
• ODBC, embedded SQL


   Accessing data in 2000
   • ADO, Stored Procedures


       Accessing data in 2005
       • ADO.NET, Datasets, DataReaders

           Accessing data in 2010
           • ORM baby!
What is it?
   an Abstraction
   technique for working with relational tables as if they
   were objects in memory
   Intention is to hide away the complexity of the
   underlying tables and give a uniform way of working
   with data
Why use it?
   Developer productivity
   Retain database independence
Note:
   Using an ORM does not mean you must use the ORM!
Many ORMs out there
     LLBLGen Pro http://www.llblgen.com/
     Nhibernate http://www.hibernate.org/343.html
     EntitySpaces http://www.entityspaces.net/Portal/Default.aspx
     Open Access http://www.telerik.com/products/orm.aspx
     DevForce http://www.ideablade.com/
     XPO http://www.devexpress.com/Products/NET/ORM/
     Lightspeed
     http://www.mindscape.co.nz/products/LightSpeed/default.aspx
     Plus many, many more
No clear “winner” = relatively little
adoption of ORM
   Developers waiting on Microsoft
   Of 31 .NET ORMs in 2003, 9 lasted to 2008
Typed Datasets (cough) – shipped 
   ObjectSpaces “v1” – never shipped 
   ObjectSpaces “v2” – never shipped 
   Microsoft Business Framework – never shipped 
   WinFS – never shipped 
   LINQ to SQL - shipped November 2007 
       Visual Studio 2008 & .NET Framework 3.5
   LINQ to Entities - shipped August 2008 
       Visual Studio 2008 SP1 & .NET Framework 3.5 SP1


Note: LINQ to Entities is the most visible part of the
  ADO.NET Entity Framework
Entity Framework and LINQ to Entities is our strategic
technology
   Entity Framework v2 in VS2010 and .NET Framework 4.0
      Best of LINQ to SQL moves into LINQ to Entities
   Microsoft is using it
      Data Services - shipping
      Reporting Services
      Microsoft “M”
Partners supporting it
   Database Vendors – IBM,OpenLink, DataDirect, Devart etc
   ORM vendors supporting it
      DevForce now target Entity Framework, replacing their own
      LLBLGen v3 will target Entity Framework as well as their own
      Devart Entity Developer

It is not just about ORM
{ Simple Walkthough }
LINQ to SQL       LINQ to Entities
Database Support    SQL Server        SQL Server, DB2,
                                      Oracle, Sybase,
                                      MySQL ...
Object Relational   Simple            Complex
Mapping
Capabilities
                    Not strategic 
Status                                Strategic
                                      Often 
Annoying            Rarely
Entity Framework is not just about ORM
Entity Framework v1 is being adopted
   Typically on applications expected to “live” a long time
Entity Framework is only .NET 3.5 SP1 and above
Entity Framework is probably not the best choice for
a “short lived” SQL Server applications
Entity Framework v1 has “warts”
     Designer
                It is annoying – buggy, clunky
                Exposes subset of the functionality
                Does not support model first
     N-tier story
     Stored Procedure Support
     Foreign Keys
     PoCo
     Guids
     SQL 2008 New Types
“EF is still cutting
     development time
                            “the entity framework
      in half. Ya gotta
                              can kiss my damn
          love it.”
                               ass - this shit is
                                  ridiculous”


http://bit.ly/EFmarmite
Tools and services to create an Entity
Data Model (EDM)
Tools and services for consuming an
Entity Data Model
Entity Data Model
Application model
   Mapped to a persistence
   store
                                Conceptual
Comprised of three
layers:
   Conceptual (CSDL)
   Mapping (MSL)                 Mapping
   Storage (SSDL)
Database agnostic
Comprised of:
                                 Storage
   Entities
   Associations
   Functions
{ A look at mapping }
2      1               The ORM
                           - optional
         Object Services
3


        Entity Client
Familiar ADO.NET object model:
  EntityCommand
  EntityConnection
  EntityDataReader
  EntityParameter
  EntityTransaction
Text-based results
Read-only
Uses Entity SQL
Queries materialized as Objects
   ObjectContext
   ObjectQuery<T>
Built on top of Entity Client
Two query options:
   Entity SQL
   LINQ
Runtime services:
   Unit of work
   Identity tracking
   Eager/explicit loading
{ Consuming an EDM}
ORM is an abstraction layer over data
 • Productivity
 • Database Independence
Microsoft has two ORMs
 • LINQ to SQL – only SQL Server
 • Entity Framework (includes LINQ to Entities) – many RDBMS, strategic
ADO.NET Entity Framework includes all the other bits 
 • EDM, Linq to Entities, ESQL, Object Services, Entity Services
 • Part of .NET Framework 3.5 SP1
Entity Data Model – mapping from conceptual to store
 • CSDL = Conceptual Schema Definition Language
 • SSDL = Store Schema Definition Language
 • MSDL = Mapping Schema Definition Language
Two query languages
 • ESQL = Entity SQL. Read only query language similar to SQL
 • LINQ to Entities = Language Integrated Query to the EDM
For Everyone
     Pluralization
     Foreign Keys
     Stored Procedures
     Self tracking Entities
 For the Model Centric Developer
     Model First
     Complex Types
     Model Defined Functions
 For the Control Freak
     Code Generation
 For the Agilist
     Persistence Ignorance, Lazy Loading, Code Only
 + “Other stuff”

Warning – not final. Expect changes!
Pluralization
  Used in Database First and Model First
  Implementation
    Public abstract PluralizationService
    Default implementation is English Only
    Default rules:
      EntityTypes / ComplexTypes are singularized
      EntitySets are pluralized
      Navigation Properties based on cardinality
Foreign Keys
  Independent Association – v1
    Product p = new Product
    {
         ID = 1,
          Name = quot;Bovrilquot;,
          Category = context.Categories
                            .Single(c => c.Name == quot;Foodquot;)
    };
    context.SaveChanges();

  FK Association – v2
    Product p = new Product
    {
        ID = 1,
        Name = quot;Bovrilquot;,
        CategoryID = 13
    };
    context.Products.AddObject(p);
    context.SaveChanges();
Stored Procedures
  Stored Procedures as functions
    Mapping support for stored procedure result
    Complex type as return type
    Scalar and void return type
  Entity CUD using Stored Procedures
    No need to have SPs for all CUD
Entities do their own change tracking
   regardless of which tier changes are made on
Somewhere between DTOs and DataSets
Model First
   Start with a blank model
   Add entities/relationships (CSDL)
   Click “Create Database from
   Model”
      Infer Storage Model (SSDL)
      Infer Mapping (MSL)
      Infer DDL
      Deploy DDL
   Modify and re-apply. Two way.
      But - deletes your data!!!
Complex Types
  Map a new type to many types
  Adds designer support
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(quot;MyModelquot;, quot;CustomerFullNamequot;)]
 public static string FullName(this customer c)
 {
    return String.Format(quot;{0} {1}quot;, c.FirstName, c.LastName);
 }

Enables Console.WriteLine(c.FullName());
In V1 we had EntityClassGenerator which
could be configured using events
  Hard (it used CodeDom)
  Inflexible (not much control)
In V2 we will have
  TemplatedEntityClassGenerator and will ship
  default T4 templates
  Customization via Tools
Uses Workflow Foundation
Persistence Ignorance
  Support for Plain Old CLR Objects
  No requirement to have specific interface, base
  class
Lazy Loading
  Can not do order.order_details.Load()
  But
  Can do lazy load
    Context.deferredloading=true
Code Only
  No XML files, no model!
  Convention to config
    E.g. Convention: xxxID to a primary
    key, schema=dbo
    E.g. Config: On map to schema sys and class
    property to table column

    [TableMapping(Schema=“sys”,TableName=“MyDBTable”]
    [ColumnMapping(PropertyName=“MyClassProp1”, Column
      Name=“table_column1”)]
    [Key(PropertyName=“MyClassProp1”)]
    public objectset<MyThing> MyThings...
Improved N-Tier API
More LINQ query operators
More SQL generation optimizations
Inline functions in ESQL
Readonly mapping
1990 to   • Data Access technology remained
            reasonably static
2008 -    • Procedural, API access
          • Surfaced the database schema
Tables    • No clear ORM choice



          • LINQ – excellent addition to the .NET
2009 –      languages
          • Entity Framework and the EDM – strategic
Objects     investment
          • Productivity leap
http://blogs.msdn.com/efdesign
  Entity Framework v2

http://geekswithblogs.net/IUpdateable
  Slides

http://bit.ly/BW1Lq EF Performance
© 2008 Microsoft Ltd. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
     conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
                                 MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Driven by Reporting Services team + others
Query Tree Writing with no objects...
   LINQ query without objects...
   DbExpression expression=ctx.EntitySet(quot;Ordersquot;).Scan().Where(...);
   DbDataReader reader = ctx.ExecuteQuery(expression);


   Or

   from c in ctx.EntitySet(“Orders”).Scan()
   Select c.Property(“ShipCity”)

Readonly mapping
<EntityContainerMapping CdmEntityContainer=quot;CContainerquot;
    StorageEntityContainer=quot;SContainerquot; GenerateUpdateViews=quot;falsequot; >

More Related Content

What's hot

Using MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkUsing MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkStefano Paluello
 
Introducing Entity Framework 4.0
Introducing Entity Framework 4.0Introducing Entity Framework 4.0
Introducing Entity Framework 4.0Bishoy Demian
 
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 FirstJibran Rasheed Khan
 
Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code firstConfiz
 
Microsoft SQL Server 2008
Microsoft SQL Server 2008Microsoft SQL Server 2008
Microsoft SQL Server 2008Hossein Zahed
 
Using sqlite database in android with sqlite manager browser add ons
Using sqlite database in android with sqlite manager browser add onsUsing sqlite database in android with sqlite manager browser add ons
Using sqlite database in android with sqlite manager browser add onsVincent Clyde
 
Deadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix ItDeadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix ItBrent Ozar
 
Microsoft Entity Framework
Microsoft Entity FrameworkMicrosoft Entity Framework
Microsoft Entity FrameworkMahmoud Tolba
 
Building nTier Applications with Entity Framework Services
Building nTier Applications with Entity Framework ServicesBuilding nTier Applications with Entity Framework Services
Building nTier Applications with Entity Framework ServicesDavid McCarter
 
Entity framework
Entity frameworkEntity framework
Entity frameworkicubesystem
 
Microsoft/Zend Webcast on Cloud Computing
Microsoft/Zend Webcast on Cloud ComputingMicrosoft/Zend Webcast on Cloud Computing
Microsoft/Zend Webcast on Cloud ComputingJosh Holmes
 
Persistence on iOS
Persistence on iOSPersistence on iOS
Persistence on iOSMake School
 
Introducing the Entity Framework
Introducing the Entity FrameworkIntroducing the Entity Framework
Introducing the Entity FrameworkLearnNowOnline
 
Entity Framework v2 Best Practices
Entity Framework v2 Best PracticesEntity Framework v2 Best Practices
Entity Framework v2 Best PracticesAndri Yadi
 
Entity Framework
Entity FrameworkEntity Framework
Entity Frameworkvrluckyin
 
Persitance Data with sqlite
Persitance Data with sqlitePersitance Data with sqlite
Persitance Data with sqliteArif Huda
 
Intro to Core Data
Intro to Core DataIntro to Core Data
Intro to Core DataMake School
 
Advanced Core Data
Advanced Core DataAdvanced Core Data
Advanced Core DataMake School
 

What's hot (20)

Using MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkUsing MongoDB with the .Net Framework
Using MongoDB with the .Net Framework
 
Introducing Entity Framework 4.0
Introducing Entity Framework 4.0Introducing Entity Framework 4.0
Introducing Entity Framework 4.0
 
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
 
Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code first
 
Microsoft SQL Server 2008
Microsoft SQL Server 2008Microsoft SQL Server 2008
Microsoft SQL Server 2008
 
Ef code first
Ef code firstEf code first
Ef code first
 
Using sqlite database in android with sqlite manager browser add ons
Using sqlite database in android with sqlite manager browser add onsUsing sqlite database in android with sqlite manager browser add ons
Using sqlite database in android with sqlite manager browser add ons
 
Deadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix ItDeadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix It
 
Microsoft Entity Framework
Microsoft Entity FrameworkMicrosoft Entity Framework
Microsoft Entity Framework
 
Building nTier Applications with Entity Framework Services
Building nTier Applications with Entity Framework ServicesBuilding nTier Applications with Entity Framework Services
Building nTier Applications with Entity Framework Services
 
Entity framework
Entity frameworkEntity framework
Entity framework
 
Microsoft/Zend Webcast on Cloud Computing
Microsoft/Zend Webcast on Cloud ComputingMicrosoft/Zend Webcast on Cloud Computing
Microsoft/Zend Webcast on Cloud Computing
 
Persistence on iOS
Persistence on iOSPersistence on iOS
Persistence on iOS
 
Introducing the Entity Framework
Introducing the Entity FrameworkIntroducing the Entity Framework
Introducing the Entity Framework
 
Entity Framework v2 Best Practices
Entity Framework v2 Best PracticesEntity Framework v2 Best Practices
Entity Framework v2 Best Practices
 
Entity Framework
Entity FrameworkEntity Framework
Entity Framework
 
Persitance Data with sqlite
Persitance Data with sqlitePersitance Data with sqlite
Persitance Data with sqlite
 
Intro to Core Data
Intro to Core DataIntro to Core Data
Intro to Core Data
 
MERN stack roadmap
MERN stack roadmapMERN stack roadmap
MERN stack roadmap
 
Advanced Core Data
Advanced Core DataAdvanced Core Data
Advanced Core Data
 

Similar to Entity Framework V1 and V2

Entity Framework v1 and v2
Entity Framework v1 and v2Entity Framework v1 and v2
Entity Framework v1 and v2Eric Nelson
 
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
 
What's New for Data?
What's New for Data?What's New for Data?
What's New for Data?ukdpe
 
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 - ericnelukdpe
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity FrameworkDoncho Minkov
 
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource GroupLINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource GroupShahzad
 
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
 
Concepts of Asp.Net
Concepts of Asp.NetConcepts of Asp.Net
Concepts of Asp.Netvidyamittal
 
Session2(Mod)
Session2(Mod)Session2(Mod)
Session2(Mod)mccmepco
 
ADO.NET Entity Framework DevDays
ADO.NET Entity Framework DevDaysADO.NET Entity Framework DevDays
ADO.NET Entity Framework DevDaysukdpe
 
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
 
Data Driven WPF and Silverlight Applications
Data Driven WPF and Silverlight ApplicationsData Driven WPF and Silverlight Applications
Data Driven WPF and Silverlight ApplicationsDave Allen
 
What Impact Will Entity Framework Have On Architecture
What Impact Will Entity Framework Have On ArchitectureWhat Impact Will Entity Framework Have On Architecture
What Impact Will Entity Framework Have On ArchitectureEric Nelson
 
Introdot Netc Sharp En
Introdot Netc Sharp EnIntrodot Netc Sharp En
Introdot Netc Sharp EnGregory Renard
 
Soprex framework on .net in action
Soprex framework on .net in actionSoprex framework on .net in action
Soprex framework on .net in actionMilan Vukoje
 

Similar to Entity Framework V1 and V2 (20)

Entity Framework v1 and v2
Entity Framework v1 and v2Entity Framework v1 and v2
Entity Framework v1 and v2
 
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)
 
What's New for Data?
What's New for Data?What's New for Data?
What's New for Data?
 
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
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Framework
 
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource GroupLINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
 
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
 
Concepts of Asp.Net
Concepts of Asp.NetConcepts of Asp.Net
Concepts of Asp.Net
 
70487.pdf
70487.pdf70487.pdf
70487.pdf
 
Session2(Mod)
Session2(Mod)Session2(Mod)
Session2(Mod)
 
Programming
Programming Programming
Programming
 
ADO.NET Entity Framework DevDays
ADO.NET Entity Framework DevDaysADO.NET Entity Framework DevDays
ADO.NET Entity Framework DevDays
 
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
 
Asp.net new
Asp.net newAsp.net new
Asp.net new
 
Data Driven WPF and Silverlight Applications
Data Driven WPF and Silverlight ApplicationsData Driven WPF and Silverlight Applications
Data Driven WPF and Silverlight Applications
 
What Impact Will Entity Framework Have On Architecture
What Impact Will Entity Framework Have On ArchitectureWhat Impact Will Entity Framework Have On Architecture
What Impact Will Entity Framework Have On Architecture
 
Introdot Netc Sharp En
Introdot Netc Sharp EnIntrodot Netc Sharp En
Introdot Netc Sharp En
 
Soprex framework on .net in action
Soprex framework on .net in actionSoprex framework on .net in action
Soprex framework on .net in action
 
Mahmoud Mustafa Cv
Mahmoud Mustafa CvMahmoud Mustafa Cv
Mahmoud Mustafa Cv
 

More from ukdpe

Mike Ormond: Silverlight for Windows Phone 7 (UK TechDays)
Mike Ormond: Silverlight for Windows Phone 7 (UK TechDays)Mike Ormond: Silverlight for Windows Phone 7 (UK TechDays)
Mike Ormond: Silverlight for Windows Phone 7 (UK TechDays)ukdpe
 
Windows Phone 7: How (Not) to Fail Marketplace Ingestion
Windows Phone 7: How (Not) to Fail Marketplace IngestionWindows Phone 7: How (Not) to Fail Marketplace Ingestion
Windows Phone 7: How (Not) to Fail Marketplace Ingestionukdpe
 
Mike Ormond: Developing for Windows Phone 7
Mike Ormond: Developing for Windows Phone 7Mike Ormond: Developing for Windows Phone 7
Mike Ormond: Developing for Windows Phone 7ukdpe
 
Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)ukdpe
 
Microsoft UK TechDays - jQuery and ASP.NET
Microsoft UK TechDays - jQuery and ASP.NETMicrosoft UK TechDays - jQuery and ASP.NET
Microsoft UK TechDays - jQuery and ASP.NETukdpe
 
Microsoft UK TechDays - Top 10 ASP.NET 4.0 Features
Microsoft UK TechDays - Top 10 ASP.NET 4.0 FeaturesMicrosoft UK TechDays - Top 10 ASP.NET 4.0 Features
Microsoft UK TechDays - Top 10 ASP.NET 4.0 Featuresukdpe
 
Microsoft UK TechDays - ASP.NET 4.0 Overview
Microsoft UK TechDays - ASP.NET 4.0 OverviewMicrosoft UK TechDays - ASP.NET 4.0 Overview
Microsoft UK TechDays - ASP.NET 4.0 Overviewukdpe
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworksukdpe
 
Mike Taulty MIX10 Silverlight 4 Accelerated Fundamentals
Mike Taulty MIX10 Silverlight 4 Accelerated FundamentalsMike Taulty MIX10 Silverlight 4 Accelerated Fundamentals
Mike Taulty MIX10 Silverlight 4 Accelerated Fundamentalsukdpe
 
Mike Taulty TechDays 2010 Silverlight and Windows Phone 7 CTP
Mike Taulty TechDays 2010 Silverlight and Windows Phone 7 CTPMike Taulty TechDays 2010 Silverlight and Windows Phone 7 CTP
Mike Taulty TechDays 2010 Silverlight and Windows Phone 7 CTPukdpe
 
Mike Taulty TechDays 2010 Silverlight 4 - What's New?
Mike Taulty TechDays 2010 Silverlight 4 - What's New?Mike Taulty TechDays 2010 Silverlight 4 - What's New?
Mike Taulty TechDays 2010 Silverlight 4 - What's New?ukdpe
 
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 2
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 2Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 2
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 2ukdpe
 
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1ukdpe
 
Mike Taulty DevDays 2010 Silverlight MEF
Mike Taulty DevDays 2010 Silverlight MEFMike Taulty DevDays 2010 Silverlight MEF
Mike Taulty DevDays 2010 Silverlight MEFukdpe
 
Mike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 NetworkingMike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 Networkingukdpe
 
Mike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and PatternsMike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and Patternsukdpe
 
Explaining The Cloud
Explaining The CloudExplaining The Cloud
Explaining The Cloudukdpe
 
Microsoft In Education - Steve Beswick
Microsoft In Education - Steve BeswickMicrosoft In Education - Steve Beswick
Microsoft In Education - Steve Beswickukdpe
 
How Microsoft Secures its Online Services [WHITEPAPER]
How Microsoft Secures its Online Services [WHITEPAPER]How Microsoft Secures its Online Services [WHITEPAPER]
How Microsoft Secures its Online Services [WHITEPAPER]ukdpe
 
Overview of Microsoft App-V 4.5
Overview of Microsoft App-V 4.5Overview of Microsoft App-V 4.5
Overview of Microsoft App-V 4.5ukdpe
 

More from ukdpe (20)

Mike Ormond: Silverlight for Windows Phone 7 (UK TechDays)
Mike Ormond: Silverlight for Windows Phone 7 (UK TechDays)Mike Ormond: Silverlight for Windows Phone 7 (UK TechDays)
Mike Ormond: Silverlight for Windows Phone 7 (UK TechDays)
 
Windows Phone 7: How (Not) to Fail Marketplace Ingestion
Windows Phone 7: How (Not) to Fail Marketplace IngestionWindows Phone 7: How (Not) to Fail Marketplace Ingestion
Windows Phone 7: How (Not) to Fail Marketplace Ingestion
 
Mike Ormond: Developing for Windows Phone 7
Mike Ormond: Developing for Windows Phone 7Mike Ormond: Developing for Windows Phone 7
Mike Ormond: Developing for Windows Phone 7
 
Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)
 
Microsoft UK TechDays - jQuery and ASP.NET
Microsoft UK TechDays - jQuery and ASP.NETMicrosoft UK TechDays - jQuery and ASP.NET
Microsoft UK TechDays - jQuery and ASP.NET
 
Microsoft UK TechDays - Top 10 ASP.NET 4.0 Features
Microsoft UK TechDays - Top 10 ASP.NET 4.0 FeaturesMicrosoft UK TechDays - Top 10 ASP.NET 4.0 Features
Microsoft UK TechDays - Top 10 ASP.NET 4.0 Features
 
Microsoft UK TechDays - ASP.NET 4.0 Overview
Microsoft UK TechDays - ASP.NET 4.0 OverviewMicrosoft UK TechDays - ASP.NET 4.0 Overview
Microsoft UK TechDays - ASP.NET 4.0 Overview
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
 
Mike Taulty MIX10 Silverlight 4 Accelerated Fundamentals
Mike Taulty MIX10 Silverlight 4 Accelerated FundamentalsMike Taulty MIX10 Silverlight 4 Accelerated Fundamentals
Mike Taulty MIX10 Silverlight 4 Accelerated Fundamentals
 
Mike Taulty TechDays 2010 Silverlight and Windows Phone 7 CTP
Mike Taulty TechDays 2010 Silverlight and Windows Phone 7 CTPMike Taulty TechDays 2010 Silverlight and Windows Phone 7 CTP
Mike Taulty TechDays 2010 Silverlight and Windows Phone 7 CTP
 
Mike Taulty TechDays 2010 Silverlight 4 - What's New?
Mike Taulty TechDays 2010 Silverlight 4 - What's New?Mike Taulty TechDays 2010 Silverlight 4 - What's New?
Mike Taulty TechDays 2010 Silverlight 4 - What's New?
 
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 2
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 2Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 2
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 2
 
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
 
Mike Taulty DevDays 2010 Silverlight MEF
Mike Taulty DevDays 2010 Silverlight MEFMike Taulty DevDays 2010 Silverlight MEF
Mike Taulty DevDays 2010 Silverlight MEF
 
Mike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 NetworkingMike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 Networking
 
Mike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and PatternsMike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and Patterns
 
Explaining The Cloud
Explaining The CloudExplaining The Cloud
Explaining The Cloud
 
Microsoft In Education - Steve Beswick
Microsoft In Education - Steve BeswickMicrosoft In Education - Steve Beswick
Microsoft In Education - Steve Beswick
 
How Microsoft Secures its Online Services [WHITEPAPER]
How Microsoft Secures its Online Services [WHITEPAPER]How Microsoft Secures its Online Services [WHITEPAPER]
How Microsoft Secures its Online Services [WHITEPAPER]
 
Overview of Microsoft App-V 4.5
Overview of Microsoft App-V 4.5Overview of Microsoft App-V 4.5
Overview of Microsoft App-V 4.5
 

Recently uploaded

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
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
 
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
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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...Igalia
 
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 2024The Digital Insurer
 
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
 
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
 
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 WorkerThousandEyes
 
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 MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Recently uploaded (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
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
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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...
 
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
 
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?
 
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
 
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
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Entity Framework V1 and V2

  • 1. Eric Nelson Developer & Platform Group Microsoft Ltd eric.nelson@microsoft.com http://geekswithblogs.net/IUpdateable http://twitter.com/ericnel
  • 2. Microsoft UK MSDN Flash Newsletter Every two weeks, pure joy enters your Inbox  MSDN Flash Podcast Pilot For feedback http://bit.ly/flashpod1 http://msdn.microsoft.com/uk/flash MSDN Flash eBook 13 of the “Best Technical Technical Authors wanted Articles of 2008” for the Flash – 400 to 500 http://bit.ly/flashebook1 words. Fancy it?
  • 3. ORMs Swift look at history and future of ORM on Windows Entity Framework – with demos Entity Data Model Entity Services Object Services Entity Framework v2 – with no demos Overview of POCO, Model First etc
  • 4.
  • 5. Accessing data in 1990 • ODBC, embedded SQL Accessing data in 2000 • ADO, Stored Procedures Accessing data in 2005 • ADO.NET, Datasets, DataReaders Accessing data in 2010 • ORM baby!
  • 6. What is it? an Abstraction technique for working with relational tables as if they were objects in memory Intention is to hide away the complexity of the underlying tables and give a uniform way of working with data Why use it? Developer productivity Retain database independence Note: Using an ORM does not mean you must use the ORM!
  • 7. Many ORMs out there LLBLGen Pro http://www.llblgen.com/ Nhibernate http://www.hibernate.org/343.html EntitySpaces http://www.entityspaces.net/Portal/Default.aspx Open Access http://www.telerik.com/products/orm.aspx DevForce http://www.ideablade.com/ XPO http://www.devexpress.com/Products/NET/ORM/ Lightspeed http://www.mindscape.co.nz/products/LightSpeed/default.aspx Plus many, many more No clear “winner” = relatively little adoption of ORM Developers waiting on Microsoft Of 31 .NET ORMs in 2003, 9 lasted to 2008
  • 8. Typed Datasets (cough) – shipped  ObjectSpaces “v1” – never shipped  ObjectSpaces “v2” – never shipped  Microsoft Business Framework – never shipped  WinFS – never shipped  LINQ to SQL - shipped November 2007  Visual Studio 2008 & .NET Framework 3.5 LINQ to Entities - shipped August 2008  Visual Studio 2008 SP1 & .NET Framework 3.5 SP1 Note: LINQ to Entities is the most visible part of the ADO.NET Entity Framework
  • 9. Entity Framework and LINQ to Entities is our strategic technology Entity Framework v2 in VS2010 and .NET Framework 4.0 Best of LINQ to SQL moves into LINQ to Entities Microsoft is using it Data Services - shipping Reporting Services Microsoft “M” Partners supporting it Database Vendors – IBM,OpenLink, DataDirect, Devart etc ORM vendors supporting it DevForce now target Entity Framework, replacing their own LLBLGen v3 will target Entity Framework as well as their own Devart Entity Developer It is not just about ORM
  • 11. LINQ to SQL LINQ to Entities Database Support SQL Server SQL Server, DB2, Oracle, Sybase, MySQL ... Object Relational Simple Complex Mapping Capabilities Not strategic  Status Strategic Often  Annoying Rarely
  • 12. Entity Framework is not just about ORM Entity Framework v1 is being adopted Typically on applications expected to “live” a long time Entity Framework is only .NET 3.5 SP1 and above Entity Framework is probably not the best choice for a “short lived” SQL Server applications Entity Framework v1 has “warts” Designer It is annoying – buggy, clunky Exposes subset of the functionality Does not support model first N-tier story Stored Procedure Support Foreign Keys PoCo Guids SQL 2008 New Types
  • 13. “EF is still cutting development time “the entity framework in half. Ya gotta can kiss my damn love it.” ass - this shit is ridiculous” http://bit.ly/EFmarmite
  • 14.
  • 15. Tools and services to create an Entity Data Model (EDM) Tools and services for consuming an Entity Data Model
  • 16. Entity Data Model Application model Mapped to a persistence store Conceptual Comprised of three layers: Conceptual (CSDL) Mapping (MSL) Mapping Storage (SSDL) Database agnostic Comprised of: Storage Entities Associations Functions
  • 17. { A look at mapping }
  • 18. 2 1 The ORM - optional Object Services 3 Entity Client
  • 19. Familiar ADO.NET object model: EntityCommand EntityConnection EntityDataReader EntityParameter EntityTransaction Text-based results Read-only Uses Entity SQL
  • 20. Queries materialized as Objects ObjectContext ObjectQuery<T> Built on top of Entity Client Two query options: Entity SQL LINQ Runtime services: Unit of work Identity tracking Eager/explicit loading
  • 22. ORM is an abstraction layer over data • Productivity • Database Independence Microsoft has two ORMs • LINQ to SQL – only SQL Server • Entity Framework (includes LINQ to Entities) – many RDBMS, strategic ADO.NET Entity Framework includes all the other bits  • EDM, Linq to Entities, ESQL, Object Services, Entity Services • Part of .NET Framework 3.5 SP1 Entity Data Model – mapping from conceptual to store • CSDL = Conceptual Schema Definition Language • SSDL = Store Schema Definition Language • MSDL = Mapping Schema Definition Language Two query languages • ESQL = Entity SQL. Read only query language similar to SQL • LINQ to Entities = Language Integrated Query to the EDM
  • 23.
  • 24. For Everyone Pluralization Foreign Keys Stored Procedures Self tracking Entities For the Model Centric Developer Model First Complex Types Model Defined Functions For the Control Freak Code Generation For the Agilist Persistence Ignorance, Lazy Loading, Code Only + “Other stuff” Warning – not final. Expect changes!
  • 25. Pluralization Used in Database First and Model First Implementation Public abstract PluralizationService Default implementation is English Only Default rules: EntityTypes / ComplexTypes are singularized EntitySets are pluralized Navigation Properties based on cardinality
  • 26. Foreign Keys Independent Association – v1 Product p = new Product { ID = 1, Name = quot;Bovrilquot;, Category = context.Categories .Single(c => c.Name == quot;Foodquot;) }; context.SaveChanges(); FK Association – v2 Product p = new Product { ID = 1, Name = quot;Bovrilquot;, CategoryID = 13 }; context.Products.AddObject(p); context.SaveChanges();
  • 27. Stored Procedures Stored Procedures as functions Mapping support for stored procedure result Complex type as return type Scalar and void return type Entity CUD using Stored Procedures No need to have SPs for all CUD
  • 28. Entities do their own change tracking regardless of which tier changes are made on Somewhere between DTOs and DataSets
  • 29. Model First Start with a blank model Add entities/relationships (CSDL) Click “Create Database from Model” Infer Storage Model (SSDL) Infer Mapping (MSL) Infer DDL Deploy DDL Modify and re-apply. Two way. But - deletes your data!!!
  • 30. Complex Types Map a new type to many types Adds designer support
  • 31. 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(quot;MyModelquot;, quot;CustomerFullNamequot;)] public static string FullName(this customer c) { return String.Format(quot;{0} {1}quot;, c.FirstName, c.LastName); } Enables Console.WriteLine(c.FullName());
  • 32. In V1 we had EntityClassGenerator which could be configured using events Hard (it used CodeDom) Inflexible (not much control) In V2 we will have TemplatedEntityClassGenerator and will ship default T4 templates Customization via Tools Uses Workflow Foundation
  • 33. Persistence Ignorance Support for Plain Old CLR Objects No requirement to have specific interface, base class Lazy Loading Can not do order.order_details.Load() But Can do lazy load Context.deferredloading=true
  • 34. Code Only No XML files, no model! Convention to config E.g. Convention: xxxID to a primary key, schema=dbo E.g. Config: On map to schema sys and class property to table column [TableMapping(Schema=“sys”,TableName=“MyDBTable”] [ColumnMapping(PropertyName=“MyClassProp1”, Column Name=“table_column1”)] [Key(PropertyName=“MyClassProp1”)] public objectset<MyThing> MyThings...
  • 35. Improved N-Tier API More LINQ query operators More SQL generation optimizations Inline functions in ESQL Readonly mapping
  • 36. 1990 to • Data Access technology remained reasonably static 2008 - • Procedural, API access • Surfaced the database schema Tables • No clear ORM choice • LINQ – excellent addition to the .NET 2009 – languages • Entity Framework and the EDM – strategic Objects investment • Productivity leap
  • 37. http://blogs.msdn.com/efdesign Entity Framework v2 http://geekswithblogs.net/IUpdateable Slides http://bit.ly/BW1Lq EF Performance
  • 38. © 2008 Microsoft Ltd. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • 39. Driven by Reporting Services team + others Query Tree Writing with no objects... LINQ query without objects... DbExpression expression=ctx.EntitySet(quot;Ordersquot;).Scan().Where(...); DbDataReader reader = ctx.ExecuteQuery(expression); Or from c in ctx.EntitySet(“Orders”).Scan() Select c.Property(“ShipCity”) Readonly mapping <EntityContainerMapping CdmEntityContainer=quot;CContainerquot; StorageEntityContainer=quot;SContainerquot; GenerateUpdateViews=quot;falsequot; >