更新时间:2021-07-02 21:17:12
封面
版权信息
Credits
About the Author
About the Reviewers
www.PacktPub.com
Why subscribe?
Customer Feedback
Dedication
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
Kickstart - Introduction to Entity Framework Core
Prerequisites
Creating a new project
The Start page
The File menu
Structuring the web app
Installing Entity Framework
Data models
Blog entity
Post entity
Database context
Registering the context in services (.NET Core DI)
Creating and seeding databases
CRUD operations
Summary
The Other Way Around – Database First Approach
Preparing the database
Blog entity script
Post entity script
Creating new project
Reverse engineering the database
Configuring data context
Working with the Blog entity
Working with the Post entity
Registering context in services (.NET Core DI)
Refactoring the OnConfiguring() method
Refactoring the ConfigureServices method
The appsettings.json setting
Performing CRUD operations
Creating controller action
Edit controller action
The Delete view
Relationships – Terminology and Conventions
Understanding relationship terms
The Post entity
Principal entity
Principal key
Dependent entity
Foreign key
Navigation property
Collection navigation property
Reference navigation property
Inverse navigation property
Conventions in a relationship
Fully-defined relationships
Fully-defined relationships - under the hood
No foreign key property
No foreign key property - under the hood
Single navigation property
Inverse property
Building Relationships – Understanding Mapping
Relationships
The one-to-one relationship
Building one-to-one relationships using the Fluent API
The one-to-many relationship
The many-to-many relationship
Building many-to-many relationship using the Fluent API
Fluent API
Identifying navigation property and inverse navigation
Identifying the single navigation property
Relationship-building techniques
Building relationship using a foreign key
Building relationships using a principal key
Building relationships using the IsRequired method
Cascade delete
Data migration issue with EF Core 2.0
Know the Validation – Explore Inbuilt Validations
Diving into built-in validations
Required field validation
Incorporating the Required validation in blogging system models
EmailAddress field validation
Incorporating EmailAddress validation in blogging system models