This site is built using ASP.Net MVC 5, Bootstrap, C# and SQL Server.
- The solution was built using the Visual Studio 2012 Empty MVC 5 project template. This contains all the presentation layer logic.
- A separate C# Class Library project and test project were added for the domain layer and associated unit tests.
- Our existing Data Access Layer was referenced from the Domain layer for interaction with the database.
This page and the Code Snippets page display data from the database using the Data Mapper pattern via a Data Access Layer framework.
- The user navigates to the page concerned and this calls the Controller class and the method matching the View name.
- The Controller class instantiates the Model class and calls the relevant data population method to retrieve a list of records or a single record by numeric ID.
- The data population method calls a method in the Data Mapper class and passes itself by reference.
- The data mapper class uses the appropriate Data Provider to retrieve the data by calling a stored procedure and populates each property.
- The data mapper conforms to an interface that allows a fake object to be substituded when required. This allows for automated testing using different scenarios and the provision of dummy data for use before the relevant database objects have been created.
- The stored procedure queries the table directly or uses a View as an intermediate step.
- Back in the Controller method, the Model is passed to the View and displayed to the user.