Entity Framework Tutorial


Entity Framework Tutorial
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
$12.00
save 50%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
$33.99
save 47%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Reviews
Support
Sample Chapters
  • 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

Book Details

Language : English
Paperback : 228 pages [ 235mm x 191mm ]
Release Date : October 2008
ISBN : 1847195229
ISBN 13 : 9781847195227
Author(s) : Joydip Kanjilal
Topics and Technologies : All Books, Application Development, Microsoft Development , Enterprise, Microsoft, .NET


Table of Contents

Preface
Chapter 1: Introducing the ADO.NET Entity Framework
Chapter 2: Getting Started
Chapter 3: Entities, Relationships, and the Entity Data Model
Chapter 4: Working with Stored Procedures in the Entity Data Model
Chapter 5: Working with Entity Client and Entity SQL
Chapter 6: Working with LINQ to Entities
Chapter 7: Working with the Object Services Layer
Chapter 8: Introducing ADO.NET Data Services
Index
  • Chapter 1: Introducing the ADO.NET Entity Framework
    • What You should Know
    • Looking Back
    • What is ADO.NET Entity Framework?
      • Is It Just Another ORM?
    • The ADO.NET Entity Framework Architectural Components
    • The Entity Data Model (EDM)
      • How is the Entity Data Model Represented?
    • The Object Model (O-Space)
    • LINQ to Entities
    • Entity Client
    • Entity SQL
      • Avoiding Complex Joins
    • The Object Services Layer
    • ADO.NET Entity Framework—Features and Benefits at a Glance
  • Installing the Prerequisites
    • Installing the ADO.NET Entity Framework and Its Tools
      • Downloading the Software
      • Installing the Software
  • Designing the Payroll Database
  • Summary
  • Glossary
  • Chapter 2: Getting Started
    • Creating an Entity Data Model
      • Creating the Payroll Entity Data Model Using the ADO.NET Entity Data Model Designer
      • Creating the Payroll Data Model Using the EdmGen Tool
    • The ADO.NET Entity Data Source Control
    • Implementing Our First Application Using the Entity Framework
    • Summary
  • Chapter 3: Entities, Relationships, and the Entity Data Model
    • Entities, Entity Types, and Relationships in the ADO.NET Entity Data Model (EDM)
      • What is an Entity?
      • Defining Entity Sets in the Entity Data Model
      • Extending the Existing Entity Types to Create Derived Entity Types
      • Association Sets, Associations, Containment, and Multiplicity
      • What are Entity Containers?
    • Exploring the Payroll Entity Data Model
      • The Mapping Details Window
      • The Entity Model Browser
      • The Entity Data Model Layers
        • The CSDL Schema
        • The SSDL Schema
        • The MSL Schema
    • Summary
  • Using Stored Procedures
  • Mapping Stored Procedures that Return Custom Entity Types
  • Summary
  • Chapter 5: Working with Entity Client and Entity SQL
    • An Overview of the Entity SQL Language
      • From Transact SQL (T-SQL) to Entity SQL (E-SQL)
      • Why Entity SQL When I Already have LINQ to Entities?
      • Features of Entity SQL
      • Operators in Entity SQL
        • Arithmetic Operators
        • Comparison Operators
        • Logical Operators
        • Reference Operators
        • Type Operators
        • Set Operators
        • Operator Precedence
      • Expressions in Entity SQL
        • Query Expressions in Entity SQL
      • Identifiers, Variables, Parameters, and Types in Entity SQL
        • Row
        • Collection
        • Reference
      • Canonical Functions in Entity SQL
        • Mathematical Functions
        • Aggregate Functions
        • String Functions
        • Bitwise Functions
        • Date and Time Functions
    • Data Paging Using Entity SQL
    • Working with the ADO.NET Entity Client
      • Let's Get into Action
        • Building the Connection String
        • Creating an Entity Connection
        • Opening the Connection
        • Executing Queries Using the Entity Command
        • Closing the Connection
    • Other Operations with Entity SQL
      • Inserting a Record Using Entity SQL
      • Inserting a Record with a Foreign Key Constraint
      • Retrieving Native SQL from EntityCommand
      • Transaction Management in Entity SQL
    • Summary
  • Chapter 6: Working with LINQ to Entities
    • Introducing LINQ
      • Why LINQ?
    • Understanding the LINQ Architecture
      • LINQ to XML
      • LINQ to SQL
      • LINQ to Objects
      • LINQ to Entities
        • Querying Data Using LINQ to Entities
        • LINQ to Entities and Entity Framework
        • Differences between LINQ to Entities and LINQ to SQL
    • Operators in LINQ
      • Aggregation
      • Projections
      • Ordering
      • Quantifiers
      • Restriction
      • Conversion
      • Element
      • Set
  • Querying Data Using LINQ
    • Expressions in LINQ to Entities
      • Constant Expressions
      • Comparison Expressions
      • Initializing Expressions
      • Null Comparisons
      • Navigation Properties
      • Immediate and Deferred Query Execution
      • Improving Performance with Compiled Queries
  • Summary
  • Chapter 7: Working with the Object Services Layer
    • What are Object Services?
      • Features at a Glance
      • A Quick Look at the ObjectContext Class in our Payroll EDM
      • Querying Data as in-Memory Objects
    • 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
      • Implementing a Sample Application
      • Creating the Form
      • Implementing a Custom DataContext
      • How is This Accomplished?
    • Inheritance in the Entity Framework
      • Table per Hierarchy
      • Table per Type
  • Implementing Complex Types in the EDM
  • Summary
  • Chapter 8: Introducing ADO.NET Data Services
    • Introducing ADO.NET Data Services
      • How Do ADO.NET Data Services and Web Services Differ?
      • What is Representational State Transfer (REST)?
      • Why Use ADO.NET Data Services?
        • Features at a Glance
    • Prerequisites
    • Exposing Data as a Service Using ADO.NET Data Services
      • Creating an ADO.NET Data Service
      • Using a Relational Database as the Data Source
      • Using Data Sources Other Than a Relational Database
    • Understanding the System.Services.Data Namespace
    • Restricting Access to Resources
    • Working with the ADO.NET Data Service Client Library
      • Generating the Client-Side Entity Classes
      • Inserting a Record
      • Updating a Record
      • Deleting a Record
      • Consuming an ADO.NET Data Service Using LINQ
      • Exposing a Stored Procedure as a URI
    • Handling Exceptions in ADO.NET Data Services
    • Batching ADO.NET Data Services Requests to Improve Performance
      • Debugging Your Data Service
    • References
    • Summary

