Entity Framework uses a set of conventions to build a model based on the shape of your entity classes. You can specify additional configuration to supplement and/or override what was discovered by convention.
Use fluent API to configure a model
You can override the OnModelCreating method in your derived context and use the ModelBuilder API to configure your model. This is the most powerful method of configuration and allows configuration to be specified without modifying your entity classes. Fluent API configuration has the highest precedence and will override conventions and data annotations.
You can also apply attributes (known as Data Annotations) to your classes and properties. Data annotations will override conventions, but will be overridden by Fluent API configuration.
Including a type/property in the model means that EF has metadata about that type/property and will attempt to read and write instances from and to the database.
A many-to-many relationship occurs between entities when a one-to-many relationship between them works both ways. A book can appear in many categories and a category can contain many books.
This type of relationship is represented in a database by a join table (also known among other things as a bridging, junction or linking table).
A many-to-many relationship is defined in code by the inclusion of collection properties in each of the entities - The Categories property in the Book class, and the Books property in the Category class:
The join table will be named after the join entity (BookCategory in this case) by convention. The relationship also needs to be configured via the Fluent API for EF Core to be able to map it successfully: