Entity Framework 4 In Microsoft Visual Studio 2010 - ericnel
Upcoming SlideShare
Loading in...5
×
 

Entity Framework 4 In Microsoft Visual Studio 2010 - ericnel

on

  • 9,481 views

Session on Entity Framework 4 in Visual Studio 2010 delivered at www.dotnetdevnet.com in Bristol on 3rd Dec.

Session on Entity Framework 4 in Visual Studio 2010 delivered at www.dotnetdevnet.com in Bristol on 3rd Dec.

Statistics

Views

Total Views
9,481
Views on SlideShare
9,265
Embed Views
216

Actions

Likes
2
Downloads
106
Comments
0

3 Embeds 216

http://blogs.msdn.com 112
http://www.slideshare.net 67
http://geekswithblogs.net 37

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • 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
  • 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
  • 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 customer.FirstName + ‘ ‘ + customer.LastName 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;
  • 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 MyThings...

Entity Framework 4 In Microsoft Visual Studio 2010 - ericnel Entity Framework 4 In Microsoft Visual Studio 2010 - ericnel Presentation Transcript

  • ADO.NET Entity Framework in Microsoft Visual Studio 2010 and Microsoft .NET Framework 4
    Eric Nelson
    eric.nelson@microsoft.com
    http://geekswithblogs.net/iupdateable
    (or http://bit.ly/ericnelson )
    http://twitter.com/ericnel
    http://twitter.com/ukmsdn
    Developer Evangelist
    Microsoft UK
  • Were you on twitter last Dec?http://twitter.com/ericnel
  • Agenda
    Quick recap of the journey so far
    Entity Framework 4.0 Drill Down
    Lots of demos
  • Object Relational Mapping
    Many ORMs out there
    No clear “winner” = relatively little adoption of ORM
    Developers waiting on Microsoft
    Then we shipped two ... hmmm
    LINQ to SQL in Visual Studio 2008
    ADO.NET Entity Framework in Visual Studio 2008 SP1
  • ADO.NET Entity Framework Recap
    Entity Data Model
    Tools and services to create an Entity Data Model (EDM)
    Conceptual to Mapping to Storage
    Tools and services for consuming an Entity Data Model
    LINQ to Entities, Object Services and Entity SQL
    Together they address the “impedance mismatch”
    Objects in
    Applications
    Conceptual
    Mapping
    Storage
    Rows in
    Tables
  • Entity Framework 1.0Too many pain points
    The designer!
    Model First not supported
    Poor support for Stored Procedures
    No Pluralization/Singularization
    Foreign Keys hidden
    Lazy Loading not supported
    Missing LINQ Operators vs LINQ to SQL
    Generated SQL unreadable
    No support for Plain Old CLR Objects
    N-Tier difficult
  • Entity Framework 4.0Removing the friction
    Better Tools and Design Experience
    More powerful/flexible runtime
    And
    Persistence Ignorance*
    Code Only*
    N-Tier*
    Note:
    * Delivered in .NET Framework 4 and a separate download
  • Better Tools and Design Experience
    Model First
    Templated code generation
    Stored Procedures
    Pluralization/Singularization
    Complex Types
    Better delete and search
  • Model First and Templated Code Generation
    demo
  • More powerful/flexible runtime
    Lazy Loading (Deferred Loading in Beta 1 )
    Foreign Keys surfaced
    More complete LINQ implementation
    ExecuteStoreQuery
    EntityFunctions and SqlFunctions
    Improvements to generated SQL
  • Deferred Loading, Functions, Generated SQL
    demo
  • http://blogs.msdn.com/adonet/archive/2009/08/05/improvements-to-the-generated-sql-in-net-4-0-beta1.aspx
  • Persistence Ignorance
    First class support for Persistence Ignorance
    No modifications to your classes!
  • Persistence Ignorance
    demo
  • Code Only
    Create the database from the classes
    No model
    Convention to config
  • Code Only
    demo
  • N-Tier
    Self Tracking Entities
  • N-Tier
    demo
  • Entity Framework
    The designer!
    No support for Plain Old CLR Objects
    No Pluralization/Singularization
    Foreign Keys hidden
    Model First not supported
    Lazy Loading not supported
    Missing LINQ Operators vs LINQ to SQL
    Generated SQL unreadable
    N-Tier difficult
    Poor support for Stored Procedures
  • Summary
    Entity Framework 4.0 is rather nice!
    We continue to listen and improve
    Resources
    Install VS2010 Beta 2 http://bit.ly/vs2010b2
    My blog for EF 4 posts http://bit.ly/ericnelson
    Channel 9 Screencasts on EF4 http://bit.ly/ch9ukdevteam
    Entity Framework 4.0 Resources http://bit.ly/ef4resources
    Entity Framework Team Blog http://blogs.msdn.com/adonet/
    Entity Framework Design Blog http://blogs.msdn.com/efdesign/