Joydip Kanjilal

Joydip Kanjilal is a Microsoft Most Valuable Professional in ASP.NET, a speaker, and the author of several books and articles. He has over 16 years of experience in the IT industry, with more than 10 years using Microsoft .NET and its related technologies. He was selected as the MSDN Featured Developer of the Fortnight a number of times and also as the Community Credit Winner by www.communitycredit. com several times. He has authored the following books:

  • Visual Studio Six in One (Wrox Publishers)
  • ASP.NET 4.0 Programming (Mc-Graw Hill Publishing)
  • Entity Framework Tutorial (Packt Publishing)
  • Pro Sync Framework (APRESS)
  • Sams Teach Yourself ASP.NET Ajax in 24 Hours (Sams Publishing)
  • ASP.NET Data Presentation Controls Essentials (Packt Publishing)

He has also authored more than 250 articles for some of the most reputable sites, such as www.msdn.microsoft.com, www.code-magazine.com, www.asptoday.com, www.devx.com, www.ddj.com, www.aspalliance.com, www.aspnetpro.com, www.sql-server-performance.com, and www.sswug.com. A lot of these articles have been selected at www.asp.net—Microsoft's official website on ASP.NET.

He has years of experience in designing and architecting solutions for various domains. His technical strengths include C, C++, VC++, Java, C#, Microsoft .NET, Ajax, WCF, REST, SOA, Design Patterns, SQL Server, Operating Systems, and Computer Architecture.

For more details, please refer to the following links:

  • Blog: http://aspadvice.com/blogs/joydip
  • Website: www.joydipkanjilal.com
  • Twitter: https://twitter.com/joydipkanjilal
  • Facebook: https://www.facebook.com/joydipkanjilal
  • LinkedIn: http://in.linkedin.com/in/joydipkanjilal

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Entity Framework Tutorial +    Software Development on the SAP HANA Platform =
50% Off
the second eBook
Price for both: £27.05

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • 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.

Learn to build a better data access layer with the ADO.NET Entity Framework and ADO.NET Data Services

Approach

This book is written as a tutorial, leading you through examples to illuminate the main theory and get you working with the Entity Framework as quickly as possible.

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.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software