
Creating a repository and a TodoItem model
Any good architecture always involves abstraction. In this app, we need something to store and retrieve the items of our to-do list. These will later be stored in an SQLite database, but adding a reference to the database directly from the code that is responsible for the GUI is generally a bad idea.
What we need instead is something to abstract our database from the GUI. For this app, we've chosen to use a simple repository pattern. This repository is simply a class that sits in between the SQLite database and our upcoming ViewModels. This is the class that handles the interaction with the view, which in turn handles the GUI.
The repository will expose methods for getting items, adding items, and updating items, as well as events that allow other parts of the app to react to changes in the repository. It will be hidden behind an interface so that we can replace the entire implementation later on, without modifying anything but a line of code in the initialization of the app. This is made possible by Autofac.