A Web based API for conducting Meetups
ℹ️🚩 Built for Software Developers, as a demo and practice for me. 🚩ℹ️
- C#
- .NET 6
- EntityFramework
- NLog
This is not intended for production (end users), it is meant as demo or example of creating a RESTful Web API in C# and .NET.
in order to run this project do the following ...
- Set the JWT Key Info on JWT to something either in appsettings.json OR UserSecrets
docs
"JwtKey": "SET_THIS_TO_SOMETHING_DONT_SHARE"
⚠️ If you get an error like 'IDX10653: The encryption algorithm 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256' requires a key size of at least '128' bits. Key '[PII of type 'Microsoft.IdentityModel.Tokens.SymmetricSecurityKey' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]', is of size: '8'. (Parameter 'key')'' your JWT Key may need to be longer in length⚠️
- you would need to run in Visual Studio Package Manager :
add-migration MigrationName
or Rundotnet ef migrations add MigrationName
- You should now be able to build and run 👍
More Info ...
Commands for DB Migrations
The Microsoft Docs
- Create a Migration
At the very first time, you defined the initial domain classes. At this point, there is no database for your application which can store the data from your domain classes. So, firstly, you need to create a migration
using the Package Manager Console in Visual Studio
PM> add-migration MigrationName
using the CLI (any terminal / command line) and dotnet
> dotnet ef migrations add MigrationName
You may need to add the following packge if you get this error:
from the PM console in Viusal Studio
PM> Install-Package Microsoft.EntityFrameworkCore.Tools
from dotnet cli
dotnet tool install -g dotnet-ef
- Creating or Updating the Database
PM> Update-Database
> dotnet ef database update
- Removing a Migration
PM> remove-migration
> dotnet ef migrations remove
- Reverting a Migration
PM> Update-database MigrationName
> dotnet ef database update MigrationName
- Generating a SQL Script
Use the following command to generate a SQL script for the database.
PM> script-migration
> dotnet ef migrations script