diff --git a/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj b/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj
index 8d447db..d4a63d9 100644
--- a/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj
+++ b/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/DiscordChatExporter.Cli/Program.cs b/DiscordChatExporter.Cli/Program.cs
index a671c3d..6fcb8ef 100644
--- a/DiscordChatExporter.Cli/Program.cs
+++ b/DiscordChatExporter.Cli/Program.cs
@@ -1,33 +1,42 @@
-using System.Threading.Tasks;
+using System;
+using System.Threading.Tasks;
using CliFx;
+using DiscordChatExporter.Cli.Commands;
using DiscordChatExporter.Core.Services;
-using StyletIoC;
+using Microsoft.Extensions.DependencyInjection;
namespace DiscordChatExporter.Cli
{
public static class Program
{
- private static IContainer BuildContainer()
+ private static IServiceProvider ConfigureServices()
{
- var builder = new StyletIoCBuilder();
+ var services = new ServiceCollection();
- // Autobind the .Services assembly
- builder.Autobind(typeof(DataService).Assembly);
+ // Register services
+ services.AddSingleton();
+ services.AddSingleton();
+ services.AddSingleton();
- // Bind settings as singleton
- builder.Bind().ToSelf().InSingletonScope();
+ // Register commands
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
- // Set instance
- return builder.BuildContainer();
+ return services.BuildServiceProvider();
}
public static Task Main(string[] args)
{
- var container = BuildContainer();
+ var serviceProvider = ConfigureServices();
return new CliApplicationBuilder()
.AddCommandsFromThisAssembly()
- .UseCommandFactory(schema => (ICommand) container.Get(schema.Type))
+ .UseCommandFactory(schema => (ICommand) serviceProvider.GetService(schema.Type))
.Build()
.RunAsync(args);
}