This small inventory database program is building on the last example on the separation of concerns. I’ve added some try/catch and exceptions. Both normal and throwing new ones. This has shown me how the exceptions can be passed thru the layers of the program. And from there how to display the error, log the error, etc… Also you will notice the links enabling the user to view, add, and remove items from the database. You will be able to see how things are done in the code.
In this example I’ve been learning about the separation of a program into layers. Along with doing some simple site database and Entity framework tasks. In this example there are the following layers. A presentation layer, a domain layer, a data transfer layer (DTO for short), and a persistence layer. The flow of the program is the presentation layer makes calls to the domain layer. The domain layers might do some work, if not, then the domain layer will make calls to the persistence layer. The data transfer layers job is to only transfer data from the persistence layer to the domain layer.