A WEB API created in .NET for the Alpimi planner
Test Plan
-
Launch
View > Server Explorer
in Visual Studio, right clickData Connections
andCreate New SQL Server Database
:- Server name: the
hostname
of your computer - Trust server certificate:
checked
- New database name:
provide_any_name_here
- Server name: the
-
After a successful connection, right click the database, select
Properties
and copy the connection string -
Create a
.env
file inside the root of the project containing:
CONNECTION_STRING="paste_your_connection_string_here"
- Install Entity Framework tool globally
dotnet tool install --global dotnet-ef
- Update your database with the latest migration
dotnet ef database update
-
Create a second database following steps 3 and 4 from the previous
Setup for development
section -
Paste your new connection string in a new
.runsettings
file like this:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<EnvironmentVariables>
<TEST_CONNECTION_STRING>
paste_your_connection_string_here
</TEST_CONNECTION_STRING>
</EnvironmentVariables>
</RunConfiguration>
</RunSettings>
- Update your new database with the latest migration
dotnet ef database update --connection "paste_your_connection_string_here"
-
Install CSharpier, go to
Tools > Options > CSharpier > General
and changeReformat with CSharpier on Save
toTrue
. It will save you a lot of time -
Remember to add a migration whenever an entity is changed:
dotnet ef migrations add MigrationName
dotnet ef database update
- And here's how to remove a migration:
dotnet ef database update PreviousMigrationName
dotnet ef migrations remove