• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Introducing the Entity Framework
 

Introducing the Entity Framework

on

  • 846 views

Learn about how object-relational mapping works to provide data access and understand what the Entity Framework is and how it can provide robust data access services to applications.

Learn about how object-relational mapping works to provide data access and understand what the Entity Framework is and how it can provide robust data access services to applications.

Statistics

Views

Total Views
846
Views on SlideShare
844
Embed Views
2

Actions

Likes
1
Downloads
0
Comments
0

1 Embed 2

http://darya-ld1.linkedin.biz 2

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • DEMO: Building the Entity Data Model and Objects, Exploring the New Entity Object Project\n
  • DEMO: Building the Entity Data Model and Objects, Exploring the New Entity Object Project\n
  • DEMO: Building the Entity Data Model and Objects, Exploring the New Entity Object Project\n
  • DEMO: Building the Entity Data Model and Objects, Exploring the New Entity Object Project\n
  • DEMO: Building the Entity Data Model and Objects, Exploring the New Entity Object Project\n
  • DEMO: Building the Entity Data Model and Objects, Exploring the New Entity Object Project\n
  • DEMO: Building the Entity Data Model and Objects, Exploring the New Entity Object Project\n
  • DEMO: Building the Entity Data Model and Objects, Exploring the New Entity Object Project\n
  • DEMO: Try It Out!\n
  • DEMO: Try It Out!\n
  • DEMO: Try It Out!\n
  • DEMO: Try It Out!\n
  • DEMO: Try It Out!\n
  • DEMO: Try It Out!\n
  • DEMO: Try It Out!\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • DEMO: rest of section\n

