entityframe work and linq

9
EntityFrame work and LINQ CH 14

Upload: benard

Post on 07-Jan-2016

37 views

Category:

Documents


1 download

DESCRIPTION

EntityFrame work and LINQ. CH 14. linq. LINQ enables you to query data from a wide variety of data sources, directly from your programming code. LINQ is to .NET programming what SQL is to relational databases. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: EntityFrame  work and LINQ

EntityFrame work and LINQ

CH 14

Page 2: EntityFrame  work and LINQ

linq

• LINQ enables you to query data from a wide variety of data sources, directly from your programming code. LINQ is to .NET programming what SQL is to relational databases

Page 3: EntityFrame  work and LINQ

LINQ is an important plumbing technique in many data-access scenarios, including database access in ASP.NET web applications using the ADO.NET Entity Framework.

LINQ is so important, it has been integrated in many different places in .NET. LINQ is available for objects enabling you to query in-memory collections. Additionally, LINQ is available for XML, Entities, ADO.NET, and DataSets, each type providing access to a different data store, but with the same, unified querying language. LINQ is also used as the query language for the ADO.NET Entity Framework.

Page 4: EntityFrame  work and LINQ

ADO.NET Entity Framework

• ADO.NET Entity Framework (EF) is an object-

relational mapping (ORM) framework for

the .NET Framework

Page 5: EntityFrame  work and LINQ

To work with EF in your ASP.NET web applications you have a couple of different options. First,you can write queries in the Code Behind of a page and then bind the results to a data-bound control using the DataSource property and DataBind method of the control. Alternatively, you can use the EntityDataSource control that serves as the bridge between your data-bound controls and your model. Combined with the new ListView and DataPager controls, the EntityDataSource gives you the ability to create fully functional CRUD pages.

Page 6: EntityFrame  work and LINQ

• ADO.NET Entity Framework abstracts the relational

(logical) schema of the data that is stored in a

database and presents its conceptual schema to the

application

Page 7: EntityFrame  work and LINQ

• At development time, this abstraction eliminates the object-relational impedance mismatch that is otherwise common in conventional database-oriented programs. The run-time overhead of mapping between the conceptual schema and the underlying relational schema is still a factor to be considered.

Page 8: EntityFrame  work and LINQ

• in a conventional database-oriented system, entries about a customer and their information can be stored in a Customer table, their orders in an Order table and their contact information in yet another Contact table. The application that deals with this database must "know" which information is in which table, i.e., the relational schema of the data is hard-coded into the application.

Page 9: EntityFrame  work and LINQ

Object-relational impedance mismatch

• The object-relational impedance mismatch is a set of conceptual and technical difficulties that are often encountered when a relational database management system (RDBMS) is being used by a program written in an object-oriented programming language particularly when objects or class definitions are mapped in a straightforward way to database tables or relational schemata.