Loading topic
Beginner · Mid: 18 chapters · 35 min read. Defines each term at first use
Start readingBlog and Post.Blog and Post. They are plain C# classes, and they don't know anything about databases yet. The class that connects them to a database is called a DbContext.BloggingContext knows which tables exist. It still needs two more facts: what kind of database to use and where that database lives. This chapter shows you how to supply both.BloggingContext. The database file does not exist yet. Migrations are how EF Core builds it.Blogs and Posts tables. This chapter shows how to read rows from those tables using C# code instead of SQL.SaveChanges.Blog to its Post rows with navigation properties. A navigation property is a property that points to a related entity, such as Blog.Posts or Post.Blog. EF Core does not fill these properties automatically when you run a query. You have to tell it when to loaSaveChangesAsync, and the database was updated. You never had to tell EF Core which objects had changed. This chapter explains how EF Core knows.DbContext yourself with new BloggingContext(). In a web app, it is better to let ASP.NET Core create the context for you. This chapter shows how.SaveChangesAsync. That works well for a few rows. If you need to change thousands of rows, it gets slow. EF Core has to load every row into memory and track each one, then send an UPDATE or DELETE for every row