Database software installation#
Database and DBMS#
Until now we stored our data inside classes. Databases allow a more organized way of managing data.
For example, a table called Items look like:
Name |
PricePerUnit |
InventoryLocation |
|---|---|---|
M3 screw |
1.0 |
1 |
M3 nut |
1.5 |
2 |
pen |
1.0 |
3 |
- Database management system (DBMS)
software that interacts with user and the database
There are many DBMSs. We will use SQLite.
Installation SQLite#
brew install sqlite
winget install sqlite.sqlite
OOP-based database interaction#
There are many ways to read write data to a database. We will use an OOP-based approach. Microsoft provides a library called Entity Framework Core (EF) which we will use.
Using EF, we can map the hierarchy of our classes to a database.
Installation of Entity Framework Core#
Install the following NuGet packages on Rider:
Microsoft.EntityFrameworkCoreMicrosoft.EntityFrameworkCore.Sqlite
Using the first package we can read/store data using objects we created using OOP. The second one is required to work with the database software SQLite.