This project is a gRPC service built using .NET 8.0, featuring the generation and usage of discount codes, with support for unit testing and an in-memory database.
- .NET 8.0 SDK (Ensure that it is installed on your machine)
- SQLite (if applicable)
Before running the project, it is mandatory to apply the Entity Framework Core migrations to set up the database schema correctly.
Ensure that the database schema is up to date by running the migrations.
- Open a terminal in the root of your project directory (where the
.csproj
file is located). - Run the following command to apply the migrations:
dotnet ef database update --project GrpcService
This will apply any pending migrations and create the database (if using SQLite or another supported database).
If migrations haven't been created yet, you can generate them by running:
dotnet ef migrations add InitialCreate --project GrpcService
Note: Ensure the dotnet-ef tool is installed globally if needed:
dotnet tool install --global dotnet-ef
By default, the project is configured to run on HTTPS
(https://localhost:5001), but for local development, it is recommended to use HTTP (
http://localhost:5000`).
How to Force the Project to Use HTTP:
- Open the
appsettings.json
file located in theGrpcService
folder. Or create one byexample.appsettings.json
- Save the changes and proceed to run the project.
The project can be run using VS Code, JetBrains Rider, Visual Studio, or directly from the terminal. Below are the steps to follow.
VS Code
-
Open the project in VS Code.
-
Open the integrated terminal in VS Code (Terminal > New Terminal).
-
Restore NuGet packages:
dotnet restore
- Apply the migrations (as described above).
- Run the project:
dotnet run
JetBrains Rider
- Open the project in Rider.
- Restore NuGet packages by running:
dotnet restore
- Apply the migrations (as described above).
- Run the project by selecting your run configuration and starting the application.
If you running it in localhost make sure the project is configured to run on HTTP (http://localhost:5000
).
You shouldn't have any issues with that because is already configured in the
appsettings.json
.