refactor(config): 将 appsettings.json 转为嵌入资源
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Reflection;
|
||||
using Gpulse.WCT.DataAnalyzer.Core.Infrastructure.Extensions;
|
||||
using Gpulse.WCT.DataAnalyzer.Core.Infrastructure.LocalData;
|
||||
using Microsoft.Data.Sqlite;
|
||||
@@ -56,7 +57,11 @@ public sealed class CliTestHost : IDisposable
|
||||
var releaseConnection = new SqliteConnection("Data Source=:memory:");
|
||||
await releaseConnection.OpenAsync();
|
||||
|
||||
// 从嵌入资源加载 appsettings.json,与 Program.Main 生产路径一致
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddEmbeddedResourceJson(
|
||||
typeof(Program).Assembly,
|
||||
"Gpulse.WCT.DataAnalyzer.appsettings.json")
|
||||
.AddInMemoryCollection(new Dictionary<string, string?>
|
||||
{
|
||||
["Database:Type"] = "sqlite",
|
||||
|
||||
Reference in New Issue
Block a user