From ba4976fce42c89b33ba3884e0bf99d7e718e194f Mon Sep 17 00:00:00 2001 From: kham vilaythong Date: Sun, 23 Aug 2026 18:15:40 +1000 Subject: [PATCH] add clear log provide --- API/.vscode/launch.json | 21 +++++++++++- API/.vscode/tasks.json | 14 +++++++- .../Controllers/UsersController.cs | 2 +- API/FamilyTreeAPI/FamilyTreeAPI.csproj | 17 +++++----- API/FamilyTreeAPI/Program.cs | 34 ++++++++++++++++++- API/FamilyTreeAPI/Repository/Seed.cs | 1 - 6 files changed, 76 insertions(+), 13 deletions(-) diff --git a/API/.vscode/launch.json b/API/.vscode/launch.json index fe2f55a..5d4ab4b 100644 --- a/API/.vscode/launch.json +++ b/API/.vscode/launch.json @@ -2,6 +2,7 @@ "version": "0.2.0", "configurations": [ + { "name": "C#: FamilyTreeAPI", "type": "coreclr", @@ -27,7 +28,25 @@ "/Views": "${workspaceFolder}/Views" }, -} +}, +{ + "name": ".NET Core Launch (web) - Release", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "publish", + "program": "${workspaceFolder}\\FamilyTreeAPI\\bin\\Release\\net10.0\\FamilyTreeAPI.dll", + "serverReadyAction": { + "action": "openExternally", + "pattern": "listening on:\\s+(https?://\\S+)", + "uriFormat": "%s/swagger/index.html" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Production", + "ASPNETCORE_URLS": "https://localhost:5019" + }, + "cwd": "${workspaceFolder}" + } + diff --git a/API/.vscode/tasks.json b/API/.vscode/tasks.json index aac3736..f06e863 100644 --- a/API/.vscode/tasks.json +++ b/API/.vscode/tasks.json @@ -7,13 +7,25 @@ "type": "shell", "args": [ "build", - "${workspaceFolder}/FamilyTreeAPI/FamilyTreeAPI.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/FamilyTreeAPI/FamilyTreeAPI.csproj", + "-c", + "Release" + ], + "problemMatcher": "$msCompile" + }, + ] } \ No newline at end of file diff --git a/API/FamilyTreeAPI/Controllers/UsersController.cs b/API/FamilyTreeAPI/Controllers/UsersController.cs index bd385d3..4d2ada6 100644 --- a/API/FamilyTreeAPI/Controllers/UsersController.cs +++ b/API/FamilyTreeAPI/Controllers/UsersController.cs @@ -37,7 +37,7 @@ public class UsersController : ControllerBase public async Task LoginApiAD([FromBody] AuthenticateRequest model) { string remoteIpAddress = HttpContext.Connection.RemoteIpAddress?.ToString(); - var rval = await _repoUser.LoginApiAD(userdetail, remoteIpAddress); + var rval = await _userService.LoginApiAD(model, remoteIpAddress); if (rval.Data != null && rval.Data.Token != null) { // Configure cookie options diff --git a/API/FamilyTreeAPI/FamilyTreeAPI.csproj b/API/FamilyTreeAPI/FamilyTreeAPI.csproj index 9f92bc8..a338189 100644 --- a/API/FamilyTreeAPI/FamilyTreeAPI.csproj +++ b/API/FamilyTreeAPI/FamilyTreeAPI.csproj @@ -10,23 +10,24 @@ - - + + - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + + diff --git a/API/FamilyTreeAPI/Program.cs b/API/FamilyTreeAPI/Program.cs index 72bab6d..7e0e8e0 100644 --- a/API/FamilyTreeAPI/Program.cs +++ b/API/FamilyTreeAPI/Program.cs @@ -13,6 +13,9 @@ using FamilyTreeAPI.Repository; var builder = WebApplication.CreateBuilder(args); +builder.Logging.ClearProviders(); +builder.Logging.AddConsole(); +builder.Logging.AddDebug(); // Explicitly register the base paths for Linux container execution builder.Configuration .SetBasePath(AppContext.BaseDirectory) // <-- Pulls from wherever the binary sits @@ -220,4 +223,33 @@ query { } } } -*/ \ No newline at end of file + + dotnet --list-sdks + +In the VS Code Explorer, click and open your .csproj file. +Locate the tag inside the block. +Change the value to your desired version (e.g., change net11.0 or net9.0 to net10.0 + +now run to see out of date + +dotnet list package --outdated + +dotnet tool uninstall --global dotnet-outdated +dotnet tool install --global dotnet-outdated-tool + +//update the outdate +dotnet outdated -u + +update the package +dotnet add package + +Open the .vscode folder in your workspace and select launch.json. +Look for lines containing your old framework directory string (e.g., /bin/Debug/net8.0/). +Update those paths to reflect your new version (e.g., /bin/Debug/net9.0/). + +clear and rebuild + +dotnet clean +dotnet restore +dotnet build +*/ diff --git a/API/FamilyTreeAPI/Repository/Seed.cs b/API/FamilyTreeAPI/Repository/Seed.cs index 4224195..48056d3 100644 --- a/API/FamilyTreeAPI/Repository/Seed.cs +++ b/API/FamilyTreeAPI/Repository/Seed.cs @@ -66,7 +66,6 @@ public class Seed var conn = _context.Database.GetDbConnection(); try { - conn.Open(); var command = conn.CreateCommand(); command.CommandText = sptext;