Book Image

Entity Framework Tutorial (Update) - Second Edition

By : Joydip Kanjilal
Book Image

Entity Framework Tutorial (Update) - Second Edition

By: Joydip Kanjilal

Overview of this book

The ADO.NET Entity Framework from Microsoft is a new ADO.NET development framework that provides a level of abstraction for data access strategies and solves the impedance mismatch issues that exist between different data models This book explores Microsoft’s Entity Framework and explains how it can used to build enterprise level applications. It will also teach you how you can work with RESTful Services and Google’s Protocol Buffers with Entity Framework and WCF. You will explore how to use Entity Framework with ASP.NET Web API and also how to consume the data exposed by Entity Framework from client applications of varying types, i.e., ASP.NET MVC, WPF and Silverlight. You will familiarize yourself with the new features and improvements introduced in Entity Framework including enhanced POCO support, template-based code generation, tooling consolidation and connection resiliency. By the end of the book, you will be able to successfully extend the new functionalities of Entity framework into your project.
Table of Contents (16 chapters)
Entity Framework Tutorial Second Edition
About the Author
About the Reviewers

Chapter 1. Introducing the ADO.NET Entity Framework

Welcome to our journey into mastering the popular data access technology from Microsoft named Entity Framework. At the time of writing, Entity Framework 7 hasn't been released—so we will use Entity Framework 6.x throughout this book but at the same time discuss what's new in Entity Framework 7.

Object Relational Mapping (ORM) technology has been widely in use for over a decade. ORMs are used to convert data between incompatible type systems. These are tools that encapsulate calls to the underlying database and enable you to query and manipulate data using an object-oriented paradigm.

The figure that follows illustrates the persistence layer that is responsible for reading and manipulating data to and from the database. Now, this persistence layer can be your ADO.NET library, a wrapper around the ADO.NET library, or an ORM:

We will explore more on ORMs later in this chapter. The ADO.NET Entity Framework (EF) is an extended and open source ORM technology from Microsoft that abstracts the object model of an application from its relational or logical model. That is, it isolates the object model from the way the data is actually represented in the relational store. This framework makes the conceptual model real by using an extended entity relationship model called the ADO.NET Entity Data Model. In this book, we will examine Entity Framework 6 in order to leverage its existing and enhanced features to design and implement applications that are robust, high-performing, persistence, ignorant, and scalable. We will explore each of these features as we read through the chapters of this book.

This chapter will give you an introduction to Entity Framework and also provide you with a brief understanding of the related terminologies. We will revisit each of the Entity Framework architectural components as we progress through this book. Our journey through Entity Framework 6 has just begun!

In this chapter, we will cover the following points:

  • An overview of Entity Framework

  • Entity Framework architectural components:

    • The Entity Data Model

    • LINQ to Entities

    • Entity Client

    • Entity SQL

    • The Object Services Layer

  • A comparative analysis of EF and other ORMs

  • New features and enhancements in Entity Framework 6:

    • Support for persistence ignorance

    • Support for T4 code generation

    • Support for lazy loading

    • Support for POCO change-tracking

    • Better n-tier support

    • Support for model-first and development

    • Support for built-in functions and UDF

    • Support for model-defined functions

    • Support for enums

    • Support for spatial data types

But, before we delve deep into this amazing technology from Microsoft, let's take a quick look at the prerequisites to learning the concepts covered in this book.