Book Image

Entity Framework Tutorial

By : Joydip Kanjilal
Book Image

Entity Framework Tutorial

By: Joydip Kanjilal

Overview of this book

<p>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.<br /><br />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.<br /><br />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.</p>
Table of Contents (13 chapters)
Entity Framework Tutorial
Credits
About the Author
About the Reviewer
Preface

Creating an Entity Data Model


You can create the ADO.NET Entity Data Model in one of two ways:

  • Use the ADO.NET Entity Data Model Designer

  • Use the command line Entity Data Model Designer called EdmGen.exe

We will first take a look at how we can design an Entity Data Model using the ADO.NET Entity Data Model Designer which is a Visual Studio wizard that is enabled after you install ADO.NET Entity Framework and its tools. It provides a graphical interface that you can use to generate an Entity Data Model.

Creating the Payroll Entity Data Model Using the ADO.NET Entity Data Model Designer

Here again are the tables of our Payroll database that we will use to generate the data model:

  • Employee

  • Designation

  • Department

  • Salary

  • ProvidentFund

To create an entity data model using the ADO.NET Entity Data Model Designer, follow these simple steps:

  1. 1. Open Visual Studio.NET and create a solution for a new web application project as seen below and save with a name.

  2. 2. Switch to the Solution Explorer, right click and...