Skip to content

Commit

Permalink
Solution: WatchList.WinForms - Changed contain DI.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stan-Kudri committed Oct 13, 2023
1 parent bbb2689 commit 5e9dc69
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions WatchList.WinForms/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Microsoft.Extensions.Logging;
using WatchList.Core.Logger;
using WatchList.Core.Repository;
using WatchList.Core.Repository.Db;
using WatchList.Core.Service;
using WatchList.Core.Service.Component;
using WatchList.Core.Service.DataLoading;
Expand Down Expand Up @@ -33,17 +32,13 @@ public static void Main()
.AddSingleton(new FileDbContextFactory("app.db"))
.AddScoped(e => e.GetRequiredService<FileDbContextFactory>().Create())
.AddScoped<DbMigrator>()
.AddScoped<WatchItemRepository>(e => new WatchItemRepository(e.GetRequiredService<WatchCinemaDbContext>(), e.GetRequiredService<AggregateLogging>()))
.AddScoped<WatchItemRepository>()
.AddScoped<IMessageBox, MessageBoxShow>()
.AddScoped<WatchItemService>()
.AddScoped<DownloadDataService>()
.AddTransient<MergeDatabaseForm>()
.AddTransient<BoxCinemaForm>()
.AddSingleton(e => new ConsoleLogger(LogLevel.Information))
.AddSingleton(e => new FileLogger(LogLevel.Trace, path))
.AddSingleton<ILogger>(e => e.GetRequiredService<ConsoleLogger>())
.AddSingleton<ILogger>(e => e.GetRequiredService<FileLogger>())
.AddSingleton(e => new AggregateLogging() { e.GetRequiredService<ConsoleLogger>(), e.GetRequiredService<FileLogger>() });
.AddSingleton<ILogger>(e => new AggregateLogging() { new ConsoleLogger(LogLevel.Trace), new FileLogger(LogLevel.Trace, path) });

using var contain = serviceCollection.BuildServiceProvider(new ServiceProviderOptions
{
Expand Down

0 comments on commit 5e9dc69

Please sign in to comment.