Abstracting the data layer
The data layer abstraction has already begun with the implementation of a repository pattern. In this section, we will work to create a valid abstraction for connecting to an Entity Framework. After we can communicate with the Entity Framework, we will then focus on making the repository more generic and able to work with multiple data models.
Extending the repository pattern
The first step in creating a valid data layer abstraction is to make sure CRUD has been handled. CRUDÂ (Create, Read, Update, and Delete) are the basic operations that can be performed on any dataset. The IRepository
does not yet provide access to all of these capabilities so we will begin by extending it.
First create a folder to contain the tests for a SpeakerRepository
. The folder should be named in line with the folders containing the SpeakerService
tests and SpeakerController
tests. As usual, we start with a failing test. In this case, the test is failing to compile:
[Trait("Category", "SpeakerRepository...