Free Sample
+ Collection

Entity Framework Tutorial

Joydip Kanjilal

Learn to build a better data access layer with the ADO.NET Entity Framework and ADO.NET Data Services with this book and eBook
RRP $23.99
RRP $39.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781847195227
Paperback228 pages

About This Book

  • Clear and concise guide to the ADO.NET Entity Framework with plentiful code examples
  • Create Entity Data Models from your database and use them in your applications
  • Learn about the Entity Client data provider and create statements in Entity SQL
  • Learn about ADO.NET Data Services and how they work with the Entity Framework

Who This Book Is For

This book is for C# developers who want an easier way to create their data access layer. You will need to be comfortable with ADO.NET, but you don't need to know anything about the Entity Framework. Along the way we will create some ASP.NET applications, so being familiar with this will also help.

Table of Contents

Chapter 1: Introducing the ADO.NET Entity Framework
What You should Know
Looking Back
What is ADO.NET Entity Framework?
The ADO.NET Entity Framework Architectural Components
The Entity Data Model (EDM)
Installing the Prerequisites
Designing the Payroll Database
Chapter 2: Getting Started
Creating an Entity Data Model
The ADO.NET Entity Data Source Control
Implementing Our First Application Using the Entity Framework
Chapter 3: Entities, Relationships, and the Entity Data Model
Entities, Entity Types, and Relationships in the ADO.NET Entity Data Model (EDM)
Exploring the Payroll Entity Data Model
Chapter 4: Working with Stored Procedures in the Entity Data Model
Mapping Stored Procedures to Functions in the EDM
Using Stored Procedures
Mapping Stored Procedures that Return Custom Entity Types
Chapter 5: Working with Entity Client and Entity SQL
An Overview of the Entity SQL Language
Data Paging Using Entity SQL
Working with the ADO.NET Entity Client
Other Operations with Entity SQL
Chapter 6: Working with LINQ to Entities
Introducing LINQ
Understanding the LINQ Architecture
Operators in LINQ
Querying Data Using LINQ
Chapter 7: Working with the Object Services Layer
What are Object Services?
Adding, Modifying, and Deleting Objects
Attaching and Detaching Objects to and from the Object Context
Serializing and De-Serializing Entity Instances
Change Tracking and Identity Resolution Using ObjectContext
Inheritance in the Entity Framework
Implementing Complex Types in the EDM
Chapter 8: Introducing ADO.NET Data Services
Introducing ADO.NET Data Services
Exposing Data as a Service Using ADO.NET Data Services
Understanding the System.Services.Data Namespace
Restricting Access to Resources
Working with the ADO.NET Data Service Client Library
Handling Exceptions in ADO.NET Data Services
Batching ADO.NET Data Services Requests to Improve Performance

What You Will Learn

  • Explore the features of the ADO.NET Entity Framework
  • Understand the concepts of entities and their relationships
  • Create an Entity Data Model using the ADO.NET Entity Data Model Designer as well as the EdmGen tool
  • Get started with the Entity Framework and implement your application using it
  • Extend the existing Entity Types to create your own Entity Types
  • Write programs against the Entity Data Model to perform CRUD operations
  • Explore ADO.NET Data Services and learn how they can be used with the Entity Framework

Chapter 1, Introducing the ADO.NET Entity Framework, introduces the reader to the basics of ADO.NET EF, why it is useful, and its features and benefits. It also covers designing the Payroll Database that is used by the model application developed in subsequent chapters.

Chapter 2, Getting started with the Entity Framework, discusses how to get started with EF – creating the Payroll Entity Data Model (EDM) and mapping the model to the database and writing a program to query data.

Chapter 3, Entities, Relationships, and the Entity Data Model, gives a detailed explanation of entities, relationships, and of each of the sections of the Payroll EDM.

Chapter 4, Working with Stored Procedures in the Entity Data Model, explains how we can map stored procedures in the EDM and use them in our applications.

Chapter 5, Working with Entity Client and Entity SQL, discusses the ESQL query language and how to work with the Entity Client provider. It also explains the differences between Entity SQL and Transact SQL.

Chapter 6, Working with LINQ to Entities, includes a detailed discussion on using Language Integrated Query (LINQ) to retrieve data from Entities, with lots of code examples.

Chapter 7, Working with Objects Services, provides a detailed discussion on the Object Services Layer and its powerful features for reading, inserting, editing, deleting, and serializing objects and binding them to data controls.

Chapter 8, Working with ADO.NET Data Services, provides an introduction to ADO.NET Data Services and using them with EDM to perform CRUD operations.

In Detail

The ADO.NET Entity Framework is a new way to build the data access layer of your Windows or web applications. It's an Object Relational Mapping (ORM) technology that makes it easy to tie together the data in your database with the objects in your applications, by abstracting the object model of an application from its relational or logical model.

This clear and concise book gets you started with the Entity Framework and carefully gives you the skills to speed up your application development by constructing a better data access layer. It shows you how to get the most from the ADO.NET Entity Framework to perform CRUD operations with complex data in your applications.

This tutorial starts out with the basics of the Entity Framework, showing plenty of examples to get you started using it in your own code. You will learn how to create an Entity Data Model, and then take this further with Entity types. You will also learn about the Entity Client data provider, learn how to create statements in Entity SQL, and get to grips with ADO.NET Data Services, also known as Project Astoria.


Read More