Finished Settings page
This commit is contained in:
16
WorkTime.Database/ServiceCollectionExtensions.cs
Normal file
16
WorkTime.Database/ServiceCollectionExtensions.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using WorkTime.Database.Repositories;
|
||||
using WorkTime.Models.Repositories;
|
||||
|
||||
namespace WorkTime.Database;
|
||||
|
||||
public static class ServiceCollectionExtensions {
|
||||
|
||||
public static void AddDatabase(this IServiceCollection services, string basePath) {
|
||||
services.AddSqlite<DatabaseContext>($"Filename={Path.Combine(basePath, "data.db")}");
|
||||
services.AddHostedService<DbMigrationService>();
|
||||
services.AddTransient<ITimeEntryRepository, TimeEntryRepository>();
|
||||
services.AddTransient<ISettingsRepository, SettingsRepository>(_ => new SettingsRepository(Path.Combine(basePath, "settings.json")));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user