update motor

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-07-13 16:28:07 +07:00
parent bccfb156d7
commit dddf3fc594
9 changed files with 2142 additions and 48 deletions

View File

@@ -247,6 +247,24 @@ if (!string.IsNullOrEmpty(netCoreDir))
var app = builder.Build();
// SQLite không tự tạo thư mục chứa file database - tạo trước các thư mục trong ConnectionStrings
// (đường dẫn tương đối như ./bin/dbs phụ thuộc working directory nên có thể chưa tồn tại)
foreach (var connectionStringEntry in builder.Configuration.GetSection("ConnectionStrings").GetChildren())
{
var dataSource = connectionStringEntry.Value?
.Split(';')
.Select(part => part.Split('=', 2))
.Where(kv => kv.Length == 2 && kv[0].Trim().Equals("Data Source", StringComparison.OrdinalIgnoreCase))
.Select(kv => kv[1].Trim())
.FirstOrDefault();
var dbDirectory = string.IsNullOrEmpty(dataSource) ? null : Path.GetDirectoryName(dataSource);
if (!string.IsNullOrEmpty(dbDirectory))
{
Directory.CreateDirectory(dbDirectory);
}
}
await app.Services.SeedApplicationDbAsync();
await app.Services.SeedScriptEngineDbAsync();
await app.Services.SeedMapManagerAsync();