Entity Framework Core in Action /
Using crystal-clear explanations, real-world examples, and around 100 diagrams, Entity Framework Core in Action teaches you how to access and update relational data from .NET applications. You'll start with a clear breakdown of Entity Framework, long with the mental model behind ORM. Then you...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Autor Corporativo: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Manning Publications,
2018.
|
Edición: | 1st edition. |
Temas: | |
Acceso en línea: | Texto completo (Requiere registro previo con correo institucional) |
Tabla de Contenidos:
- Intro
- Entity Framework Core in Action
- copyright
- contents
- front matter
- preface
- acknowledgments
- about this book
- Who should read this book
- How this book is organized
- About the code
- Code conventions
- Book forum
- Online resources
- about the author
- about the cover illustration
- Part 1. Getting started
- 1 Introduction to Entity FrameworkCore
- 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
- 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 Should you use EF Core in your next project?
- 1.10.1 Latest generation
- 1.10.2 Multiplatform and open source
- 1.10.3 Rapid development
- 1.10.4 Well supported
- 1.10.5 Access to NuGet libraries
- 1.10.6 Fully featured O/RM
- 1.10.7 Stable library
- 1.10.8 Always high-performance
- 1.11 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 final 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.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.5 Using client vs. server evaluation: moving part of your query into software
- 2.5.1 Creating the display string of a book's authors
- 2.5.2 Understanding the limitations of client vs. server evaluation
- 2.6 Building complex queries
- 2.6.1 Building the book list query by using select loading
- 2.6.2 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
- 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 model-level query filters to "hide" entities
- 3.5.2 Deleting a dependent-only entity-no relationships
- 3.5.3 Deleting a principal entity that has relationships
- Summary
- 4 Using EF Core in business logic
- 4.1 Why is business logic so different from other code?
- 4.2 Our business need-processing an order for books
- 4.2.1 The business rules that you need to implement
- 4.3 Using a design pattern to help implement 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 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 Any disadvantages of this business logic pattern?
- 4.5 Placing an order on the book app
- 4.6 Adding extra features to your business logic handling
- 4.6.1 Validating the data that you write to the database
- 4.6.2 Using transactions to daisy-chain a sequence of business logic code
- 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.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.5 Calling your database access code from ASP.NET Core
- 5.5.1 A summary of how ASP.NET Core 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.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 Migrate to change the database 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 Other ways of obtaining a new instance of the application's DbContext
- Summary
- Part 2. Entity Framework in depth
- 6 Configuring nonrelational properties
- 6.1 Three ways of configuring EF Core
- 6.2 A worked example of configuring EF Core
- 6.3 Configuring By Convention
- 6.3.1 Conventions for entity classes
- 6.3.2 Conventions for parameters in an entity class
- 6.3.3 Conventions for name, type, and size
- 6.3.4 By Convention, the nullability of a property is based on .NET type
- 6.3.5 An EF Core naming convention identifies primary keys
- 6.4 Configuring via Data Annotations
- 6.4.1 System.ComponentModel.DataAnnotations.
- 6.4.2 System.ComponentModel.DataAnnotations.Schema
- 6.5 Configuring via the Fluent API
- 6.5.1 A better way to structure your Fluent API commands
- 6.6 Excluding properties and classes from the database
- 6.6.1 Excluding a class or property via Data Annotations
- 6.6.2 Excluding a class or property via the Fluent API
- 6.7 Configuring model-level query filters
- 6.8 Setting database column type, size, and nullability
- 6.9 The different ways of configuring the primary key
- 6.9.1 Configuring a primary key via Data Annotations
- 6.9.2 Configuring a primary key via the Fluent API
- 6.10 Adding indexes to database columns
- 6.11 Configuring the naming on the database side
- 6.11.1 Configuring table names
- 6.11.2 Configuring the schema name, and schema groupings
- 6.11.3 Configuring the database column names in a table
- 6.12 Using specific database-provider Fluent API commands
- 6.13 Recommendations for using EF Core's configuration
- 6.13.1 Use By Convention configuration first-its quick and easy
- 6.13.2 Use validation Data Annotations wherever possible
- 6.13.3 Use the Fluent API for anything else
- 6.14 Shadow properties-hide column data inside EF Core
- 6.14.1 Configuring shadow properties
- 6.14.2 Accessing shadow properties
- 6.15 Backing fields-controlling access to data in an entity class
- 6.15.1 Creating a simple backing field accessed by a read/write property
- 6.15.2 Configuring backing fields
- Summary
- 7 Configuring relationships
- 7.1 Defining some relationship terms
- 7.2 What navigational properties do you need?
- 7.3 Configuring relationships
- 7.4 Configuring relationships By Convention
- 7.4.1 What makes a class an entity class?
- 7.4.2 An example of an entity class with navigational properties
- 7.4.3 How EF Core finds foreign keys By Convention.