Leanpub Header

Skip to main content

DIVING into MICROSOFT .NET ENTITY FRAMEWORK

A Practical Approach of Learning Entity Framework

Learn Microsoft Entity Framework and Entity Framework Core Step by Step.

Minimum price

$7.99

$9.99

You pay

$9.99

Author earns

$7.99
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
About

About

About the Book

The intent of this book is to explain the basics of Entity Framework and the three data access approaches that Microsoft’s Entity Framework provides. This book covers the introduction to Entity Framework, how Entity Framework’s capabilities could be leveraged in .Net development irrespective of the type of application used, the key features of Entity Framework, what are the areas where Entity Framework could be used as an ORM and the history of Entity Framework. The book talks about various data access techniques that could be achieved using Entity Framework and use of code first migrations in Entity Framework. The querying options and various loading options of Entity Framework are explained with examples. The book also talks about the introduction to Entity Framework Core and its implementation details. The book would be more practical in nature thereby covering a less of theory and explaining the data access approaches in Entity Framework 6 and Entity Framework Core in any .Net application. The book chapters are in a tutorial format and showcase small data access applications using Entity Framework for the sake of understanding the concept. Once the concept and key capabilities of Entity Framework and Entity Framework Core are understood, those could be applied in any application based on need and requirement.

Share this book

Categories

Author

About the Author

Akhil Mittal

Akhil Mittal is two times Microsoft MVP (Most Valuable Professional), C# Corner MVP, Codeproject MVP, a blogger, author and likes to write/read technical articles. Akhil has an experience of around 12 years in developing, designing, architecting enterprises level applications primarily in Microsoft Technologies. Akhil enjoys working on technologies like MVC, Web API, Entity Framework, Angular, C#, and Blockchain. Akhil is an MCP (Microsoft Certified Professional) in Web Applications and Dot Net Framework. Visit Akhil Mittal’s personal blog CodeTeddy (https://codeteddy.com) for some good and informative articles.

Contents

Table of Contents

What is Entity Framework. 9

Why Entity Framework. 11

Relational Model and Object Model 12

Entity Framework Architecture. 17

Entity Framework Approaches. 21

Model First. 23

Database First. 23

Code First. 24

Entity Framework Approaches in Action. 25

Model First. 25

Database First. 59

Code First. 73

Code First Options. 93

CreateDatabaseIfNotExists. 93

DropCreateDatabaseWhenModelChanges. 93

DropCreateDatabaseAlways. 93

Code First Migrations. 95

Code First Migrations in Action. 95

MigrationHistory Table. 112

Querying in Entity Framework. 114

LINQ to SQL. 114

Entity SQL. 114

Native SQL. 115

Loadings in Entity Framework. 116

Lazy Loading. 116

Eager Loading. 118

Explicit Loading. 118

Code First Migrations in ASP.NET Web API 2.0. 120

Web API 120

Creating a Web API Project. 120

Creating the model 124

Adding the API Controller. 128

Entity Framework Code First Migrations. 138

Exploring the Generated Database. 149

Running the application and Setup Postman. 153

Endpoints and Database operations. 157

GET. 158

POST. 161

PUT. 165

DELETE. 169

Entity Framework Core. 172

Where can EF Core be Used. 173

Code First Approach using Entity Framework Core. 174

Adding Entities. 174

Data Annotations. 177

Adding DB Context. 183

Code First Migrations in EF Core. 195

Seeding the Database. 211

EF Core Summary. 217

Conclusion. 218

References. 220

Index. 221

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub