Loading topic
Blog and Post. Those classes are not connected to a database yet. In this chapter you add the piece that makes the connection, the DbContext. You will also learn what a DbSet is and how EF Core uses both to build its 4 min readDbContext knows which tables exist, but it still needs to know which database to talk to and where to find it. This chapter covers the two settings that answer those questions: the provider and the connection string.4 min readBlog and Post) and a BloggingContext that points at a SQLite file. The database itself does not exist yet. This chapter shows how EF Core builds it for you, and how it updates the database later when your classes change.4 min readBlogs and Posts tables. This chapter shows how to read rows back out of them using LINQ, the query language built into C#. You will filter rows, sort them, pick single items, count them, page through them, and choose which columns to load.4 min readSaveChangesAsync, sends your changes to the database.4 min readToListAsync and SaveChangesAsync. This chapter explains what the word "Async" means, why EF Core offers these methods, and how to use them without making common mistakes.5 min readBlog to its many Post objects. That link lives in a navigation property, which is a property that points to another entity, such as Blog.Posts or Post.Blog. This chapter covers how EF Core fills those properties with data from the database.4 min readSaveChangesAsync, and the database was updated. You never told EF Core which property had changed. EF Core worked that out with a feature called change tracking. This chapter explains how that works, so the results stop being a su4 min readId or BlogId becomes the primary key, and a string property becomes a text column that may hold any length. Conventions save you work, but sometimes you need diff4 min readnew BloggingContext(). That works in a console app. A web app works differently. It handles many requests, often at the same time, and each request needs its own context. ASP.NET Core has a built-in tool for this called dependency injection. 4 min readSaveChangesAsync. That works well for a few rows. It gets slow when you need to change thousands of rows at once.4 min read