Boilerplate of API in .NET Core 3.1
Boilerplate of API in
.NET Core 3.1
Boilerplate is a piece of code that helps you to quickly kick-off a project or start writing your source code. It is kind of a template - instead of starting an empty project and adding the same snippets each time, you can use the boilerplate that already contains such code.
.cs- S001_AddCarTypesTable.sql, S002_ModifySomeRows.cs
DbSetfaster - EnumerableExtensions.cs
Keep in mind that entire environment has to be up and running.
Generally it is totally up to you! But in case you do not have any plan, You can follow below simple steps:
dotnet buildin the root directory, it takes
HappyCode.NetCoreBoilerplate.slnand build everything.
Then the application (API) can be started by
dotnet runcommand executed in the
src/HappyCode.NetCoreBoilerplate.Apidirectory. By default it will be available under http://localhost:5000/, but keep in mind that documentation is available under http://localhost:5000/swagger/.
docker-compose upcommand in the root directory and after successful start of services visit http://localhost:5000/swagger/. To check that API has connection to both MySQL and MsSQL databases visit http://localhost:5000/health/.
When the entire environment is up and running, you can additionally run a migration tool to add some new schema objects into MsSQL DB. To do that, go to
src/HappyCode.NetCoreBoilerplate.Dbdirectory and execute
dotnet testcommand in the root directory, it will look for test projects in
HappyCode.NetCoreBoilerplate.slnand run them.
Need to migrate from
.NET Core 2.2to
.NET Core 3.1? There's an Microsoft article about this, but you can also, just in case, take a look at my migration commit where you can find the complete list of required changes.
then please give me a
star, appreciate my work. Thanks!