Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BlastMerge.ConsoleApp/BlastMerge.ConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PackageReference Include="Spectre.Console" />
<PackageReference Include="CommandLineParser" />
<PackageReference Include="ktsu.AppDataStorage" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 16 additions & 2 deletions BlastMerge.ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace ktsu.BlastMerge.ConsoleApp;
using ktsu.BlastMerge.ConsoleApp.CLI;
using ktsu.BlastMerge.ConsoleApp.Services;
using ktsu.BlastMerge.Contracts;
using Microsoft.Extensions.DependencyInjection;

/// <summary>
/// Main entry point for the BlastMerge console application.
Expand All @@ -28,8 +29,13 @@ public static int Main(string[] args)

try
{
// Create services with proper dependency injection pattern
IApplicationService applicationService = new ConsoleApplicationService();
// Set up dependency injection container
ServiceCollection services = new();
ConfigureServices(services);
using ServiceProvider serviceProvider = services.BuildServiceProvider();

// Get application service from DI container
IApplicationService applicationService = serviceProvider.GetRequiredService<IApplicationService>();
CommandLineHandler commandLineHandler = new(applicationService);

// Process command line arguments
Expand All @@ -46,4 +52,12 @@ public static int Main(string[] args)
return 1;
}
}

/// <summary>
/// Configures the dependency injection services.
/// </summary>
/// <param name="services">The service collection to configure.</param>
private static void ConfigureServices(ServiceCollection services) =>
// Register application service
services.AddSingleton<IApplicationService, ConsoleApplicationService>();
}
Binary file modified icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading