Skip to content

bosseludovic/students-union

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

.NET Core Logo

This project is as start point with .NET framework.

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

Check you version of dotnet CLI

dotnet --version
dotnet --info

You should have .NET Core SDK 5 installed.

Quick Start

Clone the GitHub repository and move to the created directory

git clone https://github.com/bosseludovic/students-union.git && cd students-union

Create new solution

The solution is the projects container. Solutions and projects in Visual Studio

dotnet new sln -n cesi-students-union

Create new web API project and add it to the solution

dotnet new webAPI -o cesi-students-union -n cesi-students-union
dotnet sln add ./cesi-students-union/cesi-students-union.csproj
cd cesi-students-union

Run the API

dotnet run

You can now browse to your first route https://localhost:5001/weatherforecast

Want to run all in once?

git clone https://github.com/bosseludovic/students-union.git && cd students-union
dotnet new sln -n cesi-students-union
dotnet new webAPI -o cesi-students-union -n cesi-students-union
dotnet sln add ./cesi-students-union/cesi-students-union.csproj
cd cesi-students-union
dotnet run

Start Coding

Unit tests

https://docs.microsoft.com/fr-fr/dotnet/core/testing/unit-testing-with-dotnet-test

Create a unit test project and add it to the solution

Make sure you're in the root directory

cd ..
dotnet new xunit -o cesi-students-union.Tests -n cesi-students-union.Tests
dotnet add ./cesi-students-union.Tests/cesi-students-union.Tests.csproj reference ./cesi-students-union/cesi-students-union.csproj
dotnet sln add ./cesi-students-union.Tests/cesi-students-union.Tests.csproj

Visual Studio

It's time to lauch Visual Studio! You can either run Visual Studio exe and then open you solution file (.sln) or directly run the solution file (.sln) with associated program.

Nuget

It's the .NET package manager: https://docs.microsoft.com/fr-fr/nuget/quickstart/install-and-use-a-package-in-visual-studio . You can even add package with the nuget package manager or the package manager console.

Add NLog

https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-3

Add NLog dependency

Install-Package NLog.Web.AspNetCore

Configure logs

https://github.com/nlog/NLog/wiki/Configuration-file

Swagger

Swashbuckle

https://docs.microsoft.com/fr-fr/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-3.1&tabs=visual-studio

Install-Package Swashbuckle.AspNetCore -Version 5.5.0

Persistence

Install-Package Microsoft.EntityFrameworkCore.SqlServer
Install-Package Microsoft.EntityFrameworkCore.InMemory

Open the SQL server objects (View > SQL Server Object Explorer) Create a new database.

ORM

Work with EF Core: https://docs.microsoft.com/fr-fr/ef/core/

Create Models: https://docs.microsoft.com/fr-fr/aspnet/core/data/ef-rp/intro?view=aspnetcore-5.0&tabs=visual-studio

DbContext

https://github.com/rowanmiller/UnicornStore/blob/master/UnicornStore/src/UnicornStore/Models/UnicornStore/UnicornStoreContext.cs

LINQ

Create a filter on a collection then sort it using linq.

Dockerfile

https://docs.docker.com/engine/examples/dotnetcore/

echo. 2>Dockerfile echo. 2>.dockerignore

License

The MIT License

About

.NET tutorial for beginners

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published