Entity Framework Core in Action [2 ed.]
1617298360, 9781617298363
Entity Framework Core in Action, Second Edition is an in-depth guide to reading and writing databases with EF Core. Revi
675
76
10MB
English
Pages 624
Year 2021
Report DMCA / Copyright
DOWNLOAD EPUB FILE
Table of contents :
Entity Framework Core in Action
contents
foreword
preface
acknowledgments
about this book
Who should read this book?
How this book is organized
About the code
Code conventions
liveBook discussion forum
Online resources
about the author
about the cover illustration
Part 1—Getting started
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 is the future software platform, and it’s fast!
1.11.2 Open source and open communication
1.11.3 Multiplatform 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?
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 Loading related data
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.6 Building complex queries
2.7 Introducing the architecture of the Book App
2.8 Adding sorting, filtering, and paging
2.8.1 Sorting books by price, publication date, and customer ratings
2.8.2 Filtering books by publication year, categories, and customer ratings
2.8.3 Other filtering options: Searching text for a specific string
2.8.4 Paging the books in the list
2.9 Putting it all together: Combining Query Objects
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 a many-to-many relationship
3.4.5 Advanced feature: Updating relationships via foreign keys
3.5 Deleting entities
3.5.1 Soft-delete approach: Using a global query filter to hide entities
3.5.2 Deleting a dependent-only entity with no relationships
3.5.3 Deleting a principal entity that has relationships
3.5.4 Deleting a book with its dependent relationships
Summary
4 Using EF Core in business logic
4.1 The questions to ask and the decisions you need to make before you start coding
4.1.1 The three levels of complexity of your business logic code
4.2 Complex business logic example: Processing an order for books
4.3 Using a design pattern to implement complex business logic
4.3.1 Five guidelines for building business logic that uses EF Core
4.4 Implementing the business logic for processing an order
4.4.1 Guideline 1: Business logic has first call on defining the database structure
4.4.2 Guideline 2: Business logic should have no distractions
4.4.3 Guideline 3: Business logic should think that it’s working on in-memory data
4.4.4 Guideline 4: Isolate the database access code into a separate project
4.4.5 Guideline 5: Business logic shouldn’t call EF Core’s SaveChanges
4.4.6 Putting it all together: Calling the order-processing business logic
4.4.7 Placing an order in the Book App
4.4.8 The pros and cons of the complex business logic pattern
4.5 Simple business logic example: ChangePriceOfferService
4.5.1 My design approach for simple business logic
4.5.2 Writing the ChangePriceOfferService code
4.5.3 The pros and cons of this business logic pattern
4.6 Validation business logic example: Adding review to a book, with checks
4.6.1 The pros and cons of this business logic pattern
4.7 Adding extra features to your business logic handling
4.7.1 Validating the data that you write to the database
4.7.2 Using transactions to daisy-chain a sequence of business logic code
4.7.3 Using the RunnerTransact2WriteDb class
Summary
5 Using EF Core in ASP.NET Core web applications
5.1 Introducing ASP.NET Core
5.2 Understanding the architecture of the Book App
5.3 Understanding dependency injection
5.3.1 Why you need to learn about DI in ASP.NET Core
5.3.2 A basic example of dependency injection in ASP.NET Core
5.3.3 The lifetime of a service created by DI
5.3.4 Special considerations for Blazor Server applications
5.4 Making the application’s DbContext available via DI
5.4.1 Providing information on the database’s location
5.4.2 Registering your application’s DbContext with the DI provider
5.4.3 Registering a DbContext Factory with the DI provider
5.5 Calling your database access code from ASP.NET Core
5.5.1 A summary of how ASP.NET Core MVC works and the terms it uses
5.5.2 Where does the EF Core code live in the Book App?
5.6 Implementing the book list query page
5.6.1 Injecting an instance of the application’s DbContext via DI
5.6.2 Using the DbContext Factory to create an instance of a DbContext
5.7 Implementing your database methods as a DI service
5.7.1 Registering your class as a DI service
5.7.2 Injecting ChangePubDateService into the ASP.NET action method
5.7.3 Improving registering your database access classes as services
5.8 Deploying an ASP.NET Core application with a database
5.8.1 Knowing where the database is on the web server
5.8.2 Creating and migrating the database
5.9 Using EF Core’s migration feature to change the database’s structure
5.9.1 Updating your production database
5.9.2 Having your application migrate your database on startup
5.10 Using async/await for better scalability
5.10.1 Why async/await is useful in a web application using EF Core
5.10.2 Where should you use async/await with database accesses?
5.10.3 Changing over to async/await versions of EF Core commands
5.11 Running parallel tasks: How to provide the DbContext
5.11.1 Obtaining an instance of your application’s DbContext to run in parallel
5.11.2 Running a background service in ASP.NET Core
5.11.3 Other ways of obtaining a new instance of the application’s DbContext
Summary
6 Tips and techniques for reading and writing with EF Core
6.1 Reading from the database
6.1.1 Exploring the relational fixup stage in a query
6.1.2 Understanding what AsNoTracking and its variant do
6.1.3 Reading in hierarchical data efficiently
6.1.4 Understanding how the Include method works
6.1.5 Making loading navigational collections fail-safe
6.1.6 Using Global Query Filters in real-world situations
6.1.7 Considering LINQ commands that need special attention
6.1.8 Using AutoMapper to automate building Select queries
6.1.9 Evaluating how EF Core creates an entity class when reading data in
6.2 Writing to the database with EF Core
6.2.1 Evaluating how EF Core writes entities/relationships to the database
6.2.2 Evaluating how DbContext handles writing out entities/relationships
6.2.3 A quick way to copy data with relationships
6.2.4 A quick way to delete an entity
Summary
Part 2—Entity Framework in depth
7 Configuring nonrelational properties
7.1 Three ways of configuring EF Core
7.2 A worked example of configuring EF Core
7.3 Configuring by convention
7.3.1 Conventions for entity classes
7.3.2 Conventions for parameters in an entity class
7.3.3 Conventions for name, type, and size
7.3.4 By convention, the nullability of a property is based on .NET type
7.3.5 An EF Core naming convention identifies primary keys
7.4 Configuring via Data Annotations
7.4.1 Using annotations from System.ComponentModel.DataAnnotations
7.4.2 Using annotations from System.ComponentModel.DataAnnotations.Schema
7.5 Configuring via the Fluent API
7.6 Excluding properties and classes from the database
7.6.1 Excluding a class or property via Data Annotations
7.6.2 Excluding a class or property via the Fluent API
7.7 Setting database column type, size, and nullability
7.8 Value conversions: Changing data to/from the database
7.9 The different ways of configuring the primary key
7.9.1 Configuring a primary key via Data Annotations
7.9.2 Configuring a primary key via the Fluent API
7.9.3 Configuring an entity as read-only
7.10 Adding indexes to database columns
7.11 Configuring the naming on the database side
7.11.1 Configuring table names
7.11.2 Configuring the schema name and schema groupings
7.11.3 Configuring the database column names in a table
7.12 Configuring Global Query Filters
7.13 Applying Fluent API commands based on the database provider type
7.14 Shadow properties: Hiding column data inside EF Core
7.14.1 Configuring shadow properties
7.14.2 Accessing shadow properties
7.15 Backing fields: Controlling access to data in an entity class
7.15.1 Creating a simple backing field accessed by a read/write property
7.15.2 Creating a read-only column
7.15.3 Concealing a person’s date of birth: Hiding data inside a class
7.15.4 Configuring backing fields
7.16 Recommendations for using EF Core’s configuration
7.16.1 Use By Convention configuration first
7.16.2 Use validation Data Annotations wherever possible
7.16.3 Use the Fluent API for anything else
7.16.4 Automate adding Fluent API commands by class/property signatures
Summary
8 Configuring relationships
8.1 Defining some relationship terms
8.2 What navigational properties do you need?
8.3 Configuring relationships
8.4 Configuring relationships By Convention
8.4.1 What makes a class an entity class?
8.4.2 An example of an entity class with navigational properties
8.4.3 How EF Core finds foreign keys By Convention
8.4.4 Nullability of foreign keys: Required or optional dependent relationships
8.4.5 Foreign keys: What happens if you leave them out?
8.4.6 When does By Convention configuration not work?
8.5 Configuring relationships by using Data Annotations
8.5.1 The ForeignKey Data Annotation
8.5.2 The InverseProperty Data Annotation
8.6 Fluent API relationship configuration commands
8.6.1 Creating a one-to-one relationship
8.6.2 Creating a one-to-many relationship
8.6.3 Creating a many-to-many relationship
8.7 Controlling updates to collection navigational properties
8.8 Additional methods available in Fluent API relationships
8.8.1 OnDelete: Changing the delete action of a dependent entity
8.8.2 IsRequired: Defining the nullability of the foreign key
8.8.3 HasPrincipalKey: Using an alternate unique key
8.8.4 Less-used options in Fluent API relationships
8.9 Alternative ways of mapping entities to database tables
8.9.1 Owned types: Adding a normal class into an entity class
8.9.2 Table per hierarchy (TPH): Placing inherited classes into one table
8.9.3 Table per Type (TPT): Each class has its own table
8.9.4 Table splitting: Mapping multiple entity classes to the same table
8.9.5 Property bag: Using a dictionary as an entity class
Summary
9 Handling database migrations
9.1 How this chapter is organized
9.2 Understanding the complexities of changing your application’s database
9.2.1 A view of what databases need updating
9.2.2 Handling a migration that can lose data
9.3 Part 1: Introducing the three approaches to creating a migration
9.4 Creating a migration by using EF Core’s add migration command
9.4.1 Requirements before running any EF Core migration command
9.4.2 Running the add migration command
9.4.3 Seeding your database via an EF Core migration
9.4.4 Handling EF Core migrations with multiple developers
9.4.5 Using a custom migration table to allow multiple DbContexts to one database
9.5 Editing an EF Core migration to handle complex situations
9.5.1 Adding and removing MigrationBuilder methods inside the migration class
9.5.2 Adding SQL commands to a migration
9.5.3 Adding your own custom migration commands
9.5.4 Altering a migration to work for multiple database types
9.6 Using SQL scripts to build migrations
9.6.1 Using SQL database comparison tools to produce migration
9.6.2 Handcoding SQL change scripts to migrate the database
9.6.3 Checking that your SQL change scripts matches EF Core’s database model
9.7 Using EF Core’s reverse-engineering tool
9.7.1 Running EF Core’s reverse-engineering command
9.7.2 Installing and running EF Core Power Tools reverse-engineering command
9.7.3 Updating your entity classes and DbContext when the database changes
9.8 Part 2: Applying your migrations to a database
9.8.1 Calling EF Core’s Database.Migrate method from your main application
9.8.2 Executing EF Core’s Database.Migrate method from a standalone application
9.8.3 Applying an EF Core’s migration via an SQL change script
9.8.4 Applying SQL change scripts by using a migration tool
9.9 Migrating a database while the application is running
9.9.1 Handling a migration that doesn’t contain an application-breaking change
9.9.2 Handling application-breaking changes when you can’t stop the app
Summary
10 Configuring advanced features and handling concurrency conflicts
10.1 DbFunction: Using user-defined functions (UDFs) with EF Core
10.1.1 Configuring a scalar-valued UDF
10.1.2 Configuring a table-valued UDF
10.1.3 Adding your UDF code to the database
10.1.4 Using a registered UDF in your database queries
10.2 Computed column: A dynamically calculated column value
10.3 Setting a default value for a database column
10.3.1 Using the HasDefaultValue method to add a constant value for a column
10.3.2 Using the HasDefaultValueSql method to add an SQL command for a column
10.3.3 Using the HasValueGenerator method to assign a value generator to a property
10.4 Sequences: Providing numbers in a strict order
10.5 Marking database-generated properties
10.5.1 Marking a column that’s generated on an addition or update
10.5.2 Marking a column’s value as set on insert of a new row
10.5.3 Marking a column/property as “normal”
10.6 Handling simultaneous updates: Concurrency conflicts
10.6.1 Why do concurrency conflicts matter?
10.6.2 EF Core’s concurrency conflict–handling features
10.6.3 Handling a DbUpdateConcurrencyException
10.6.4 The disconnected concurrent update issue
Summary
11 Going deeper into the DbContext
11.1 Overview of the DbContext class’s properties
11.2 Understanding how EF Core tracks changes
11.3 Looking at commands that change an entity’s State
11.3.1 The Add command: Inserting a new row into the database
11.3.2 The Remove method: Deleting a row from the database
11.3.3 Modifying an entity class by changing the data in that entity class
11.3.4 Modifying an entity class by calling the Update method
11.3.5 The Attach method: Start tracking an existing untracked entity class
11.3.6 Setting the State of an entity directly
11.3.7 TrackGraph: Handling disconnected updates with relationships
11.4 SaveChanges and its use of ChangeTracker.DetectChanges
11.4.1 How SaveChanges finds all the State changes
11.4.2 What to do if ChangeTracker.DetectChanges is taking too long
11.4.3 Using the entities’ State within the SaveChanges method
11.4.4 Catching entity class’s State changes via events
11.4.5 Triggering events when SaveChanges/SaveChangesAsync is called
11.4.6 EF Core interceptors
11.5 Using SQL commands in an EF Core application
11.5.1 FromSqlRaw/FromSqlInterpolated: Using SQL in an EF Core query
11.5.2 ExecuteSqlRaw/ExecuteSqlInterpolated: Executing a nonquery command
11.5.3 AsSqlQuery Fluent API method: Mapping entity classes to queries
11.5.4 Reload: Used after ExecuteSql commands
11.5.5 GetDbConnection: Running your own SQL commands
11.6 Accessing information about the entity classes and database tables
11.6.1 Using context.Entry(entity).Metadata to reset primary keys
11.6.2 Using context.Model to get database information
11.7 Dynamically changing the DbContext’s connection string
11.8 Handling database connection problems
11.8.1 Handling database transactions with EF Core’s execution strategy
11.8.2 Altering or writing your own execution strategy
Summary
Part 3—Using Entity Framework Core in real-world applications
12 Using entity events to solve business problems
12.1 Using events to solve business problems
12.1.1 Example of using domain events
12.1.2 Example of integration events
12.2 Defining where domain events and integration events are useful
12.3 Where might you use events with EF Core?
12.3.1 Pro: Follows the SoC design principle
12.3.2 Pro: Makes database updates robust
12.3.3 Con: Makes your application more complex
12.3.4 Con: Makes following the flow of the code more difficult
12.4 Implementing a domain event system with EF Core
12.4.1 Create some domain events classes to be triggered
12.4.2 Add code to the entity classes to hold the domain events
12.4.3 Alter the entity class to detect a change to trigger an event on
12.4.4 Create event handlers that are matched to the domain events
12.4.5 Build an Event Runner that finds and runs the correct event handler
12.4.6 Override SaveChanges and insert the Event Runner before SaveChanges is called
12.4.7 Register the Event Runner and all the event handlers
12.5 Implementing an integration event system with EF Core
12.5.1 Building a service that communicates with the warehouse
12.5.2 Overriding SaveChanges to handle the integration event
12.6 Improving the domain event and integration event implementations
12.6.1 Generalizing events: Running before, during, and after the call to SaveChanges
12.6.2 Adding support for async event handlers
12.6.3 Handling multiple event handers for the same event
12.6.4 Handling event sagas in which one event kicks off another event
Summary
13 Domain-Driven Design and other architectural approaches
13.1 A good software architecture makes it easier to build and maintain your application
13.2 The Book App’s evolving architecture
13.2.1 Building a modular monolith to enforce the SoC principles
13.2.2 Using DDD principles both architecturally and on the entity classes
13.2.3 Applying a clean architecture as described by Robert C. Martin
13.3 Introduction to DDD at the entity class level
13.4 Altering the Book App entities to follow the DDD approach
13.4.1 Changing the properties in the Book entity to read-only
13.4.2 Updating the Book entity properties via methods in the entity class
13.4.3 Controlling how the Book entity is created
13.4.4 Understanding the differences between an entity and a value object
13.4.5 Minimizing the relationships between entity classes
13.4.6 Grouping entity classes
13.4.7 Deciding when the business logic shouldn’t be run inside an entity
13.4.8 Applying DDD’s bounded context to your application’s DbContext
13.5 Using your DDD-styled entity classes in your application
13.5.1 Calling the AddPromotion access method via a repository pattern
13.5.2 Calling the AddPromotion access method via a class-to-method-call library
13.5.3 Adding a Review to the Book entity class via a repository pattern
13.5.4 Adding a Review to the Book entity class via a class-to-method-call library
13.6 The downside of DDD entities: Too many access methods
13.7 Getting around performance issues in DDD-styled entities
13.7.1 Allow database code into your entity classes
13.7.2 Make the Review constructor public and write nonentity code to add a Review
13.7.3 Use domain events to ask an event handler to add a review to the database
13.8 Three architectural approaches: Did they work?
13.8.1 A modular monolith approach that enforces SoC by using projects
13.8.2 DDD principles, both architecturally and on the entity classes
13.8.3 Clean architecture as described by Robert C. Martin
Summary
14 EF Core performance tuning
14.1 Part 1: Deciding which performance issues to fix
14.1.1 “Don’t performance-tune too early” doesn’t mean you stop thinking
14.1.2 How do you decide what’s slow and needs performance tuning?
14.1.3 The cost of finding and fixing performance issues
14.2 Part 2: Techniques for diagnosing a performance issue
14.2.1 Stage 1: Get a good overview, measuring the user’s experience
14.2.2 Stage 2: Find all the database code involved in the feature you’re tuning
14.2.3 Stage 3: Inspect the SQL code to find poor performance
14.3 Part 3: Techniques for fixing performance issues
14.4 Using good patterns makes your application perform well
14.4.1 Using Select loading to load only the columns you need
14.4.2 Using paging and/or filtering of searches to reduce the rows you load
14.4.3 Warning: Lazy loading will affect database performance
14.4.4 Always adding the AsNoTracking method to read-only queries
14.4.5 Using the async version of EF Core commands to improve scalability
14.4.6 Ensuring that your database access code is isolated/decoupled
14.5 Performance antipatterns: Database queries
14.5.1 Antipattern: Not minimizing the number of calls to the database
14.5.2 Antipattern: Missing indexes from a property that you want to search on
14.5.3 Antipattern: Not using the fastest way to load a single entity
14.5.4 Antipattern: Allowing too much of a data query to be moved into the software side
14.5.5 Antipattern: Not moving calculations into the database
14.5.6 Antipattern: Not replacing suboptimal SQL in a LINQ query
14.5.7 Antipattern: Not precompiling frequently used queries
14.6 Performance antipatterns: Writes
14.6.1 Antipattern: Calling SaveChanges multiple times
14.6.2 Antipattern: Making DetectChanges work too hard
14.6.3 Antipattern: Not using HashSet for navigational collection properties
14.6.4 Antipattern: Using the Update method when you want to change only part of the entity
14.6.5 Antipattern: Startup issue—Using one large DbContext
14.7 Performance patterns: Scalability of database accesses
14.7.1 Using pooling to reduce the cost of a new application’s DbContext
14.7.2 Adding scalability with little effect on overall speed
14.7.3 Helping your database scalability by making your queries simple
14.7.4 Scaling up the database server
14.7.5 Picking the right architecture for applications that need high scalability
Summary
15 Master class on performance-tuning database queries
15.1 The test setup and a summary of the four performance approaches
15.2 Good LINQ approach: Using an EF Core Select query
15.3 LINQ+UDFs approach: Adding some SQL to your LINQ code
15.4 SQL+Dapper: Creating your own SQL
15.5 LINQ+caching approach: Precalculating costly query parts
15.5.1 Adding a way to detect changes that affect the cached values
15.5.2 Adding code to update the cached values
15.5.3 Adding cache properties to the Book entity with concurrency handling
15.5.4 Adding a checking/healing system to your event system
15.6 Comparing the four performance approaches with development effort
15.7 Improving database scalability
Summary
16 Cosmos DB, CQRS, and other database types
16.1 The differences between relational and NoSQL databases
16.2 Introduction to Cosmos DB and its EF Core provider
16.3 Building a Command and Query Responsibility Segregation (CQRS) system using Cosmos DB
16.4 The design of a two-database CQRS architecture application
16.4.1 Creating an event to trigger when the SQL Book entity changes
16.4.2 Adding events to the Book entity send integration events
16.4.3 Using the EfCore.GenericEventRunner to override your BookDbContext
16.4.4 Creating the Cosmos entity classes and DbContext
16.4.5 Creating the Cosmos event handlers
16.5 Understanding the structure and data of a Cosmos DB account
16.5.1 The Cosmos DB structure as seen from EF Core
16.5.2 How the CosmosClass is stored in Cosmos DB
16.6 Displaying books via Cosmos DB
16.6.1 Cosmos DB differences from relational databases
16.6.2 Cosmos DB/EF Core difference: Migrating a Cosmos database
16.6.3 EF Core 5 Cosmos DB database provider limitations
16.7 Was using Cosmos DB worth the effort? Yes!
16.7.1 Evaluating the performance of the two-database CQRS in the Book App
16.7.2 Fixing the features that EF Core 5 Cosmos DB database provider couldn’t handle
16.7.3 How difficult would it be to use this two-database CQRS design in your application?
16.8 Differences in other database types
Summary
17 Unit testing EF Core applications
17.1 An introduction to the unit test setup
17.1.1 The test environment: xUnit unit test library
17.1.2 A library I created to help with unit testing EF Core applications
17.2 Getting your application’s DbContext ready for unit testing
17.2.1 The application’s DbContext options are provided via its constructor
17.2.2 Setting an application’s DbContext options via OnConfiguring
17.3 Three ways to simulate the database when testing EF Core applications
17.4 Choosing between a production-type database and an SQLite in-memory database
17.5 Using a production-type database in your unit tests
17.5.1 Providing a connection string to the database to use for the unit test
17.5.2 Providing a database per test class to allow xUnit to run tests in parallel
17.5.3 Making sure that the database’s schema is up to date and the database is empty
17.5.4 Mimicking the database setup that EF Core migration would deliver
17.6 Using an SQLite in-memory database for unit testing
17.7 Stubbing or mocking an EF Core database
17.8 Unit testing a Cosmos DB database
17.9 Seeding a database with test data to test your code correctly
17.10 Solving the problem of one database access breaking another stage of your test
17.10.1 Test code using ChangeTracker.Clear in a disconnected state
17.10.2 Test code by using multiple DbContext instances in a disconnected state
17.11 Capturing the database commands sent to a database
17.11.1 Using the LogTo option extension to filter and capture EF Core logging
17.11.2 Using the ToQueryString method to show the SQL generated from a LINQ query
Summary
Appendix A—A brief introduction to LINQ
A.1 An introduction to the LINQ language
A.1.1 The two ways you can write LINQ queries
A.1.2 The data operations you can do with LINQ
A.2 Introduction to IQueryable type, and why it’s useful
A.2.1 Splitting up a complex LINQ query by using the IQueryable type
A.2.2 How EF Core translates IQueryable into database code
A.3 Querying an EF Core database by using LINQ
index
A
B
C
D
E
F
G
H
I
K
L
M
N
O
P
Q
R
S
T
U
V
W
X