SlideShare a Scribd company logo
1 of 52
Entity Framework 4.0 Stefano Paluello TTG – Torino Technologies Group stefano.paluello@pastesoft.com (@palutz)
Agenda Data Access in the history EF4 Overview EF Pattern and Developing How to query EF4
It was a long path… Data Access in the history
What is an O/RM? Object Relational Mapping An abstraction, a technique for converting data between incompatible type systems, the RDBMS and OOP (aka impedance mismatch), hiding the complexity of the underlying tables
Impedance.. what?? The object-relational impedance mismatch is a set of conceptual and technical difficulties that are often encountered when a RDBMSis being used by a program written in an OOP language or style; (Wikipedia)
Why use an O/RM? Increase the Developer productivity Better, faster and less code than “average” developer Impedance mismatch Database Portability
O/RM is not… The solution for all our problems The fastest way to do anything A cool new stuff that we must have in our application (it won’t help us to hang out with our new sexy colleague or desk-mate  )
Overview Entity Framework 4.0
The “managed” path to EF Typed Dataset – shipped  ObjectSpaces v1, v2 – never shipped  MS Business Framework – never shipped  WinFS – never shipped  LINQ to SQL – shipped  (.Net 3.5) LINQ to Entities and Entity Framework v.1.0 – shipped  (.Net 3.5 SP1) Entity Framework 4.0 – shipped  (.Net 4.0)
The new kid on the block: Ado.Net Entity Framework EF is the O/RM in the .NET Framework  Microsoft’s strategic technology Used in other Microsoft products: WCF Data services, Azure Table Storage, Sharepoint 2010, SQL Server Reporting Services and PowerPivot for Excel, … Big investment in this release (.Net 4.0) took the best from LINQ to SQL Database and ORM (!!!) vendors supporting it (IBM, OpenLink, DevForce, LLBLGen …)
What about my “old” ADO.Net code? ADO.NET Core provides the most control DataSets aren’t going away ADO.NET Core is the foundation of the Entity Framework Provider layer Incremental evolution for apps from ADO.NET Core to EF
A typical scenario with EF
Linq To SQL vsLinq To Entities
What is Entity Framework? Data access framework Supports data-centric applications and services  Enables programming against a conceptual application model Enables independency of any data storage engine or relational schema
Let’s dig into Entity Framework
EDM – Entity Data Model Invented by Dr. Peter Chen (1970s) and named ERM (Entity Relationship Model) ERM Conceptual Layer Mapping Layer Storage Layer Now: EDM in Entity Framework
Entity Data Model Comprised of three layers (CSDL, MSL, SSDL) Database agnostic Comprised of Entities, Associations, Functions
Entity Data Model in .Net It’s actually an XML file (.edmx)
demo A glimpse to Entity Framework 4
What’s new in EF4 Testibility with IObjectSet<T> Direct execution of Store Commands from ObjectContext Functions in LINQ to Entities queries OrderBy improvement in LINQ to Entities Customized Object-Layer code generation Entity Designer extensibility Entity Data Model Wizard improvement (naming service) … Entity Framework Futures Pluralization Foreign Keys in the Conceptual Model Stored Procedures Self tracking Entities and new methods for N-Tier App. Dev. Model First Complex Types Model Defined Functions Code Generation  Persistence Ignorance Lazy Loading Code Only EntityDataSource support for QueryExtendercontrol
Code Generation (T4) Entity Framework 4 shipped with a number of T4 code-generation templates which you can customize or replace with your own. (T4 is a code-generation technology built into Visual Studio 2008 or later) The whole point of using T4 for code-generation is that it makes easy to customize the generated entities, like when we need to add some particular validation on setting up entity properties.
Entity Designer Improvements Complex Type support 	Create complex types in your Model Foreign Keys Optionally include foreign keys in your model Pluralization Better naming management of the Entity Set
Entity Designer Improvements Model First:  first design then create the DB! Start with an Empty Model and create you concept model (or Domain Model) adding Entities and Associations. Then ask EF4 to create the DB.
demo Model First Demo
EF4 creating models Recap Start with the database … … and then generate the model + code Scenario: DB already exists, or you want low level control over it How to: Import model into edmx and tweak Start with an edmx model … … and then generate the database + code Scenario: You want separation from code and database in a declarative format How to: Create a model in the designer Start with .net classes … … and then generate the database + model Scenario: Primarily focused on code shape, database is an implementation detail How to: Define classes in code and then adjust shape using contextbuilder
EF Model Mapping capabilities Inheritance Table per Hierarchy Table per Type Table per Concrete Type Hybrids Many entities to one table Stored Procedures Many tables to one entity Abstract Entities Associations within EntitySets Associations across EntitySets Store-side discriminators EDM-side discriminators QueryViews, Defining Query, CommandText
EF4 Patterns Ef4 DEVELOPING
EF4 Patterns Repository, Unit of Work, Identity Map POCO (Plain Old CLR Object) and Proxies Lazy/Deferred Loading Foreign Keys Object Set and Testability
Repository Pattern “Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects” Why do I need it? Separation of concerns Greater control  Easier testability Howto: Simple class & interface Just a collection Business logic, UI, etc. Data Access Framework Database
demo Repository Pattern with EF4
Repository Pattern Recap Repositories are easy with EF! Best Practices: Make the repository’s interface as simple as possible Create separate repositories for each “aggregate” Keep other layers “persistence ignorant” Multiple repositories can share same ObjectContext as “unit of work” Popular additions: Query methods return IQueryable<T> (be careful, you could query your entities on the UI with this) Using “specification pattern”, e.g. repository.Find(c=>c.Id == id) Repository<T> base class (don’t repeat yourself)
Unit of Work Pattern “Maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems.”   It means that a Unit of Work is a context/session/unit object that tracks the changes of business entities during one business transaction. public interface IUnitOfWork<T>{     void RegisterNew(T entity);    void RegisterDirty(T entity);    void RegisterClean(T entity);    void RegisterDeleted(T entity);    void Commit(); }
POCO & Persistence Ignorance With EF4 you can now define your own objects that are completely decoupled from persistence concerns. These objects don’t need to be a sub class of EntityObject or to implement a set of IPOCO interfaces (i.e. IEntityWithKey, IEntityWithChangeTrackerand IEntityWithRelationships), like it was with the previous version of EF.
Example of POCOs in EF4 public class Order {    public intOrderID { get; set; }    public Customer Customer { get; set; }    public DateTimeOrderDate { get; set; } } public class Customer {    public string CustomerID { get; set; }    public string ContactName { get; set; }    public string City { get; set; }    public List<Order> Orders { get; set; } }
Adding POCOs to the Context public class MyContext: ObjectContext {      private ObjectSet<Category> _categories;    private ObjectSet<Product> _products;     public MyContext() : base("name=MyEntities",  “MyEntities") {         _categories = CreateObjectSet<Category>();         _products = CreateObjectSet<Product>();     }     public ObjectSet<Category> Categories  {         get { return _categories; }    }     public ObjectSet<Product> Products   {         get { return _products; }     } }
Consume POCOs in my app. … MyContextdb= new MyContext(); var smartphones = from p in db.Products           where p.Category.CategoryName == “Smartphone“            select p; …
Lazy/Deferred Loading Lazy Loading is a ObjectContext setting, not an application setting and it works with code-generated entities as well with POCO entities. It’s turned off by default, but is true on the EDM Context In addition to eager (Include()) and explicit (Load()) loading, related entities can be loaded automatically on demand. How to enable Lazy Loading: context.ContextOptions.DeferredLoadingEnabled=true Declare the property that you would like to load lazily as virtual. These properties can be any collection type that implements ICollection<T> or they can be a reference representing a 1/0..1 relationship.
Object Set and Testability The newObjectSet<T> class derives from ObjectQuery<T> and represents a “root” query object for an EntitySet, that also has AddObject, DeleteObject and Attach methods. In order to improve testability, an IObjectSet<T> interface was defined, that derives from IQueryable<T>. IObjectSet<T> happens to be super easy to implement as an in-memory fake object. Provided that your queries and CUD operations can refer to instances of IObjectSet<T>, your code will now be easier and faster to test.
demo Testability with EF4
Testability with EF4 Recap EF4 has a focus on testability (it’s quite easy) Best practices: Build simple repository interface Swap repository with in-memory test  Alternate route: define simple interface for context Still run tests against database often (integration test – lower but safer)
Querying the Model How to query EF4
Querying the model Three kinds of queries in EF: LINQ to Entities Entity SQL with Object Services Entity SQL with Entity Client
LINQ to Entities Queries written in LINQ sintax Support for LINQ features Full IntelliSense support varperson = from people in context.Anagraficas               where people.Name.StartsWith(“S") orderbypeople.Ageascending               select new { Name = people.Name, Surname = people.Surname               };
Entity SQL ObjectServices T-SQL-like query language Can query the EDM EF translates Entity SQL into storage-specific queries varqueryStr = @”SELECT NAME n 	FROM context.Anagraficas as anag 	WHERE anag.Name=‘Stefano’”; var person = context.CreateQuery<Anagrafica>(queryStr);
Entity Client ADO.Net “old”-style queries Prime choice for developers migrating from Ado.Net using (EntityConnection conn = new EntityConnection(“…”) { conn.Open();     using (EntityCommandcmd = conn.CreateCommand()) { cmd.CommandText= “SELECT * FROM Context.Anagraficas”;        using (EntityDataReaderrdr= cmd.ExecuteReader( 	CommandBehavior.SequentialAccess)) {            while (rdr.Read()) {…}         }     } }
Entity Client (2) Familiar ADO.NET object model: EntityCommand EntityConnection EntityDataReader EntityParameter EntityTransaction Text-based results, we need EntityDataReader to read Read-only access to EDM. To modify data we need ObjectServices with Entity SQL
Querying the model Recap
What can I use to access data? Data Access Recap
Native Data Access Guidance For new native applications wanting a generalized abstraction layer with support for multiple data sources, use ODBC. This is the most efficient, full-featured API in which Microsoft will continue to invest. For specialized, high-performance data access to SQL Server, use SQL Server Native Client (C/C++), the JDBC driver (Java/JavaScript), or the PHP driver depending on your language of choice. If you’re invested in VBA and ASP classic, continue to use ADO. ADO will continue to be supported (including security fixes) but won’t see new feature work. If you really want COM-based data access, use OLEDB. This will also continue to be supported but won’t have new feature work.
.NET Data Access Guidance New applications should start by looking at the ADO.NET EF4(including LINQ to Entities) for data access. Scenarios for which ADO.NET DataSets have been used are generally handled well with the Entity Framework also. The EF can be incrementally adopted in applications using ADO.NET Core. For example, much of the connect/query/process code of ADO.NET Core can be easily replaced with very simple, entry-level usage of EF.  Use ADO.NET Core when you want the lowest level of control. ADO.NET Core remains the basis for data access in .NET. Provides the most common and familiar development patterns for data access (connect, query, process) DataSets and LINQ to DataSet will continue to be supported. For simple applications where you don’t need more than simple connections and streaming results, ADO.NET may be a good choice to get a job done quickly. If you have requirements for fine-grained control, ADO.NET might give you more capabilities than the Entity Framework.· LINQ to SQL is and will continue to be supported but will see little new investment.
© 2009 Microsoft Corporation. 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.

More Related Content

What's hot

Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code firstConfiz
 
Entity Framework
Entity FrameworkEntity Framework
Entity Frameworkvrluckyin
 
Entity framework
Entity frameworkEntity framework
Entity frameworkicubesystem
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework OverviewEyal Vardi
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity FrameworkDoncho Minkov
 
Back-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real WorldBack-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real WorldDavid McCarter
 
Building nTier Applications with Entity Framework Services (Part 2)
Building nTier Applications with Entity Framework Services (Part 2)Building nTier Applications with Entity Framework Services (Part 2)
Building nTier Applications with Entity Framework Services (Part 2)David McCarter
 
Entity Framework v2 Best Practices
Entity Framework v2 Best PracticesEntity Framework v2 Best Practices
Entity Framework v2 Best PracticesAndri Yadi
 
Lerman Vvs14 Ef Tips And Tricks
Lerman Vvs14  Ef Tips And TricksLerman Vvs14  Ef Tips And Tricks
Lerman Vvs14 Ef Tips And TricksJulie Lerman
 
LINQ to Relational in Visual Studio 2008 SP1
LINQ to Relational in Visual Studio 2008 SP1LINQ to Relational in Visual Studio 2008 SP1
LINQ to Relational in Visual Studio 2008 SP1ukdpe
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Frameworkukdpe
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer ReferenceMuthuselvam RS
 
Apache Olingo - ApacheCon Denver 2014
Apache Olingo - ApacheCon Denver 2014Apache Olingo - ApacheCon Denver 2014
Apache Olingo - ApacheCon Denver 2014Stephan Klevenz
 
OData and SharePoint
OData and SharePointOData and SharePoint
OData and SharePointSanjay Patel
 
C# advanced topics and future - C#5
C# advanced topics and future - C#5C# advanced topics and future - C#5
C# advanced topics and future - C#5Peter Gfader
 
Dao pattern
Dao patternDao pattern
Dao patternciriako
 
Microsoft Entity Framework
Microsoft Entity FrameworkMicrosoft Entity Framework
Microsoft Entity FrameworkMahmoud Tolba
 
OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)Apigee | Google Cloud
 

What's hot (20)

Ef code first
Ef code firstEf code first
Ef code first
 
Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code first
 
Entity Framework
Entity FrameworkEntity Framework
Entity Framework
 
Entity framework
Entity frameworkEntity framework
Entity framework
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overview
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Framework
 
Back-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real WorldBack-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real World
 
Building nTier Applications with Entity Framework Services (Part 2)
Building nTier Applications with Entity Framework Services (Part 2)Building nTier Applications with Entity Framework Services (Part 2)
Building nTier Applications with Entity Framework Services (Part 2)
 
Entity Framework v2 Best Practices
Entity Framework v2 Best PracticesEntity Framework v2 Best Practices
Entity Framework v2 Best Practices
 
Lerman Vvs14 Ef Tips And Tricks
Lerman Vvs14  Ef Tips And TricksLerman Vvs14  Ef Tips And Tricks
Lerman Vvs14 Ef Tips And Tricks
 
LINQ to Relational in Visual Studio 2008 SP1
LINQ to Relational in Visual Studio 2008 SP1LINQ to Relational in Visual Studio 2008 SP1
LINQ to Relational in Visual Studio 2008 SP1
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Framework
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer Reference
 
Apache Olingo - ApacheCon Denver 2014
Apache Olingo - ApacheCon Denver 2014Apache Olingo - ApacheCon Denver 2014
Apache Olingo - ApacheCon Denver 2014
 
OData and SharePoint
OData and SharePointOData and SharePoint
OData and SharePoint
 
C# advanced topics and future - C#5
C# advanced topics and future - C#5C# advanced topics and future - C#5
C# advanced topics and future - C#5
 
Dao pattern
Dao patternDao pattern
Dao pattern
 
Microsoft Entity Framework
Microsoft Entity FrameworkMicrosoft Entity Framework
Microsoft Entity Framework
 
OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)
 
Data access
Data accessData access
Data access
 

Viewers also liked

TDD with Visual Studio 2010
TDD with Visual Studio 2010TDD with Visual Studio 2010
TDD with Visual Studio 2010Stefano Paluello
 
Real scenario: moving a legacy app to the Cloud
Real scenario: moving a legacy app to the CloudReal scenario: moving a legacy app to the Cloud
Real scenario: moving a legacy app to the CloudStefano Paluello
 
Entity Framework 4.0 vs NHibernate
Entity Framework 4.0 vs NHibernateEntity Framework 4.0 vs NHibernate
Entity Framework 4.0 vs NHibernateManuel Scapolan
 
Design Pattern Architetturali - Dependency Injection
Design Pattern Architetturali - Dependency InjectionDesign Pattern Architetturali - Dependency Injection
Design Pattern Architetturali - Dependency InjectionRiccardo Cardin
 
SOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignSOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignRiccardo Cardin
 

Viewers also liked (9)

Windows Azure Overview
Windows Azure OverviewWindows Azure Overview
Windows Azure Overview
 
TDD with Visual Studio 2010
TDD with Visual Studio 2010TDD with Visual Studio 2010
TDD with Visual Studio 2010
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
Real scenario: moving a legacy app to the Cloud
Real scenario: moving a legacy app to the CloudReal scenario: moving a legacy app to the Cloud
Real scenario: moving a legacy app to the Cloud
 
ORM - Introduzione
ORM - IntroduzioneORM - Introduzione
ORM - Introduzione
 
Entity Framework 4.0 vs NHibernate
Entity Framework 4.0 vs NHibernateEntity Framework 4.0 vs NHibernate
Entity Framework 4.0 vs NHibernate
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Design Pattern Architetturali - Dependency Injection
Design Pattern Architetturali - Dependency InjectionDesign Pattern Architetturali - Dependency Injection
Design Pattern Architetturali - Dependency Injection
 
SOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignSOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented Design
 

Similar to Entity Framework 4

Ef Poco And Unit Testing
Ef Poco And Unit TestingEf Poco And Unit Testing
Ef Poco And Unit TestingJames Phillips
 
Poco Es Mucho: WCF, EF, and Class Design
Poco Es Mucho: WCF, EF, and Class DesignPoco Es Mucho: WCF, EF, and Class Design
Poco Es Mucho: WCF, EF, and Class DesignJames Phillips
 
MVC and Entity Framework
MVC and Entity FrameworkMVC and Entity Framework
MVC and Entity FrameworkJames Johnson
 
MVC and Entity Framework 4
MVC and Entity Framework 4MVC and Entity Framework 4
MVC and Entity Framework 4James Johnson
 
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
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Bill Buchan
 
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
 
.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13aminmesbahi
 
Overview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaOverview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaJignesh Aakoliya
 
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 N Tier Applications With Entity Framework Services 2010
Building N Tier Applications With Entity Framework Services 2010Building N Tier Applications With Entity Framework Services 2010
Building N Tier Applications With Entity Framework Services 2010David McCarter
 
What's New for Data?
What's New for Data?What's New for Data?
What's New for Data?ukdpe
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxdanhaley45372
 
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkEclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkDave Steinberg
 
Entity framework 4.0
Entity framework 4.0Entity framework 4.0
Entity framework 4.0Abhishek Sur
 
Entity Framework Today (May 2012)
Entity Framework Today (May 2012)Entity Framework Today (May 2012)
Entity Framework Today (May 2012)Julie Lerman
 

Similar to Entity Framework 4 (20)

Ef Poco And Unit Testing
Ef Poco And Unit TestingEf Poco And Unit Testing
Ef Poco And Unit Testing
 
Entity Framework 4
Entity Framework 4Entity Framework 4
Entity Framework 4
 
Poco Es Mucho: WCF, EF, and Class Design
Poco Es Mucho: WCF, EF, and Class DesignPoco Es Mucho: WCF, EF, and Class Design
Poco Es Mucho: WCF, EF, and Class Design
 
MVC and Entity Framework
MVC and Entity FrameworkMVC and Entity Framework
MVC and Entity Framework
 
MVC and Entity Framework 4
MVC and Entity Framework 4MVC and Entity Framework 4
MVC and Entity Framework 4
 
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
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
 
Entity framework
Entity frameworkEntity framework
Entity framework
 
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)
 
.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13
 
Overview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaOverview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company india
 
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 N Tier Applications With Entity Framework Services 2010
Building N Tier Applications With Entity Framework Services 2010Building N Tier Applications With Entity Framework Services 2010
Building N Tier Applications With Entity Framework Services 2010
 
70487.pdf
70487.pdf70487.pdf
70487.pdf
 
What's New for Data?
What's New for Data?What's New for Data?
What's New for Data?
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
 
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkEclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
 
Entity framework 4.0
Entity framework 4.0Entity framework 4.0
Entity framework 4.0
 
Entity Framework Today (May 2012)
Entity Framework Today (May 2012)Entity Framework Today (May 2012)
Entity Framework Today (May 2012)
 
Entity Framework
Entity FrameworkEntity Framework
Entity Framework
 

More from Stefano Paluello

A gentle introduction to the world of BigData and Hadoop
A gentle introduction to the world of BigData and HadoopA gentle introduction to the world of BigData and Hadoop
A gentle introduction to the world of BigData and HadoopStefano Paluello
 
Using MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkUsing MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkStefano Paluello
 
Teamwork and agile methodologies
Teamwork and agile methodologiesTeamwork and agile methodologies
Teamwork and agile methodologiesStefano Paluello
 

More from Stefano Paluello (6)

Clinical Data and AI
Clinical Data and AIClinical Data and AI
Clinical Data and AI
 
A gentle introduction to the world of BigData and Hadoop
A gentle introduction to the world of BigData and HadoopA gentle introduction to the world of BigData and Hadoop
A gentle introduction to the world of BigData and Hadoop
 
Grandata
GrandataGrandata
Grandata
 
How to use asana
How to use asanaHow to use asana
How to use asana
 
Using MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkUsing MongoDB with the .Net Framework
Using MongoDB with the .Net Framework
 
Teamwork and agile methodologies
Teamwork and agile methodologiesTeamwork and agile methodologies
Teamwork and agile methodologies
 

Recently uploaded

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 

Recently uploaded (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 

Entity Framework 4

  • 1. Entity Framework 4.0 Stefano Paluello TTG – Torino Technologies Group stefano.paluello@pastesoft.com (@palutz)
  • 2. Agenda Data Access in the history EF4 Overview EF Pattern and Developing How to query EF4
  • 3. It was a long path… Data Access in the history
  • 4.
  • 5. What is an O/RM? Object Relational Mapping An abstraction, a technique for converting data between incompatible type systems, the RDBMS and OOP (aka impedance mismatch), hiding the complexity of the underlying tables
  • 6. Impedance.. what?? The object-relational impedance mismatch is a set of conceptual and technical difficulties that are often encountered when a RDBMSis being used by a program written in an OOP language or style; (Wikipedia)
  • 7. Why use an O/RM? Increase the Developer productivity Better, faster and less code than “average” developer Impedance mismatch Database Portability
  • 8. O/RM is not… The solution for all our problems The fastest way to do anything A cool new stuff that we must have in our application (it won’t help us to hang out with our new sexy colleague or desk-mate  )
  • 10. The “managed” path to EF Typed Dataset – shipped  ObjectSpaces v1, v2 – never shipped  MS Business Framework – never shipped  WinFS – never shipped  LINQ to SQL – shipped  (.Net 3.5) LINQ to Entities and Entity Framework v.1.0 – shipped  (.Net 3.5 SP1) Entity Framework 4.0 – shipped  (.Net 4.0)
  • 11. The new kid on the block: Ado.Net Entity Framework EF is the O/RM in the .NET Framework Microsoft’s strategic technology Used in other Microsoft products: WCF Data services, Azure Table Storage, Sharepoint 2010, SQL Server Reporting Services and PowerPivot for Excel, … Big investment in this release (.Net 4.0) took the best from LINQ to SQL Database and ORM (!!!) vendors supporting it (IBM, OpenLink, DevForce, LLBLGen …)
  • 12. What about my “old” ADO.Net code? ADO.NET Core provides the most control DataSets aren’t going away ADO.NET Core is the foundation of the Entity Framework Provider layer Incremental evolution for apps from ADO.NET Core to EF
  • 14. Linq To SQL vsLinq To Entities
  • 15. What is Entity Framework? Data access framework Supports data-centric applications and services Enables programming against a conceptual application model Enables independency of any data storage engine or relational schema
  • 16. Let’s dig into Entity Framework
  • 17. EDM – Entity Data Model Invented by Dr. Peter Chen (1970s) and named ERM (Entity Relationship Model) ERM Conceptual Layer Mapping Layer Storage Layer Now: EDM in Entity Framework
  • 18. Entity Data Model Comprised of three layers (CSDL, MSL, SSDL) Database agnostic Comprised of Entities, Associations, Functions
  • 19. Entity Data Model in .Net It’s actually an XML file (.edmx)
  • 20. demo A glimpse to Entity Framework 4
  • 21. What’s new in EF4 Testibility with IObjectSet<T> Direct execution of Store Commands from ObjectContext Functions in LINQ to Entities queries OrderBy improvement in LINQ to Entities Customized Object-Layer code generation Entity Designer extensibility Entity Data Model Wizard improvement (naming service) … Entity Framework Futures Pluralization Foreign Keys in the Conceptual Model Stored Procedures Self tracking Entities and new methods for N-Tier App. Dev. Model First Complex Types Model Defined Functions Code Generation Persistence Ignorance Lazy Loading Code Only EntityDataSource support for QueryExtendercontrol
  • 22. Code Generation (T4) Entity Framework 4 shipped with a number of T4 code-generation templates which you can customize or replace with your own. (T4 is a code-generation technology built into Visual Studio 2008 or later) The whole point of using T4 for code-generation is that it makes easy to customize the generated entities, like when we need to add some particular validation on setting up entity properties.
  • 23. Entity Designer Improvements Complex Type support Create complex types in your Model Foreign Keys Optionally include foreign keys in your model Pluralization Better naming management of the Entity Set
  • 24. Entity Designer Improvements Model First: first design then create the DB! Start with an Empty Model and create you concept model (or Domain Model) adding Entities and Associations. Then ask EF4 to create the DB.
  • 26. EF4 creating models Recap Start with the database … … and then generate the model + code Scenario: DB already exists, or you want low level control over it How to: Import model into edmx and tweak Start with an edmx model … … and then generate the database + code Scenario: You want separation from code and database in a declarative format How to: Create a model in the designer Start with .net classes … … and then generate the database + model Scenario: Primarily focused on code shape, database is an implementation detail How to: Define classes in code and then adjust shape using contextbuilder
  • 27. EF Model Mapping capabilities Inheritance Table per Hierarchy Table per Type Table per Concrete Type Hybrids Many entities to one table Stored Procedures Many tables to one entity Abstract Entities Associations within EntitySets Associations across EntitySets Store-side discriminators EDM-side discriminators QueryViews, Defining Query, CommandText
  • 28. EF4 Patterns Ef4 DEVELOPING
  • 29. EF4 Patterns Repository, Unit of Work, Identity Map POCO (Plain Old CLR Object) and Proxies Lazy/Deferred Loading Foreign Keys Object Set and Testability
  • 30. Repository Pattern “Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects” Why do I need it? Separation of concerns Greater control Easier testability Howto: Simple class & interface Just a collection Business logic, UI, etc. Data Access Framework Database
  • 32. Repository Pattern Recap Repositories are easy with EF! Best Practices: Make the repository’s interface as simple as possible Create separate repositories for each “aggregate” Keep other layers “persistence ignorant” Multiple repositories can share same ObjectContext as “unit of work” Popular additions: Query methods return IQueryable<T> (be careful, you could query your entities on the UI with this) Using “specification pattern”, e.g. repository.Find(c=>c.Id == id) Repository<T> base class (don’t repeat yourself)
  • 33. Unit of Work Pattern “Maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems.” It means that a Unit of Work is a context/session/unit object that tracks the changes of business entities during one business transaction. public interface IUnitOfWork<T>{ void RegisterNew(T entity); void RegisterDirty(T entity); void RegisterClean(T entity); void RegisterDeleted(T entity); void Commit(); }
  • 34. POCO & Persistence Ignorance With EF4 you can now define your own objects that are completely decoupled from persistence concerns. These objects don’t need to be a sub class of EntityObject or to implement a set of IPOCO interfaces (i.e. IEntityWithKey, IEntityWithChangeTrackerand IEntityWithRelationships), like it was with the previous version of EF.
  • 35. Example of POCOs in EF4 public class Order { public intOrderID { get; set; } public Customer Customer { get; set; } public DateTimeOrderDate { get; set; } } public class Customer { public string CustomerID { get; set; } public string ContactName { get; set; } public string City { get; set; } public List<Order> Orders { get; set; } }
  • 36. Adding POCOs to the Context public class MyContext: ObjectContext { private ObjectSet<Category> _categories; private ObjectSet<Product> _products; public MyContext() : base("name=MyEntities", “MyEntities") { _categories = CreateObjectSet<Category>(); _products = CreateObjectSet<Product>(); } public ObjectSet<Category> Categories { get { return _categories; } } public ObjectSet<Product> Products { get { return _products; } } }
  • 37. Consume POCOs in my app. … MyContextdb= new MyContext(); var smartphones = from p in db.Products where p.Category.CategoryName == “Smartphone“ select p; …
  • 38. Lazy/Deferred Loading Lazy Loading is a ObjectContext setting, not an application setting and it works with code-generated entities as well with POCO entities. It’s turned off by default, but is true on the EDM Context In addition to eager (Include()) and explicit (Load()) loading, related entities can be loaded automatically on demand. How to enable Lazy Loading: context.ContextOptions.DeferredLoadingEnabled=true Declare the property that you would like to load lazily as virtual. These properties can be any collection type that implements ICollection<T> or they can be a reference representing a 1/0..1 relationship.
  • 39. Object Set and Testability The newObjectSet<T> class derives from ObjectQuery<T> and represents a “root” query object for an EntitySet, that also has AddObject, DeleteObject and Attach methods. In order to improve testability, an IObjectSet<T> interface was defined, that derives from IQueryable<T>. IObjectSet<T> happens to be super easy to implement as an in-memory fake object. Provided that your queries and CUD operations can refer to instances of IObjectSet<T>, your code will now be easier and faster to test.
  • 41. Testability with EF4 Recap EF4 has a focus on testability (it’s quite easy) Best practices: Build simple repository interface Swap repository with in-memory test Alternate route: define simple interface for context Still run tests against database often (integration test – lower but safer)
  • 42. Querying the Model How to query EF4
  • 43. Querying the model Three kinds of queries in EF: LINQ to Entities Entity SQL with Object Services Entity SQL with Entity Client
  • 44. LINQ to Entities Queries written in LINQ sintax Support for LINQ features Full IntelliSense support varperson = from people in context.Anagraficas where people.Name.StartsWith(“S") orderbypeople.Ageascending select new { Name = people.Name, Surname = people.Surname };
  • 45. Entity SQL ObjectServices T-SQL-like query language Can query the EDM EF translates Entity SQL into storage-specific queries varqueryStr = @”SELECT NAME n FROM context.Anagraficas as anag WHERE anag.Name=‘Stefano’”; var person = context.CreateQuery<Anagrafica>(queryStr);
  • 46. Entity Client ADO.Net “old”-style queries Prime choice for developers migrating from Ado.Net using (EntityConnection conn = new EntityConnection(“…”) { conn.Open(); using (EntityCommandcmd = conn.CreateCommand()) { cmd.CommandText= “SELECT * FROM Context.Anagraficas”; using (EntityDataReaderrdr= cmd.ExecuteReader( CommandBehavior.SequentialAccess)) { while (rdr.Read()) {…} } } }
  • 47. Entity Client (2) Familiar ADO.NET object model: EntityCommand EntityConnection EntityDataReader EntityParameter EntityTransaction Text-based results, we need EntityDataReader to read Read-only access to EDM. To modify data we need ObjectServices with Entity SQL
  • 49. What can I use to access data? Data Access Recap
  • 50. Native Data Access Guidance For new native applications wanting a generalized abstraction layer with support for multiple data sources, use ODBC. This is the most efficient, full-featured API in which Microsoft will continue to invest. For specialized, high-performance data access to SQL Server, use SQL Server Native Client (C/C++), the JDBC driver (Java/JavaScript), or the PHP driver depending on your language of choice. If you’re invested in VBA and ASP classic, continue to use ADO. ADO will continue to be supported (including security fixes) but won’t see new feature work. If you really want COM-based data access, use OLEDB. This will also continue to be supported but won’t have new feature work.
  • 51. .NET Data Access Guidance New applications should start by looking at the ADO.NET EF4(including LINQ to Entities) for data access. Scenarios for which ADO.NET DataSets have been used are generally handled well with the Entity Framework also. The EF can be incrementally adopted in applications using ADO.NET Core. For example, much of the connect/query/process code of ADO.NET Core can be easily replaced with very simple, entry-level usage of EF. Use ADO.NET Core when you want the lowest level of control. ADO.NET Core remains the basis for data access in .NET. Provides the most common and familiar development patterns for data access (connect, query, process) DataSets and LINQ to DataSet will continue to be supported. For simple applications where you don’t need more than simple connections and streaming results, ADO.NET may be a good choice to get a job done quickly. If you have requirements for fine-grained control, ADO.NET might give you more capabilities than the Entity Framework.· LINQ to SQL is and will continue to be supported but will see little new investment.
  • 52. © 2009 Microsoft Corporation. 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.