From 39c4504b8716c4256c2aa8da22cfd2755132113e Mon Sep 17 00:00:00 2001 From: Wickedness Date: Fri, 10 Jul 2026 05:33:19 +0900 Subject: [PATCH] feat: complete Oracle and MariaDB WebView data layer --- .gitignore | 2 + Config/appsettings.example.json | 42 +- Directory.Build.props | 12 + MBN_STOCK_WEBVIEW.csproj | 7 +- MBN_STOCK_WEBVIEW.sln | 84 ++++ MainWindow.xaml.cs | 279 +++++++++++- Package.appxmanifest | 2 + README.md | 11 +- ThirdPartyNotices/MySqlConnectorLicense.txt | 21 + ThirdPartyNotices/OracleLicense.txt | 42 ++ ThirdPartyNotices/README.md | 11 + Web/app.js | 421 +++++++++++++++++- Web/index.html | 18 +- Web/styles.css | 61 +++ docs/DATABASE.md | 77 ++++ docs/MIGRATION.md | 14 +- scripts/Initialize-DatabaseConfig.ps1 | 111 +++++ .../Data/IDataQueryExecutor.cs | 14 +- src/MBN_STOCK_WEBVIEW.Core/Data/MarketData.cs | 165 +++++++ .../Configuration/DatabaseOptions.cs | 217 +++++++++ .../Configuration/DatabaseOptionsLoader.cs | 223 ++++++++++ .../Connections/IDatabaseConnectionFactory.cs | 11 + .../ProviderDatabaseConnectionFactory.cs | 123 +++++ .../DatabaseRuntime.cs | 44 ++ .../Execution/DatabaseExceptions.cs | 81 ++++ .../Execution/ResilientDataQueryExecutor.cs | 270 +++++++++++ .../TransientDatabaseErrorDetector.cs | 138 ++++++ .../Health/DatabaseHealthService.cs | 119 +++++ .../MBN_STOCK_WEBVIEW.Infrastructure.csproj | 21 + .../AssemblyInfo.cs | 3 + .../DataQueryExecutorTests.cs | 65 +++ .../GlobalUsings.cs | 1 + .../LegacyMarketDataServiceTests.cs | 232 ++++++++++ .../MBN_STOCK_WEBVIEW.Core.Tests.csproj | 25 ++ .../DatabaseFakes.cs | 279 ++++++++++++ .../DatabaseHealthServiceTests.cs | 105 +++++ .../DatabaseOptionsLoaderTests.cs | 135 ++++++ .../GlobalUsings.cs | 1 + ..._STOCK_WEBVIEW.Infrastructure.Tests.csproj | 26 ++ .../ProviderDatabaseConnectionFactoryTests.cs | 86 ++++ .../ResilientDataQueryExecutorTests.cs | 216 +++++++++ .../TestOptions.cs | 39 ++ .../MBN_STOCK_WEBVIEW.DbSmoke.csproj | 16 + tools/MBN_STOCK_WEBVIEW.DbSmoke/Program.cs | 132 ++++++ 44 files changed, 3956 insertions(+), 46 deletions(-) create mode 100644 Directory.Build.props create mode 100644 ThirdPartyNotices/MySqlConnectorLicense.txt create mode 100644 ThirdPartyNotices/OracleLicense.txt create mode 100644 ThirdPartyNotices/README.md create mode 100644 docs/DATABASE.md create mode 100644 scripts/Initialize-DatabaseConfig.ps1 create mode 100644 src/MBN_STOCK_WEBVIEW.Core/Data/MarketData.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Infrastructure/Configuration/DatabaseOptions.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Infrastructure/Configuration/DatabaseOptionsLoader.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Infrastructure/Connections/IDatabaseConnectionFactory.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Infrastructure/Connections/ProviderDatabaseConnectionFactory.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Infrastructure/DatabaseRuntime.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Infrastructure/Execution/DatabaseExceptions.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Infrastructure/Execution/ResilientDataQueryExecutor.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Infrastructure/Execution/TransientDatabaseErrorDetector.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Infrastructure/Health/DatabaseHealthService.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Infrastructure/MBN_STOCK_WEBVIEW.Infrastructure.csproj create mode 100644 tests/MBN_STOCK_WEBVIEW.Core.Tests/AssemblyInfo.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Core.Tests/DataQueryExecutorTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Core.Tests/GlobalUsings.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Core.Tests/LegacyMarketDataServiceTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Core.Tests/MBN_STOCK_WEBVIEW.Core.Tests.csproj create mode 100644 tests/MBN_STOCK_WEBVIEW.Infrastructure.Tests/DatabaseFakes.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Infrastructure.Tests/DatabaseHealthServiceTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Infrastructure.Tests/DatabaseOptionsLoaderTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Infrastructure.Tests/GlobalUsings.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Infrastructure.Tests/MBN_STOCK_WEBVIEW.Infrastructure.Tests.csproj create mode 100644 tests/MBN_STOCK_WEBVIEW.Infrastructure.Tests/ProviderDatabaseConnectionFactoryTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Infrastructure.Tests/ResilientDataQueryExecutorTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Infrastructure.Tests/TestOptions.cs create mode 100644 tools/MBN_STOCK_WEBVIEW.DbSmoke/MBN_STOCK_WEBVIEW.DbSmoke.csproj create mode 100644 tools/MBN_STOCK_WEBVIEW.DbSmoke/Program.cs diff --git a/.gitignore b/.gitignore index e62f146..5db954b 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,8 @@ BundleArtifacts/ # Local settings and secrets Config/appsettings.local.json Config/*.secrets.json +Config/database.local.json +**/database.local.json *.local.ini .env .env.* diff --git a/Config/appsettings.example.json b/Config/appsettings.example.json index 72f4af6..6797854 100644 --- a/Config/appsettings.example.json +++ b/Config/appsettings.example.json @@ -1,21 +1,29 @@ { - "database": { - "oracle": { - "host": "", - "port": 1521, - "serviceName": "", - "userName": "" - }, - "mariaDb": { - "host": "", - "port": 3306, - "database": "", - "userName": "" - } + "oracle": { + "host": "", + "port": 1521, + "sid": "", + "serviceName": null, + "userName": "", + "password": "", + "connectTimeoutSeconds": 10, + "commandTimeoutSeconds": 30, + "pooling": true }, - "playout": { - "host": "127.0.0.1", - "port": 30001, - "sceneFolder": "" + "mariaDb": { + "host": "", + "port": 3306, + "database": "", + "userName": "", + "password": "", + "tlsMode": "Preferred", + "connectTimeoutSeconds": 10, + "commandTimeoutSeconds": 30, + "pooling": true + }, + "resilience": { + "operationTimeoutSeconds": 45, + "maximumRetryCount": 2, + "initialRetryDelayMilliseconds": 250 } } diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..9d9c636 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,12 @@ + + + + false + None + false + + diff --git a/MBN_STOCK_WEBVIEW.csproj b/MBN_STOCK_WEBVIEW.csproj index 1a41b95..cb3b5b4 100644 --- a/MBN_STOCK_WEBVIEW.csproj +++ b/MBN_STOCK_WEBVIEW.csproj @@ -42,11 +42,15 @@ PreserveNewest + + PreserveNewest + PreserveNewest + - + @@ -67,6 +71,7 @@ +