Database structure
Our database consists of just one table: Car
. As shown in Figure 2.2, that table must store various attributes of each car (name, miles per gallon, number of cylinders, and so on). Figure 2.3 shows the table:
Figure 2.3 – Car table columns
Notice the is_deleted
column. We’ll be using “soft delete” – that is, rather than removing a row on deletion we’ll just set is_deleted
to true (1
). That allows us to easily restore that column just by changing that value back to 0
(false).
Other than id
, all of the columns are strings, which will make working with them easier.
Car object
Corresponding to the Car
table, our code has a Car
entity (Cars/Data/Entities/Car.cs
):
namespace Cars.Data.Entities; public class Car { public int Id { get; set; } public string name { get; set; } = null!; public string mpg { get; set; } = null...