Skip to content

dc-p8/dotnet-api-rest-boilerplate

Repository files navigation

dotnet-api-rest-boilerplate

Feel free to use this project as a boilerplate for your WebApi projects

How to use

Technologies used

  • Unity is an IoC container that helps you to make abstraction between your repository implementation and your controlers. Using interfaces is also good because it helps you to test your controlers by faking the repo behaviour
  • Swagger helps you to expose your API's routes. I use it for tests, feel free to remove it in production.

Data Access Layer

  • Dapper is a micro ORM that helps you to access your database
  • I chose SQLite to make the project actually work, but you probably want to change that

Unit tests

  • Nunit is the unit test framework I used here
  • Moq helps you to fake your interface implementations for your controler

Logging

  • I use Nlog as logging framework.
  • As you will see, controlers also depends on a ILogging interface. As the repo, it is injected by Unity, but I used an extension that create the logger depending on the class name
  • The nlog.config probably don't suits your needs

About

Feel free to use this project as a boilerplate for your WebApi projects

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published