Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET 4.5
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Amazon Web Services
Analysis Services
Android
Architecture
Arduino
ASP .NET Web API
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
BDD
Big Data
Bing
BizTalk
Book Excerpts
Build and Deploy
Business Intelligence
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE Framework Info - non Technical
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Debugger
Design Patterns
Development Process
Display Technologies
Distributed Computing
Document Database
DotNetNuke
DSL
Dynamic Languages
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
HTML 5
Internet Explorer 8.0
Interviews
IOS
iPhone
Iron Ruby
Java
Java Script
JavaScript
jQuery
JSON
Lightswitch
LINQ
Linux
LUA
Mac OS X
MDX
Messaging
Metro
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
MVVM
MySQL
Network
NHibernate
node.js
NOSQL
Nuget
Object Oriented Development
Objective C
Odata
OLAP
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
PHP
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Prolog
Python
Q&A
Rails
Rake
Razor
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Scheme
Search
Security
Services
SharePoint
SignalR
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server 2012
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
TFS
Tips
TypeScript
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 11
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio 2011
Visual Studio 2012
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WebMatrix
WF
Whitepapers
Windows 7
Windows 8
Windows Azure
Windows Live
Windows Phone 7
Windows Phone SDK
Windows Server
Windows Vista
WinForms
WinRT
Workflow
WPF
XAML
Xiine Documentation
XML
XNA
XSLT



LearnNow


XAMALOT
 


DevTeach

Reader rating:
Click here to read 5 comments about this article.
Article source: CoDe (2007 - Vol. 4 - Issue 3 - Data Programability )


Article Pages:  1  2 3 - Next >


Programming Against the ADO.NET Entity Framework

The ADO.NET Entity Framework raises the level of abstraction at which developers work with data. Rather than coding against rows and columns, the ADO.NET Entity Framework allows you to define a higher-level Entity Data Model over your relational data, and then program in terms of this model. You get to deal with your data in the shapes that make sense for your application and those shapes are expressed in a richer vocabulary that include concepts like inheritance, complex types, and explicit relationships.

In his article, An Entity Data Model for Relational Data (parts I & II), Mike Pizzo explains the details of the Entity Data Model and how to map a model to a database. In this article, I discuss the capabilities the ADO.NET Entity Framework provides for programming against a model after it is defined. The material in this article is intended as an overview that covers the breadth of features available to developers. Each of these features is a topic unto itself and is covered in more detail in the MSDN documentation that accompanies the ADO.NET Entity Framework.

Overview of the ADO.NET Entity Framework

The ADO.NET Entity Framework is built in a layered architecture on top of existing ADO.NET 2.0 data providers. Figure 1 illustrates this layering.

Click for a larger version of this image.

Figure 1: The ADO.NET Entity Framework is built in a layered architecture above the existing ADO.NET 2.0 data providers.

The ADO.NET 2.0 Data Providers offer a common programming model for accessing disparate data sources. Whether you are programming against a Microsoft SQL Server database or an Oracle database, you use the same fundamental programming abstractions: a connection object, a command object, and a data reader object.

The ADO.NET Entity Framework introduces a new data provider called EntityClient; this is the first layer above the ADO.NET 2.0 data providers. EntityClient offers the same programming abstractions as the other data providers-connections, commands, and data readers-but adds mapping capabilities that translate queries expressed in terms of the model into the equivalent queries in terms of the tables in the databases. To complement these capabilities, the ADO.NET Entity Framework introduces an extended query language called Entity SQL (E-SQL), which augments traditional SQL with constructs necessary for querying in terms of the higher-level modeling concepts in Entity Data Models (inheritance, complex types, and explicit relationships).

Above the EntityClient layer, the ADO.NET Entity Framework includes an Object Services layer, which provides a programming model in terms of strongly-typed objects. At the Object Services layer, entities are represented as objects-instances of data classes that are mapped to the entity types in the model. The Object Services layer supports querying with both Entity SQL and Language Integrated Query (LINQ). Query results are manifested as objects whose properties can be read and set by application code. Object Services keeps track of changes made to the objects and can propagate these back to the database. The ADO.NET Entity Framework’s mapping engine performs the translation between changes to the entity objects and operations on the underlying database tables.

"
The Object Services layer supports querying with both Entity SQL and Language Integrated Query (LINQ).
"

Developers can choose to program against either the EntityClient layer or the Object Services layer. This choice provides flexibility for different application scenarios. In cases where the application does not require objects, the EntityClient layer provides a lower-level entry point that offers the benefits of entities without the overhead of object materialization. When you require the convenience and change-tracking capabilities of objects, you can choose to work at the Object Services layer. In either case, an underlying ADO.NET data provider performs database operations and compensates for the differences between database systems. Thus, the ADO.NET Entity Framework exposes exactly the same programming model and query syntax, regardless of the particular DBMS in which the data is stored.

In this article, I’ll approach the ADO.NET Entity Framework top-down: First I’ll show some code snippets that illustrate programming at the Object Services layer. Then, I’ll delve into some examples that show EntityClient in action.

&

By: Shyam Pather

Shyam Pather is a Senior Development Lead on the Data Programmability Team at Microsoft, currently focused on building the first release of the ADO.NET Entity Framework. Shyam began his career at Microsoft in the Windows Networking team, working first on network driver infrastructure and then on the first two releases of Universal Plug and Play in Windows. Shyam joined the SQL Server team to work on an incubation project that eventually became SQL Server Notification Services. After shipping two releases of that product, Shyam started in his current role on ADO.NET. His team delivers key parts of the object-relational mapping technology on which the ADO.NET Entity Framework is based.

spather@microsoft.com

Fast Facts

The ADO.NET Entity Framework allows you to program in terms of a high-level conceptual model of your data. This eliminates much of the need for custom data access layers.



Article Pages:  1  2 3 - Next Page: 'A Sample Entity Data Model' >>

Page 1: Programming Against the ADO.NET Entity Framework
Page 2: A Sample Entity Data Model
Page 3: Issuing Queries

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
2.0 out of 5

59 people have rated this article.

Instantly Search Terabytes Of Text
“Lightning Fast”
– Redmond Mag
“Covers all data
sources” – eWeek
25+ fielded & full-text search options
dtSearch’s own document filters highlight hits in popular file types
Web Spider supports static & dynamic data
APIs for .NET, Java, C++, SQL, etc.
Win / Linux (64-bit & 32-bit)
www.dtSearch.com
 

      LearnNow

 

SSWUG