DapperSeries
Sample code for the Dapper Series of blog posts:
The sample project for this series of blog posts is an ASP.NET Core project containing api controllers. To test the project you will issue GET and POST to the api.
Requirements
.NET Core SDK v2.1.4 or newer A SQL Server database (Localdb or any modern version of SQL Server will work fine)
Creating a new database
The sample can be used to create a new database with some sample data. The default setting is to use localdb. If you do not have localdb installed, change the connection string in applicationSettings.json to point to an instance of SQL Server on your machine.
From the src\DapperSeries
folder, build and run the app.
dotnet build
dotnet run
Using a tool like Postman, issue a post request to localhost:5000\api\db\init
A database containing tables and sample data should be created. If everything worked as expected, you will receive a 200 OK result. If not, you should get some HTML that will have an error buried in it somewhere.
Testing Queries
To execute the code for various API controllers, send get requests and see the results. For example, to query for the Aircraft
with ID 42, send a get request to localhost:5000\api\aircraft\42\