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

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Entity Framework 4 In Microsoft Visual Studio 2010 - ericnel

5,973

Published on

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.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,973
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
108
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • 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<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("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<MyThing> MyThings...
  • Transcript

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

    ×