Entity Framework Core in Action, Second Edition
Jon P Smith
  • MEAP began May 2020
  • Publication in Spring 2021 (estimated)
  • ISBN 9781617298363
  • 575 pages (estimated)
  • printed in black & white
free previous edition eBook included
An eBook copy of the previous edition of this book is included at no additional cost. It will be automatically added to your Manning Bookshelf within 24 hours of purchase.

Need a good introduction into EF Core? Get this one, it's the best I've read.

Thomas Gueth
Entity Framework Core in Action, Second Edition is an in-depth guide to reading and writing databases with EF Core. Revised from the bestselling original edition, it’s filled with over 100 diagrams, code snippets, and examples—including building and scaling your own bookselling web application. Learn from author Jon Smith’s extensive experience working with EF Core in production, as you discover time-saving patterns and best practices for security, performance tuning, unit testing, and all the book’s code is available on GitHub.

About the Technology

Entity Framework Core is an object-relational mapper (ORM) that bridges the gap between your C# code and the commands required to access relational databases. As Microsoft’s recommended data access technology, it automatically maps your classes and code to the tables and views of a database—making it radically easier to query and write to databases from a .NET application. It allows you to query and write to your database using standard LINQ commands, and it will even automatically generate the model from your database schema. Now that .NET Core 5 is Microsoft’s primary development system, it’s never been more important to master Entity Framework Core.

About the book

Entity Framework Core in Action, Second Edition is a comprehensive guide to accessing databases from .NET applications. Updated and upgraded with new content, new diagrams, and new examples, this second edition of the bestselling original begins with a clear breakdown of Entity Framework, along with the mental model behind ORM. You’ll discover time-saving patterns and best practices for security, performance tuning, and even unit testing, as well as tips and tricks developed by the author through their extensive experience working on different client applications. As you go, you’ll address common data access challenges and learn how to handle them with Entity Framework.
Table of Contents detailed table of contents

1 Introduction to Entity Framework Core

1.1 What you’ll learn from this book

1.2 My “lightbulb moment” with Entity Framework

1.3 Some words for existing EF6.x developers

1.4 An overview of EF Core

1.4.1 The downsides of O/RMs

1.5 What about NoSQL?

1.6 Your first EF Core application

1.6.1 What you need to install

1.6.2 Creating your own .NET Core console app with EF Core

1.7 The database that MyFirstEfCoreApp will access

1.8 Setting up the MyFirstEfCoreApp application

1.8.1 The classes that map to the database—Book and Author

1.8.2 The application’s DbContext

1.9 Looking under the hood of EF Core

1.9.1 Modeling the database

1.9.2 Reading data from the database

1.9.3 Updating the database

1.10 The stages of development of EF Core

1.11 Should you use EF Core in your next project?

1.11.1 .NET 5 is the Future, and its fast!

1.11.2 Open source and open communication

1.11.3 Multi-platform applications and development

1.11.4 Rapid development, and good features

1.11.5 Well supported

1.11.6 Always high-performance

1.12 When should you not use EF Core?

1.13 Summary

2 Querying the database

2.1 Setting the scene—our book-selling site

2.1.1 The book app’s relational database

2.1.2 Other relationship types not covered in this chapter

2.1.3 The database showing all the tables

2.1.4 The classes that EF Core maps to the database

2.2 Creating the application’s DbContext

2.2.1 Defining the application’s DbContext: EfCoreContext

2.2.2 Creating an instance of the application’s DbContext

2.2.3 Creating a database for your own application

2.3 Understanding database queries

2.3.1 Application’s DbContext property access

2.3.2 A series of LINQ/EF Core commands

2.3.3 The execute command

2.3.4 The two types of database queries

2.4.1 Eager loading: loading relationships with the primary entity class

2.4.2 Explicit loading: loading relationships after the primary entity class

2.4.3 Select loading: loading specific parts of primary entity class and any relationships

2.4.4 Lazy loading: loading relationships as required

2.5 Using client vs. server evaluation: adapting data at the last stage of a query

2.5.1 Creating the display string of a book’s authors

2.6 Building complex queries

2.6.1 Introducing the architecture of the book app

2.7 Adding sorting, filtering, and paging

2.7.1 Sorting books by price, publication date, and customer ratings

2.7.2 Filtering books by publication year and customer ratings

2.7.3 Paging the books in the list

2.8 Putting it all together: combining Query Objects

2.9 Summary

3 Changing the database content

3.1 Introducing EF Core’s entity State

3.2 Creating new rows in a table

3.2.1 Creating a single entity on its own

3.2.2 Creating a book with a review

3.3 Updating database rows

3.3.1 Handling disconnected updates in a web application

3.4 Handling relationships in updates

3.4.1 Principal and dependent relationships

3.4.2 Updating one-to-one relationships—adding a PriceOffer to a book

3.4.3 Updating one-to-many relationships—adding a review to a book

3.4.4 Updating many-to-many relationships—changing a book’s authors

3.4.5 Advanced feature—updating relationships via foreign keys

3.5 Deleting entities

3.5.1 Using a soft delete—using a global query filter to “hide” entities

3.5.2 Deleting a dependent-only entity—no relationships

3.5.3 Deleting a principal entity that has relationships

3.6 Summary

4 Using EF Core in business logic

5 Using EF Core in ASP.NET Core web applications

6 Tips and techniques for reading and writing with EF Core

7 Configuring nonrelational properties

8 Configuring relationships

9 Handling database migrations

10 Configuring advanced features and handling concurrency conflicts

11 Going deeper into the DbContext

12 Using an event-driven design with EF Core

13 Domain-Driven Design and other architectural approaches

==14 EF Core performance tuning

15 A worked example of performance tuning

16 Different database types and Cosmos DB

17 Unit testing EF Core applications


Appendix A: A brief introduction to LINQ

What's inside

  • Read and write databases with Entity Framework Core
  • Configure EF Core to define every table and column in your database
  • Update your schema as your app grows
  • Using EF Core with ASP.NET Core web applications
  • Write and test business logic for database access
  • Looking at different architectures to use with EF Core

About the reader

For .NET developers with beginning-to-intermediate experience using relational databases.

About the author

Jon P. Smith is an independent principal software developer and architect with a special focus on .NET Core and Azure. He mainly works on the back-end of client applications, typically using EF Core and ASP.NET Core web applications. He is a working developer with clients from the USA and UK, typically designing and writing large sections of an application.

placing your order...

Don't refresh or navigate away from the page.
Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
print book $35.99 $59.99 pBook + eBook + liveBook
includes previous edition eBook
Additional shipping charges may apply
Entity Framework Core in Action, Second Edition (print book) added to cart
continue shopping
go to cart

eBook $33.59 $47.99 3 formats + liveBook
includes previous edition eBook
Entity Framework Core in Action, Second Edition (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks