- GetNavHistoryAsync现在会自动检查是否有历史数据 - 无历史数据时自动调用BackfillNavHistoryInternalAsync - 拆分内部回填方法,避免重复验证权限
27 lines
709 B
C#
Executable File
27 lines
709 B
C#
Executable File
using Microsoft.Extensions.DependencyInjection;
|
|
using SqlSugar;
|
|
|
|
namespace AssetManager.Data;
|
|
|
|
public static class DatabaseExtensions
|
|
{
|
|
public static IServiceCollection AddDatabase(this IServiceCollection services)
|
|
{
|
|
services.AddScoped<ISqlSugarClient>(s =>
|
|
{
|
|
return SqlSugarConfig.GetSqlSugarClient();
|
|
});
|
|
|
|
services.AddScoped<DatabaseService>();
|
|
|
|
return services;
|
|
}
|
|
|
|
public static void InitializeDatabase(this IServiceProvider serviceProvider)
|
|
{
|
|
using var scope = serviceProvider.CreateScope();
|
|
var dbService = scope.ServiceProvider.GetRequiredService<DatabaseService>();
|
|
dbService.InitializeDatabase();
|
|
}
|
|
}
|