Creating a data project
To save our blog posts, we will use Entity Framework, which is Microsoft's Object Relational Mapping (or ORM). It enables developers to work with data using domain-specific classes and not worry about the underlying database (as tables, columns, and relations are generated from the classes).
Entity Framework maps classes to the tables in the database. There are two ways to use Entity Framework:
- The database-first approach: This is when we already have an existing database and generate classes based on that database.
- The code-first approach: This is when we first write the classes, which will then generate the database.
For this project, we will use the code-first approach.
Let's create a new data project, using the command line to get a feel for what the dotnet
command can do.
Creating a new project
There are many ways to store the data; for simplicity, we will use an SQLite database while building the blog. The data...