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

Exploring the Security EDM

The EDM allows the application to have its own view of the application's data. Consider the following EDM created using the Visual Studio 2015 ADO.NET EDM Wizard:

The Security Entity Data Model

Note that the relationships and the respective fields are displayed along with their multiplicity. You can also see the scalar and navigation properties. While the Scalar Properties section lists the attributes or the fields of the entity, the Navigation Properties are those that denote the associations of a particular entity with other entities.

As an example, the UserRole entity uses the User and the Role entities to relate its foreign keys UserID and RoleID respectively. This is also called a join table and facilitates a many-to-many relationship.

The Mapping Details window

Now we will take a look at the mappings details. That is, how the properties of the entities are mapped to the underlying database.

To do this, select any entity in the Security DataModel in the design...