A C# Web CRUD API using ASP.NET Core and SQL Server 2019 & SQL Server Management Studio, with Entity Framework Core as ORM, that stores CLI commands for different platforms.
Credit: Les Jackson
Repo: binarythistle
HTTP Method | Function | Endpoint | Completed |
---|---|---|---|
POST | Create a Command | /api/commands |
Y |
GET | Read all Commands | /api/commands |
Y |
GET | Read Command by ID | /api/commands/{id} |
Y |
PUT | Replace Command by ID | /api/commands/{id} |
Y |
PATCH | Update Command by ID | /api/commands/{id} |
Y |
DELETE | Delete Command by ID | /api/commands/{id} |
Y |
Password for db set with:
dotnet user-secrets init
dotnet user-secrets set "<secret key>" "<secret value>"
dotnet user-secrets list
Added to startup before DbContext:
var builder = new SqlConnectionStringBuilder(
Configuration.GetConnectionString("CommanderConnection")
);
builder.Password = Configuration.GetSection("DBPassword").Value;
var connectionString = builder.ConnectionString;
services.AddDbContext<CommanderContext>(opt => opt.UseSqlServer(connectionString));