Entity Framework Core in Action
Jon Smith
  • MEAP began February 2017
  • Publication in Spring 2018 (estimated)
  • ISBN 9781617294563
  • 400 pages (estimated)
  • printed in black & white

Entity Framework Core is a complex library designed to make database access simple and easy. EF Core is an Object-Relational Mapper that works by mapping between the two worlds: the relational database with its own API and the object-oriented software world of classes and software code. EF Core allows software developers to write database access code really quickly. And it's multi-platform capable so it can run on Windows, Linux and Apple, and on Android via Microsoft's Xamarin. It does this as part of Microsoft's open source .NET Core initiative which includes ASP.NET Core, and .NET Core.

Table of Contents detailed table of contents

Part 1: Introduction to Entity Framework Core

1. Introduction to Entity Framework Core

1.1. What you will learn from this book

1.2. My "lightbulb moment" with EF

1.3. Some words for existing EF6.x developers

1.4. An overview of what EF Core is

1.4.1. The down sides of ORMs

1.5. What about NoSQL?

1.6. Introducing the book selling site example

1.7. Looking "under the hood" of EF Core

1.7.1. The data for our application

1.7.2. Modeling the database

1.7.3. Reading data from the database

1.7.4. Updating the database

1.8. Should I use EF Core in my next project?

1.8.1. Future-proof

1.8.2. Multi-platform and open-source

1.8.3. Rapid development

1.8.4. Well supported

1.8.6. Stable Library

1.8.7. Always high performance

1.8.8. Access to all .NET 4.6 libraries

1.9. When should you not use EF Core

1.10. Summary

2. Querying the database

2.1. Setting the scene — my book selling site example

2.1.1. Our book selling site relational database

2.1.2. The classes that EF Core maps to the database

2.2. Accessing EF Core code to try things out for yourself

2.2.1. Creating a .NET Core application with EF Core libraries

2.3. Creating the application's DbContext

2.3.1. Defining my application's DbContext: EfCoreContext

2.3.2. Creating an instance of my application's DbContext

2.3.3. Creating a database for your own application

2.4. Anatomy of a database query

2.4.1. Application's DbContext Property access

2.4.2. A series of LINQ/EF Core command

2.4.3. The execute command

2.5.1. Eager loading: loading relationships at the same time as loading main entity class

2.5.2. Explicit loading: loading relationships after loading the main entity class

2.5.3. Select loading: loading the specific parts of main entity class and any relationships together

2.6. Client vs. Server evaluation: moving part of your query into software

2.6.1. An example of using Client vs. Server evaluation to create the display string of s book's authors

2.6.2. Understanding the limitations of Client vs. Server evaluation

2.7. Building complex queries — the book selling site

2.7.1. Building the book list query using select loading

2.7.2. Introducing the architecture of the book selling site application

2.8. Adding Sorting, Filtering, and Paging to the book selling site

2.8.1. The sorting of books by price, publication date and customer ratings

2.8.2. The filtering of books by publication year and customer ratings

2.8.3. The paging of the books in the list

2.9. Putting it all together: how to combine query objects

2.10. Summary

3. Changing the database content

3.1. Creating new entries

3.1.1. Create a single entity on its own

3.1.2. Creating a book with its authors

3.2. The core commands for updating database entries

3.2.1. Handling updates in web application - the disconnected update

3.3. Handling relationships in updates

3.3.1. Principal and dependent relationships

3.3.2. Updating One-to-One relationships — adding a PriceOffer to a book

3.3.3. Updating One-to-Many relationships — adding a review to a book

3.3.4. Updating Many-to-Many relationships — changing a book's authors

3.3.5. Advanced feature — Updating relationships via foreign key

3.4. Deleting entities

3.4.1. Deleting a dependent-only entity — no relationships

3.4.2. Deleting a principal entity which has relationships

3.5. Summary

4. Using EF Core in Business Logic

5. Using EF Core in ASP.NET Core web applications

Part 2: Entity Framework Core In Depth

6. Modelling options for scalar properties

7. Modelling options for relationships

8. Going deeper into the DbContext

9. Handling database migrations

Part 3: Using Entity Framework in real-world applications

10. Patterns for using EF Core

11. Unit Testing EF Core applications

12. EF Core performance Tuning

13. Extending EF Core

Appendixes

Appendix A: A brief introduction to LINQ

About the book

Entity Framework Core in Action teaches developers how to add database functionality to .NET applications with EF Core. Part 1 starts with a clear introduction to what EF Core is and how it fits into your applications. Next, you'll get hands-on quickly by building a .NET application that uses a relational database with EF Core's default configuration. By the end of part 1 you will be able to build a well-structured application that uses EF Core for database access.

The second part of the book dives deeper and shows you how to change default settings as well as teaching you many EF Core commands. You'll learn how to create a database exactly the way you want it, as well as how to link to an existing database, and how to change the way database data is exposed inside your .NET application.

The last part is all about improving your skills and making you a better developer and debugger of EF Core applications. You'll learn from real-world applications of EF Core starting with a range of known patterns and practices that you can use, extending ER Core, and how to find and fix EF Core performance issues. Software developers who have never used Entity Framework and seasoned EF6.x developers, as well as anyone who wants to know what EF Core is capable of will find this book great at deepening their knowledge and making them more productive with EF Core.

What's inside

  • Querying a database
  • Creating, updating and deleting data
  • Using EF Core in business logic
  • Building a .NET web application EF Core

About the reader

This book assumes readers are familiar with .NET development and some understanding of what relational databases are. No experience with SQL needed.

About the author

Jon Smith is a full-stack software developer and architect who focuses on Microsoft's ASP.NET web applications using Entity Framework (EF) ORM on the server-side, with various front-end JavaScript libraries. Jon is especially interested in defining patterns and building libraries that improve the speed of development of ASP.NET web/database applications.


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.
Buy
MEAP combo $49.99 pBook + eBook
MEAP eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks