diff --git a/src/CommandScheduler/CommandScheduler.csproj b/src/CommandScheduler/CommandScheduler.csproj index 4430c02..46c9ae0 100644 --- a/src/CommandScheduler/CommandScheduler.csproj +++ b/src/CommandScheduler/CommandScheduler.csproj @@ -15,13 +15,13 @@ - - - - - - - + + + + + + + diff --git a/src/CommandScheduler/CommandsSchedulerServiceCollectionExtensions.cs b/src/CommandScheduler/CommandsSchedulerServiceCollectionExtensions.cs index d51a1ed..6ccd288 100644 --- a/src/CommandScheduler/CommandsSchedulerServiceCollectionExtensions.cs +++ b/src/CommandScheduler/CommandsSchedulerServiceCollectionExtensions.cs @@ -5,17 +5,17 @@ using Microsoft.Extensions.DependencyInjection; using System; using System.Data.SqlClient; +using System.Reflection; namespace CommandScheduler { public static class CommandsSchedulerServiceCollectionExtensions { - public static IServiceCollection AddCommandsScheduler(this IServiceCollection services, string hangfireConnection, params Type[] handlerAssemblyMarkerTypes) + public static IServiceCollection AddCommandsScheduler(this IServiceCollection services, string hangfireConnection, params Assembly[] handlerAssemblies) { services.AddScoped(); services.AddScoped(); - - + // Add Hangfire services. services.AddHangfire(configuration => configuration .SetDataCompatibilityLevel(CompatibilityLevel.Version_170) @@ -33,7 +33,7 @@ public static IServiceCollection AddCommandsScheduler(this IServiceCollection se // Add the processing server as IHostedService services.AddHangfireServer(); - services.AddMediatR(handlerAssemblyMarkerTypes); + services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(handlerAssemblies)); return services; }