Minor fixes + changed debug launch.json file

This commit is contained in:
2024-09-04 15:51:56 +02:00
parent 286a9eff72
commit ada6967234
5 changed files with 55 additions and 31 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
**/bin **/bin
**/appsettings.*.json **/appsettings.*.json
**/coverage*.xml **/coverage*.xml
.fake

34
.vscode/launch.json vendored
View File

@@ -1,38 +1,18 @@
{ {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
// Use IntelliSense to find out which attributes exist for C# debugging "type": "DotNetAutoAttach",
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
"name": ".NET Rest Api",
"type": "coreclr",
"request": "launch", "request": "launch",
"preLaunchTask": "build", "name": ".NET Core Watch: MainProject",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/MainProject/bin/Debug/net8.0/MainProject.dll",
"args": [], "args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false,
"env": { "env": {
"ASPNETCORE_ENVIRONMENT": "Development", "ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_URLS": "https://localhost:5000;https://localhost:5001",
"ASPNETCORE_DETAILEDERRORS": "1",
"ASPNETCORE_SHUTDOWNTIMEOUTSECONDS": "3"
}, },
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser "project": "MainProject"
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)",
"uriFormat": "%s/swagger"
},
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
} }
] ]
} }

38
.vscode/launch.json_old vendored Normal file
View File

@@ -0,0 +1,38 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
"name": ".NET Rest Api",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/MainProject/bin/Debug/net8.0/MainProject.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false,
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "https://localhost:5000;https://localhost:5001",
"ASPNETCORE_DETAILEDERRORS": "1",
"ASPNETCORE_SHUTDOWNTIMEOUTSECONDS": "3"
},
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)",
"uriFormat": "%s/swagger"
},
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

6
.vscode/tasks.json vendored
View File

@@ -7,7 +7,7 @@
"type": "process", "type": "process",
"args": [ "args": [
"build", "build",
"${workspaceFolder}/MainProject/MainProject.csproj", "${workspaceFolder}/BasicDotnetTemplate.sln",
"/property:GenerateFullPaths=true", "/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign" "/consoleloggerparameters:NoSummary;ForceNoAlign"
], ],
@@ -19,7 +19,7 @@
"type": "process", "type": "process",
"args": [ "args": [
"publish", "publish",
"${workspaceFolder}/MainProject/MainProject.csproj", "${workspaceFolder}/BasicDotnetTemplate.sln",
"/property:GenerateFullPaths=true", "/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign" "/consoleloggerparameters:NoSummary;ForceNoAlign"
], ],
@@ -33,7 +33,7 @@
"watch", "watch",
"run", "run",
"--project", "--project",
"${workspaceFolder}/MainProject.csproj" "${workspaceFolder}/BasicDotnetTemplate.sln"
], ],
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile"
} }

View File

@@ -27,26 +27,31 @@ namespace BasicDotnetTemplate.MainProject.Controllers
protected new IActionResult Created(string message, object? data = null) protected new IActionResult Created(string message, object? data = null)
{ {
message = String.IsNullOrEmpty(message) ? "Created" : message;
return StatusCode((int)HttpStatusCode.Created, CreateResponse(HttpStatusCode.Created, message, data)); return StatusCode((int)HttpStatusCode.Created, CreateResponse(HttpStatusCode.Created, message, data));
} }
protected IActionResult Success(string message, object? data = null) protected IActionResult Success(string message, object? data = null)
{ {
message = String.IsNullOrEmpty(message) ? "Success" : message;
return StatusCode((int)HttpStatusCode.OK, CreateResponse(HttpStatusCode.OK, message, data)); return StatusCode((int)HttpStatusCode.OK, CreateResponse(HttpStatusCode.OK, message, data));
} }
protected IActionResult NotFound(string message, object? data = null) protected IActionResult NotFound(string message, object? data = null)
{ {
message = String.IsNullOrEmpty(message) ? "Not found" : message;
return StatusCode((int)HttpStatusCode.NotFound, CreateResponse(HttpStatusCode.NotFound, message, data)); return StatusCode((int)HttpStatusCode.NotFound, CreateResponse(HttpStatusCode.NotFound, message, data));
} }
protected IActionResult BadRequest(string message, object? data = null) protected IActionResult BadRequest(string message, object? data = null)
{ {
message = String.IsNullOrEmpty(message) ? "Bad request" : message;
return StatusCode((int)HttpStatusCode.BadRequest, CreateResponse(HttpStatusCode.BadRequest, message, data)); return StatusCode((int)HttpStatusCode.BadRequest, CreateResponse(HttpStatusCode.BadRequest, message, data));
} }
protected IActionResult InternalServerError(string message) protected IActionResult InternalServerError(string message)
{ {
message = String.IsNullOrEmpty(message) ? "Internal server error" : message;
return StatusCode((int)HttpStatusCode.InternalServerError, CreateResponse(HttpStatusCode.InternalServerError, message)); return StatusCode((int)HttpStatusCode.InternalServerError, CreateResponse(HttpStatusCode.InternalServerError, message));
} }