Skip to content

.NET 5 & .NET Core 3.1 Web API & Entity Framework Jump start

Notifications You must be signed in to change notification settings

brunaoliveira/dotnet-rpg

Repository files navigation

.NET

.NET 5 & .NET Core 3.1 Web API & Entity Framework Jump start.

Web API

  • Model-View-Controller (MVC) pattern
  • Asynchronous implementations
  • Data-Transfer-Objects (DTOs)
  • CRUD (Create, Read, Update, Delete)
  • HTTP request methods (GET, POST, PUT, DELETE)

Entity Framework Core

  • Persistence
  • Object-Relational-Mapping
  • SQL Server database
  • Code-First Migration
  • CRUD with Entity Framework Core

Authentication

  • User registration and login
  • Cryptography algorithm HMACSHA512
  • JSON Web Tokens

Database Relationships

  • One-To-One
  • One-To-Many
  • Many-To-Many

Dependencies

  • Swashbuckle Filters
  • AutoMapper
  • Entity Framework Core Design
  • Entity Framework Core SqlServer
  • JWT Bearer

Entity Framework Migration

  dotnet ef migrations add InitialCreate
  dotnet ef database update

JWT

On the JWT page "Debugger" one can take a deeper look into the token generated by /Auth/Login

  • To a valid signature verification, replace your-256-bit-secret on the UI for the "AppSettings:Token" value on the appsettings.json file.

Running

Application

  cd dotnet-rpg
  dotnet run

Debug on Swagger

Follow path: https://localhost:5001/swagger/index.html

  • To test secured methods with Swagger

    • run /Auth/Login with a registered user
    • copy the token generated
    • on right top of the page click on Authorize and paste the value from previous step, like the example given on the screen
      bearer <TOKEN>
      
    • after successfully loging, the locked methods (closed lock on right corner) can be tested and the message shown should be like the image below