Introducing the Entity Framework Introducing the Entity Framework Presentation Transcript

  • Introducing the EntityFramework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Objectives Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Objectives• Learn about how object-relational mapping works to provide data access Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Objectives• Learn about how object-relational mapping works to provide data access• Understand what the Entity Framework is and how it can provide robust data access services to applications Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Objectives• Learn about how object-relational mapping works to provide data access• Understand what the Entity Framework is and how it can provide robust data access services to applications• See how to build a database-first Entity Data Model using Visual Studio Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Objectives• Learn about how object-relational mapping works to provide data access• Understand what the Entity Framework is and how it can provide robust data access services to applications• See how to build a database-first Entity Data Model using Visual Studio• Explore the various Entity Framework APIs and tools Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model• Building a Simple Application using Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model• Building a Simple Application using Entity Framework• Entity Framework APIs and Tools Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM) Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Just about all applications make use of data Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Just about all applications make use of data• Microsoft has a long history of providing data access technologies Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Just about all applications make use of data• Microsoft has a long history of providing data access technologies• But they have problems Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Just about all applications make use of data• Microsoft has a long history of providing data access technologies• But they have problems  Too close to the metal Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Just about all applications make use of data• Microsoft has a long history of providing data access technologies• But they have problems  Too close to the metal  Use generic data objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Just about all applications make use of data• Microsoft has a long history of providing data access technologies• But they have problems  Too close to the metal  Use generic data objects• Data access code is usually a lot of code Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Just about all applications make use of data• Microsoft has a long history of providing data access technologies• But they have problems  Too close to the metal  Use generic data objects• Data access code is usually a lot of code• Differences between objects and database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Just about all applications make use of data• Microsoft has a long history of providing data access technologies• But they have problems  Too close to the metal  Use generic data objects• Data access code is usually a lot of code• Differences between objects and database• Entity Framework bridges the gap Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Just about all applications make use of data• Microsoft has a long history of providing data access technologies• But they have problems  Too close to the metal  Use generic data objects• Data access code is usually a lot of code• Differences between objects and database• Entity Framework bridges the gap• Terminology: data store and database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object/Relational Differences Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object/Relational Differences• Inherent problems application has to overcome Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object/Relational Differences• Inherent problems application has to overcome  Needs lots of code somewhere Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object/Relational Differences• Inherent problems application has to overcome  Needs lots of code somewhere  Big impact on application design, effort, and performance Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object/Relational Differences• Inherent problems application has to overcome  Needs lots of code somewhere  Big impact on application design, effort, and performance• Will discuss in the context of a relational database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Type Differences Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Type Differences• Many kinds of data types Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Type Differences• Many kinds of data types• SQL Server 2008 R2 data types: Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Type Differences• Many kinds of data types• SQL Server 2008 R2 data types: bigint binary bit char CLR date datetime datetime2 datetimeoffset decimal float hierarchyid image int money nchar ntext numeric nvarchar real rowversion smalldatetime smallint smallmoney sql_variant table text time timestamp tinyint varbinary varchar uniqueidentifier Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Type Differences• Many kinds of data types• SQL Server 2008 R2 data types: bigint binary bit char CLR date datetime datetime2 datetimeoffset decimal float hierarchyid image int money nchar ntext numeric nvarchar real rowversion smalldatetime smallint smallmoney sql_variant table text time timestamp tinyint varbinary varchar uniqueidentifier Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Type Differences• Many kinds of data types• SQL Server 2008 R2 data types: bigint binary bit char CLR date datetime datetime2 datetimeoffset decimal float hierarchyid image int money nchar ntext numeric nvarchar real rowversion smalldatetime smallint smallmoney sql_variant table text time timestamp tinyint varbinary varchar uniqueidentifier Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Type Differences• Many kinds of data types• SQL Server 2008 R2 data types: bigint binary bit char CLR date datetime datetime2 datetimeoffset decimal float hierarchyid image int money nchar ntext numeric nvarchar real rowversion smalldatetime smallint smallmoney sql_variant table text time timestamp tinyint varbinary varchar uniqueidentifier Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Type Differences• Many kinds of data types• SQL Server 2008 R2 data types: bigint binary bit char CLR date datetime datetime2 datetimeoffset decimal float hierarchyid image int money nchar ntext numeric nvarchar real rowversion smalldatetime smallint smallmoney sql_variant table text time timestamp tinyint varbinary varchar uniqueidentifier• Some have direct equivalents in .NET• Database types often have constraints• Binary data in the database can be anything• Dates and times are another issue Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference• Databases use foreign key constraints Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference• Databases use foreign key constraints• .NET objects use object references Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference• Databases use foreign key constraints• .NET objects use object references• SalesOrderHeader and SalesOrderDetail tables Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference• Databases use foreign key constraints• .NET objects use object references• SalesOrderHeader and SalesOrderDetail tables Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference• Databases use foreign key constraints• .NET objects use object references• SalesOrderHeader and SalesOrderDetail tables Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference• Many-to-Many relationships Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference• Many-to-Many relationships• In AdventureWorks, customers and addresses Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference• Many-to-Many relationships• In AdventureWorks, customers and addresses Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference• Many-to-Many relationships• In AdventureWorks, customers and addresses Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference• Many-to-Many relationships• In AdventureWorks, customers and addresses Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Relationship Difference• Many-to-Many relationships• In AdventureWorks, customers and addresses• Not the default objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Inheritance Difference Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Inheritance Difference• .NET supports object inheritance Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Inheritance Difference• .NET supports object inheritance  No support for multiple inheritance Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Inheritance Difference• .NET supports object inheritance  No support for multiple inheritance• Inheritance makes code simpler, maintainable, easier to debug Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Inheritance Difference• .NET supports object inheritance  No support for multiple inheritance• Inheritance makes code simpler, maintainable, easier to debug  Model hierarchies of objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Inheritance Difference• .NET supports object inheritance  No support for multiple inheritance• Inheritance makes code simpler, maintainable, easier to debug  Model hierarchies of objects• Relational databases don’t support inheritance Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Inheritance Difference• .NET supports object inheritance  No support for multiple inheritance• Inheritance makes code simpler, maintainable, easier to debug  Model hierarchies of objects• Relational databases don’t support inheritance• Some ways to accomplish it Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Inheritance Difference• .NET supports object inheritance  No support for multiple inheritance• Inheritance makes code simpler, maintainable, easier to debug  Model hierarchies of objects• Relational databases don’t support inheritance• Some ways to accomplish it  Table per type Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Inheritance Difference• .NET supports object inheritance  No support for multiple inheritance• Inheritance makes code simpler, maintainable, easier to debug  Model hierarchies of objects• Relational databases don’t support inheritance• Some ways to accomplish it  Table per type  Table per concrete type Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Inheritance Difference• .NET supports object inheritance  No support for multiple inheritance• Inheritance makes code simpler, maintainable, easier to debug  Model hierarchies of objects• Relational databases don’t support inheritance• Some ways to accomplish it  Table per type  Table per concrete type  Table per hierarchy Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Inheritance Difference• .NET supports object inheritance  No support for multiple inheritance• Inheritance makes code simpler, maintainable, easier to debug  Model hierarchies of objects• Relational databases don’t support inheritance• Some ways to accomplish it  Table per type  Table per concrete type  Table per hierarchy• Have to manage special constraints Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Identity/Equality Difference Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Identity/Equality Difference• How do you tell two things are the same? Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Identity/Equality Difference• How do you tell two things are the same?• Database: identity of a row is the primary key Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Identity/Equality Difference• How do you tell two things are the same?• Database: identity of a row is the primary key  Enforced by a primary key constraint Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Identity/Equality Difference• How do you tell two things are the same?• Database: identity of a row is the primary key  Enforced by a primary key constraint  Can use either natural or surrogate keys Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Identity/Equality Difference• How do you tell two things are the same?• Database: identity of a row is the primary key  Enforced by a primary key constraint  Can use either natural or surrogate keys• Objects in object-oriented application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Identity/Equality Difference• How do you tell two things are the same?• Database: identity of a row is the primary key  Enforced by a primary key constraint  Can use either natural or surrogate keys• Objects in object-oriented application  Two objects with the same data are not equal Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Identity/Equality Difference• How do you tell two things are the same?• Database: identity of a row is the primary key  Enforced by a primary key constraint  Can use either natural or surrogate keys• Objects in object-oriented application  Two objects with the same data are not equal  Two variables, each with reference to different objects, are not equal Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Identity/Equality Difference• How do you tell two things are the same?• Database: identity of a row is the primary key  Enforced by a primary key constraint  Can use either natural or surrogate keys• Objects in object-oriented application  Two objects with the same data are not equal  Two variables, each with reference to different objects, are not equal  Two variables with reference to same object are equal Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Identity/Equality Difference• How do you tell two things are the same?• Database: identity of a row is the primary key  Enforced by a primary key constraint  Can use either natural or surrogate keys• Objects in object-oriented application  Two objects with the same data are not equal  Two variables, each with reference to different objects, are not equal  Two variables with reference to same object are equal  Can make a custom definition Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Handling the Differences Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Handling the Differences• Can be an lot of work to handle object/relational differences Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Handling the Differences• Can be an lot of work to handle object/relational differences  But at least they are well understood Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Handling the Differences• Can be an lot of work to handle object/relational differences  But at least they are well understood  Doesn’t mean it’s easy Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Handling the Differences• Can be an lot of work to handle object/relational differences  But at least they are well understood  Doesn’t mean it’s easy• Write the code yourself, or use a framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM) Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Programming technique for conversion of incompatible types Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Programming technique for conversion of incompatible types• Most ORM tools rely on metadata about database and objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Programming technique for conversion of incompatible types• Most ORM tools rely on metadata about database and objects• Clean separation of concerns Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Programming technique for conversion of incompatible types• Most ORM tools rely on metadata about database and objects• Clean separation of concerns• Key feature is mapping Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Programming technique for conversion of incompatible types• Most ORM tools rely on metadata about database and objects• Clean separation of concerns• Key feature is mapping  Expresses how an object is related to a table Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Programming technique for conversion of incompatible types• Most ORM tools rely on metadata about database and objects• Clean separation of concerns• Key feature is mapping  Expresses how an object is related to a table  ORM uses to manage conversion process Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object-Relational Mapping (ORM)• Programming technique for conversion of incompatible types• Most ORM tools rely on metadata about database and objects• Clean separation of concerns• Key feature is mapping  Expresses how an object is related to a table  ORM uses to manage conversion process• ORM manages application’s interactions with database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits to using an ORM Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits to using an ORM• Productivity Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits to using an ORM• Productivity• Better application design Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits to using an ORM• Productivity• Better application design• Code reuse Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits to using an ORM• Productivity• Better application design• Code reuse• Application maintainability Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits to using an ORM• Productivity• Better application design• Code reuse• Application maintainability• Potential downside: performance Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits to using an ORM• Productivity• Better application design• Code reuse• Application maintainability• Potential downside: performance  More complex code Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits to using an ORM• Productivity• Better application design• Code reuse• Application maintainability• Potential downside: performance  More complex code  Means slower performance Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits to using an ORM• Productivity• Better application design• Code reuse• Application maintainability• Potential downside: performance  More complex code  Means slower performance  But ORM code is likely to be well tuned Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits to using an ORM• Productivity• Better application design• Code reuse• Application maintainability• Potential downside: performance  More complex code  Means slower performance  But ORM code is likely to be well tuned  Data access time may be minimal Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits to using an ORM• Productivity• Better application design• Code reuse• Application maintainability• Potential downside: performance  More complex code  Means slower performance  But ORM code is likely to be well tuned  Data access time may be minimal• Lots of ORMs available for .NET Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects vs. Entity Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects vs. Entity• ADO.NET has long had generic data objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects vs. Entity• ADO.NET has long had generic data objects• Most common: Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects vs. Entity• ADO.NET has long had generic data objects• Most common:  SqlConnection and OleDbConnection Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects vs. Entity• ADO.NET has long had generic data objects• Most common:  SqlConnection and OleDbConnection  SqlDataAdapter and OleDbAdapter Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects vs. Entity• ADO.NET has long had generic data objects• Most common:  SqlConnection and OleDbConnection  SqlDataAdapter and OleDbAdapter  DataSet Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects vs. Entity• ADO.NET has long had generic data objects• Most common:  SqlConnection and OleDbConnection  SqlDataAdapter and OleDbAdapter  DataSet  DataTable Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects vs. Entity• ADO.NET has long had generic data objects• Most common:  SqlConnection and OleDbConnection  SqlDataAdapter and OleDbAdapter  DataSet  DataTable  SqlDataReader and OleDbDataReader Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects vs. Entity• ADO.NET has long had generic data objects• Most common:  SqlConnection and OleDbConnection  SqlDataAdapter and OleDbAdapter  DataSet  DataTable  SqlDataReader and OleDbDataReader• Provide a means for accessing data in database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects vs. Entity• ADO.NET has long had generic data objects• Most common:  SqlConnection and OleDbConnection  SqlDataAdapter and OleDbAdapter  DataSet  DataTable  SqlDataReader and OleDbDataReader• Provide a means for accessing data in database  DataSet and DataTable contain rows and columns Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects• Problems with Generic Data Objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects• Problems with Generic Data Objects  Strong coupling between application and database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects• Problems with Generic Data Objects  Strong coupling between application and database  Loose typing Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects• Problems with Generic Data Objects  Strong coupling between application and database  Loose typing  Object interactions Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects• Problems with Generic Data Objects  Strong coupling between application and database  Loose typing  Object interactions• Problems persist despite long use Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects• Problems with Generic Data Objects  Strong coupling between application and database  Loose typing  Object interactions• Problems persist despite long use  Every application has to deal with them Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Generic Data Objects• Problems with Generic Data Objects  Strong coupling between application and database  Loose typing  Object interactions• Problems persist despite long use  Every application has to deal with them  But it’s been the best we’ve had, other than custom objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Objects• Big improvement over what came before Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Objects• Big improvement over what came before  Instead of using a generic DataSet, use Customer, Order, and OrderDetail Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Objects• Big improvement over what came before  Instead of using a generic DataSet, use Customer, Order, and OrderDetail  Navigation properties to access related data Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Objects• Big improvement over what came before  Instead of using a generic DataSet, use Customer, Order, and OrderDetail  Navigation properties to access related data  Fit into object-oriented application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Objects• Big improvement over what came before  Instead of using a generic DataSet, use Customer, Order, and OrderDetail  Navigation properties to access related data  Fit into object-oriented application• Object interfaces can mirror tables and fields Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Objects• Big improvement over what came before  Instead of using a generic DataSet, use Customer, Order, and OrderDetail  Navigation properties to access related data  Fit into object-oriented application• Object interfaces can mirror tables and fields  Or be completely different Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Objects• Big improvement over what came before  Instead of using a generic DataSet, use Customer, Order, and OrderDetail  Navigation properties to access related data  Fit into object-oriented application• Object interfaces can mirror tables and fields  Or be completely different  Or something in between Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Objects• Big improvement over what came before  Instead of using a generic DataSet, use Customer, Order, and OrderDetail  Navigation properties to access related data  Fit into object-oriented application• Object interfaces can mirror tables and fields  Or be completely different  Or something in between• Need a way to map objects to database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits of Entity Data Objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits of Entity Data Objects• Strong typing Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits of Entity Data Objects• Strong typing• Compile-time checking Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits of Entity Data Objects• Strong typing• Compile-time checking• Persistence ignorance Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Benefits of Entity Data Objects• Strong typing• Compile-time checking• Persistence ignorance• Productivity Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Programming Against a Model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Programming Against a Model• Will have to change how you think about data in an application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Programming Against a Model• Will have to change how you think about data in an application  No longer interacting directly with the database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Programming Against a Model• Will have to change how you think about data in an application  No longer interacting directly with the database  Instead working with objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Programming Against a Model• Will have to change how you think about data in an application  No longer interacting directly with the database  Instead working with objects  Very different paradigms Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Programming Against a Model• Will have to change how you think about data in an application  No longer interacting directly with the database  Instead working with objects  Very different paradigms• The model is not the database! Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Programming Against a Model• Will have to change how you think about data in an application  No longer interacting directly with the database  Instead working with objects  Very different paradigms• The model is not the database!• Generic data objects require lots of code Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Programming Against a Model• Will have to change how you think about data in an application  No longer interacting directly with the database  Instead working with objects  Very different paradigms• The model is not the database!• Generic data objects require lots of code• Entity data objects mean querying a schema that reflects business model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Data Programming Against a Model• Will have to change how you think about data in an application  No longer interacting directly with the database  Instead working with objects  Very different paradigms• The model is not the database!• Generic data objects require lots of code• Entity data objects mean querying a schema that reflects business model• ORM eliminates context shift in code Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model• Building a Simple Application using Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model• Building a Simple Application using Entity Framework• Entity Framework APIs and Tools Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • The Entity Framework and DataModel Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • The Entity Framework and DataModel• Complete ORM for .NET applications Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • The Entity Framework and DataModel• Complete ORM for .NET applications• Microsoft’s new core data access technology Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • The Entity Framework and DataModel• Complete ORM for .NET applications• Microsoft’s new core data access technology  Big commitment from the company Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • The Entity Framework and DataModel• Complete ORM for .NET applications• Microsoft’s new core data access technology  Big commitment from the company• Initial release didn’t gain much traction Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • The Entity Framework and DataModel• Complete ORM for .NET applications• Microsoft’s new core data access technology  Big commitment from the company• Initial release didn’t gain much traction• Version 4.1 is a mature product Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • The Entity Framework and DataModel• Complete ORM for .NET applications• Microsoft’s new core data access technology  Big commitment from the company• Initial release didn’t gain much traction• Version 4.1 is a mature product  Substantial commitment and innovation Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • The Entity Framework and DataModel• Complete ORM for .NET applications• Microsoft’s new core data access technology  Big commitment from the company• Initial release didn’t gain much traction• Version 4.1 is a mature product  Substantial commitment and innovation• Do we need a new data access technology? Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • The Entity Framework and DataModel• Complete ORM for .NET applications• Microsoft’s new core data access technology  Big commitment from the company• Initial release didn’t gain much traction• Version 4.1 is a mature product  Substantial commitment and innovation• Do we need a new data access technology?  Older technologies have run their course Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • The Entity Framework and DataModel• Complete ORM for .NET applications• Microsoft’s new core data access technology  Big commitment from the company• Initial release didn’t gain much traction• Version 4.1 is a mature product  Substantial commitment and innovation• Do we need a new data access technology?  Older technologies have run their course  Modern applications have to focus on domain model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • The Entity Framework and DataModel• Complete ORM for .NET applications• Microsoft’s new core data access technology  Big commitment from the company• Initial release didn’t gain much traction• Version 4.1 is a mature product  Substantial commitment and innovation• Do we need a new data access technology?  Older technologies have run their course  Modern applications have to focus on domain model• Version numbers Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model• Integral part of Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model• Integral part of Entity Framework• Client-side model different from database schema Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model• Integral part of Entity Framework• Client-side model different from database schema• Describes structure of entity data objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model• Integral part of Entity Framework• Client-side model different from database schema• Describes structure of entity data objects• Take the database schema and reshape it into objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model• Integral part of Entity Framework• Client-side model different from database schema• Describes structure of entity data objects• Take the database schema and reshape it into objects• Defined by three chunks of XML in a single .edmx file Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model• Integral part of Entity Framework• Client-side model different from database schema• Describes structure of entity data objects• Take the database schema and reshape it into objects• Defined by three chunks of XML in a single .edmx file  Conceptual model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model• Integral part of Entity Framework• Client-side model different from database schema• Describes structure of entity data objects• Take the database schema and reshape it into objects• Defined by three chunks of XML in a single .edmx file  Conceptual model  Storage model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model• Integral part of Entity Framework• Client-side model different from database schema• Describes structure of entity data objects• Take the database schema and reshape it into objects• Defined by three chunks of XML in a single .edmx file  Conceptual model  Storage model  Mapping Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • LINQ to SQL Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • LINQ to SQL• Similar to Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • LINQ to SQL• Similar to Entity Framework  Both use LINQ to query a database using a data model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • LINQ to SQL• Similar to Entity Framework  Both use LINQ to query a database using a data model• Developed independently at Microsoft Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • LINQ to SQL• Similar to Entity Framework  Both use LINQ to query a database using a data model• Developed independently at Microsoft  LINQ to SQL grew out of LINQ team Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • LINQ to SQL• Similar to Entity Framework  Both use LINQ to query a database using a data model• Developed independently at Microsoft  LINQ to SQL grew out of LINQ team  Entity Framework grew out of Data Programmability team Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • LINQ to SQL• Similar to Entity Framework  Both use LINQ to query a database using a data model• Developed independently at Microsoft  LINQ to SQL grew out of LINQ team  Entity Framework grew out of Data Programmability team• Soon Microsoft had two new data access technologies Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • LINQ to SQL• Similar to Entity Framework  Both use LINQ to query a database using a data model• Developed independently at Microsoft  LINQ to SQL grew out of LINQ team  Entity Framework grew out of Data Programmability team• Soon Microsoft had two new data access technologies• LINQ to SQL moved, and lost out to Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Why Use Entity Framework? Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Why Use Entity Framework?• Part of the .NET Framework and integrated into Visual Studio Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Why Use Entity Framework?• Part of the .NET Framework and integrated into Visual Studio• Uses LINQ as the primary query language Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Why Use Entity Framework?• Part of the .NET Framework and integrated into Visual Studio• Uses LINQ as the primary query language• Independent of the data source Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Why Use Entity Framework?• Part of the .NET Framework and integrated into Visual Studio• Uses LINQ as the primary query language• Independent of the data source• Microsoft’s primary data access strategy Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • When Should You Not Use EntityFramework or an ORM? Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • When Should You Not Use EntityFramework or an ORM?• Entity Framework is not a panacea Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • When Should You Not Use EntityFramework or an ORM?• Entity Framework is not a panacea  Not an instant data access panacea Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • When Should You Not Use EntityFramework or an ORM?• Entity Framework is not a panacea  Not an instant data access panacea  Isn’t appropriate for every kind of application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • When Should You Not Use EntityFramework or an ORM?• Entity Framework is not a panacea  Not an instant data access panacea  Isn’t appropriate for every kind of application  Doesn’t do bulk inserts Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model• Building a Simple Application using Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model• Building a Simple Application using Entity Framework• Entity Framework APIs and Tools Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Building a Simple Application usingEntity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Building a Simple Application usingEntity Framework• Compelling reason to use Entity Framework is its integration with Visual Studio Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Building a Simple Application usingEntity Framework• Compelling reason to use Entity Framework is its integration with Visual Studio• Sample is based on AdventureWorksLT Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Building a Simple Application usingEntity Framework• Compelling reason to use Entity Framework is its integration with Visual Studio• Sample is based on AdventureWorksLT  Ten tables with data about customers, products, and orders Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Building a Simple Application usingEntity Framework• Compelling reason to use Entity Framework is its integration with Visual Studio• Sample is based on AdventureWorksLT  Ten tables with data about customers, products, and orders  Complex enough to exercise Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Building a Simple Application usingEntity Framework• Compelling reason to use Entity Framework is its integration with Visual Studio• Sample is based on AdventureWorksLT  Ten tables with data about customers, products, and orders  Complex enough to exercise Entity Framework• Will build sample as a class library Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Building a Simple Application usingEntity Framework• Compelling reason to use Entity Framework is its integration with Visual Studio• Sample is based on AdventureWorksLT  Ten tables with data about customers, products, and orders  Complex enough to exercise Entity Framework• Will build sample as a class library  Easy to reuse in multiple applications Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Building a Simple Application usingEntity Framework• Compelling reason to use Entity Framework is its integration with Visual Studio• Sample is based on AdventureWorksLT  Ten tables with data about customers, products, and orders  Complex enough to exercise Entity Framework• Will build sample as a class library  Easy to reuse in multiple applications  Not absolutely necessary Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Building a Simple Application usingEntity Framework• Compelling reason to use Entity Framework is its integration with Visual Studio• Sample is based on AdventureWorksLT  Ten tables with data about customers, products, and orders  Complex enough to exercise Entity Framework• Will build sample as a class library  Easy to reuse in multiple applications  Not absolutely necessary• Mostly create simple console applications Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Using the Entity Objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Using the Entity Objects• Time to use the entity data objects in an application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Using the Entity Objects• Time to use the entity data objects in an application• Simple console application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Using the Entity Objects• Time to use the entity data objects in an application• Simple console application• Need to do three things to use the class library Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Using the Entity Objects• Time to use the entity data objects in an application• Simple console application• Need to do three things to use the class library  Add a reference to the class library Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Using the Entity Objects• Time to use the entity data objects in an application• Simple console application• Need to do three things to use the class library  Add a reference to the class library  Add a reference to System.Data.Entity Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Using the Entity Objects• Time to use the entity data objects in an application• Simple console application• Need to do three things to use the class library  Add a reference to the class library  Add a reference to System.Data.Entity  Add the Entity Framework connection string Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Using the Entity Objects• Time to use the entity data objects in an application• Simple console application• Need to do three things to use the class library  Add a reference to the class library  Add a reference to System.Data.Entity  Add the Entity Framework connection string• And, of course, write some code! Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model• Building a Simple Application using Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Agenda• Object-Relational Mapping (ORM) and Data Access• The Entity Framework and Data Model• Building a Simple Application using Entity Framework• Entity Framework APIs and Tools Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework APIs and Tools Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework APIs and Tools• Entity Framework is a complex set of APIs and design tools Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework APIs and Tools• Entity Framework is a complex set of APIs and design tools• Need a basic understanding of what each of the Entity Framework components do Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework APIs and Tools• Entity Framework is a complex set of APIs and design tools• Need a basic understanding of what each of the Entity Framework components do  Road to deep understanding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Architecture Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Object Services Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Results Object Services Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Results Object Services Command Tree Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Results Object Services Command Tree EntityClient Data Provider Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Results Object Services Command Entity Tree Data Reader EntityClient Data Provider Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Results Entity SQL Query Object Services Command Entity Tree Data Reader EntityClient Data Provider Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Results Entity SQL Query Object Services Command Entity Tree Data Reader EntityClient Data Provider Command Tree Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Results Entity SQL Query Object Services Command Entity Tree Data Reader EntityClient Data Provider Command Tree ADO.NET Data Providers Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Results Entity SQL Query Object Services Command Entity Tree Data Reader EntityClient Data Provider Command Tree DB Data Reader ADO.NET Data Providers Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Results Entity SQL Query Object Services Command Entity Tree Data Reader EntityClient Data Provider Command Tree DB Data Reader ADO.NET Data Providers Data Store Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Entity Data Results Entity Model SQL Query Object Services Command Entity Tree Data Reader EntityClient Data Provider Command Tree DB Data Reader ADO.NET Data Providers Data Store Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Entity Data Results Entity Model SQL Query Object Services Conceptual Model Command Entity Tree Data Reader EntityClient Data Provider Command Tree DB Data Reader ADO.NET Data Providers Data Store Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Entity Data Results Entity Model SQL Query Object Services Conceptual Model Command Entity Tree Data Reader EntityClient Data Provider Command Tree DB Data Storage Reader Model ADO.NET Data Providers Data Store Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • ApplicationArchitecture Entity SQL LINQ to Entities Query Query Entity Data Results Entity Model SQL Query Object Services Conceptual Model Command Entity Tree Data Reader Mapping EntityClient Data Provider Command Tree DB Data Storage Reader Model ADO.NET Data Providers Data Store Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model Designer Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model Designer• Part of Visual Studio Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model Designer• Part of Visual Studio• Lets you work with model graphically rather than as raw XML Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model Designer• Part of Visual Studio• Lets you work with model graphically rather than as raw XML• First saw as part of the AdventureWorksLibrary project Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model Designer• Part of Visual Studio• Lets you work with model graphically rather than as raw XML• First saw as part of the AdventureWorksLibrary project• Doesn’t support all Entity Data Model features Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model Designer• Part of Visual Studio• Lets you work with model graphically rather than as raw XML• First saw as part of the AdventureWorksLibrary project• Doesn’t support all Entity Data Model features• Lets you map tables, views, stored procedures and functions to entities Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Data Model Designer• Part of Visual Studio• Lets you work with model graphically rather than as raw XML• First saw as part of the AdventureWorksLibrary project• Doesn’t support all Entity Data Model features• Lets you map tables, views, stored procedures and functions to entities  Can update the model from the underlying database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Design Methodologies Using theDesigner Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Design Methodologies Using theDesigner• Two broad ways to build a data application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Design Methodologies Using theDesigner• Two broad ways to build a data application  Top-down design Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Design Methodologies Using theDesigner• Two broad ways to build a data application  Top-down design  Bottom-up design Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Design Methodologies Using theDesigner• Two broad ways to build a data application  Top-down design  Bottom-up design• Neither is necessarily better than the other Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Design Methodologies Using theDesigner• Two broad ways to build a data application  Top-down design  Bottom-up design• Neither is necessarily better than the other• Entity Framework supports both Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Design Methodologies Using theDesigner• Two broad ways to build a data application  Top-down design  Bottom-up design• Neither is necessarily better than the other• Entity Framework supports both• Provides three ways to build an application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Design Methodologies Using theDesigner• Two broad ways to build a data application  Top-down design  Bottom-up design• Neither is necessarily better than the other• Entity Framework supports both• Provides three ways to build an application  Database-first design Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Design Methodologies Using theDesigner• Two broad ways to build a data application  Top-down design  Bottom-up design• Neither is necessarily better than the other• Entity Framework supports both• Provides three ways to build an application  Database-first design  Model-first design Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Design Methodologies Using theDesigner• Two broad ways to build a data application  Top-down design  Bottom-up design• Neither is necessarily better than the other• Entity Framework supports both• Provides three ways to build an application  Database-first design  Model-first design  Code-first design Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Code Generation Using T4 Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Code Generation Using T4• Entity Data Model designer generates code Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Code Generation Using T4• Entity Data Model designer generates code• Uses Visual Studio’s Text Template Transformation Toolkit (T4) Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Code Generation Using T4• Entity Data Model designer generates code• Uses Visual Studio’s Text Template Transformation Toolkit (T4)  Generates classes in designer code file Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Code Generation Using T4• Entity Data Model designer generates code• Uses Visual Studio’s Text Template Transformation Toolkit (T4)  Generates classes in designer code file  Standard within Visual Studio Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Code Generation Using T4• Entity Data Model designer generates code• Uses Visual Studio’s Text Template Transformation Toolkit (T4)  Generates classes in designer code file  Standard within Visual Studio• Can customize the templates Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Code Generation Using T4• Entity Data Model designer generates code• Uses Visual Studio’s Text Template Transformation Toolkit (T4)  Generates classes in designer code file  Standard within Visual Studio• Can customize the templates  Not for the faint of heart Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object Services Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object Services• Manages all of the objects in Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object Services• Manages all of the objects in Entity Framework• Key task is to handle differences between database and objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object Services• Manages all of the objects in Entity Framework• Key task is to handle differences between database and objects• Provides and EntityObject class and manages objects that inherit from it Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object Services• Manages all of the objects in Entity Framework• Key task is to handle differences between database and objects• Provides and EntityObject class and manages objects that inherit from it• Four primary tasks Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object Services• Manages all of the objects in Entity Framework• Key task is to handle differences between database and objects• Provides and EntityObject class and manages objects that inherit from it• Four primary tasks  Exposes an API Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object Services• Manages all of the objects in Entity Framework• Key task is to handle differences between database and objects• Provides and EntityObject class and manages objects that inherit from it• Four primary tasks  Exposes an API  Performs query transformations Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object Services• Manages all of the objects in Entity Framework• Key task is to handle differences between database and objects• Provides and EntityObject class and manages objects that inherit from it• Four primary tasks  Exposes an API  Performs query transformations  Performs object materialization Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Object Services• Manages all of the objects in Entity Framework• Key task is to handle differences between database and objects• Provides and EntityObject class and manages objects that inherit from it• Four primary tasks  Exposes an API  Performs query transformations  Performs object materialization  Tracks state of objects and updates data store Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Client Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Client• Communicates with the database and manages data conversions Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Client• Communicates with the database and manages data conversions  Must know structure of database as well as entity data objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Client• Communicates with the database and manages data conversions  Must know structure of database as well as entity data objects  Uses the full Entity Data Model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Client• Communicates with the database and manages data conversions  Must know structure of database as well as entity data objects  Uses the full Entity Data Model• Connects to database through data provider Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Client• Communicates with the database and manages data conversions  Must know structure of database as well as entity data objects  Uses the full Entity Data Model• Connects to database through data provider  Standard API Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Client• Communicates with the database and manages data conversions  Must know structure of database as well as entity data objects  Uses the full Entity Data Model• Connects to database through data provider  Standard API  Same providers as in ADO.NET, updated for Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Client• Communicates with the database and manages data conversions  Must know structure of database as well as entity data objects  Uses the full Entity Data Model• Connects to database through data provider  Standard API  Same providers as in ADO.NET, updated for Entity Framework• Can work with any data store with a provider Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Client• Communicates with the database and manages data conversions  Must know structure of database as well as entity data objects  Uses the full Entity Data Model• Connects to database through data provider  Standard API  Same providers as in ADO.NET, updated for Entity Framework• Can work with any data store with a provider• SQL Server versions Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Client• Communicates with the database and manages data conversions  Must know structure of database as well as entity data objects  Uses the full Entity Data Model• Connects to database through data provider  Standard API  Same providers as in ADO.NET, updated for Entity Framework• Can work with any data store with a provider• SQL Server versions• Don’t have to use Object Services to query Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Client• Communicates with the database and manages data conversions  Must know structure of database as well as entity data objects  Uses the full Entity Data Model• Connects to database through data provider  Standard API  Same providers as in ADO.NET, updated for Entity Framework• Can work with any data store with a provider• SQL Server versions• Don’t have to use Object Services to query  Can use Entity SQL directly to Entity Client Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework Services Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework Services• Entity Framework provides various services to the application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework Services• Entity Framework provides various services to the application  Microsoft expands with each new release Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework Services• Entity Framework provides various services to the application  Microsoft expands with each new release  Expands usability of Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework Services• Entity Framework provides various services to the application  Microsoft expands with each new release  Expands usability of Entity Framework• Support for Plain Old CLR Objects (POCO) Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework Services• Entity Framework provides various services to the application  Microsoft expands with each new release  Expands usability of Entity Framework• Support for Plain Old CLR Objects (POCO)  Don’t inherit from EntityObject Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework Services• Entity Framework provides various services to the application  Microsoft expands with each new release  Expands usability of Entity Framework• Support for Plain Old CLR Objects (POCO)  Don’t inherit from EntityObject  Supports lots of programming styles and methodologies Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework Services• Entity Framework provides various services to the application  Microsoft expands with each new release  Expands usability of Entity Framework• Support for Plain Old CLR Objects (POCO)  Don’t inherit from EntityObject  Supports lots of programming styles and methodologies  ObjectContext obtains relationship and change tracking information Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework Services• Entity Framework provides various services to the application  Microsoft expands with each new release  Expands usability of Entity Framework• Support for Plain Old CLR Objects (POCO)  Don’t inherit from EntityObject  Supports lots of programming styles and methodologies  ObjectContext obtains relationship and change tracking information• Data Binding in .NET Applications Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework Services• Entity Framework provides various services to the application  Microsoft expands with each new release  Expands usability of Entity Framework• Support for Plain Old CLR Objects (POCO)  Don’t inherit from EntityObject  Supports lots of programming styles and methodologies  ObjectContext obtains relationship and change tracking information• Data Binding in .NET Applications  Long a standard technique for connecting data to UI controls Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Entity Framework Services• Entity Framework provides various services to the application  Microsoft expands with each new release  Expands usability of Entity Framework• Support for Plain Old CLR Objects (POCO)  Don’t inherit from EntityObject  Supports lots of programming styles and methodologies  ObjectContext obtains relationship and change tracking information• Data Binding in .NET Applications  Long a standard technique for connecting data to UI controls  Entity Framework fully supports data binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Learn More! Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • Learn More!• This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details! Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company