- Add CronSchedule property to CfgProfileDto for scheduling support - Create ProfileSqlJobDto for SQL job execution data transfer - Update TriggeringDEXJobBatchCommand to accept ProfileId and Jobs collection - Make TriggeringDEXJobBatchCommand public for Hangfire job activation - Update Application DependencyInjection with required service registrations
45 lines
1.7 KiB
C#
45 lines
1.7 KiB
C#
using ECMJobRunner.Application.Behaviors;
|
|
using MediatR;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using ReC.Client;
|
|
using System.Reflection;
|
|
|
|
namespace ECMJobRunner.Application
|
|
{
|
|
/// <summary>
|
|
/// Extension methods for configuring Application layer services
|
|
/// </summary>
|
|
public static class DependencyInjection
|
|
{
|
|
/// <summary>
|
|
/// Adds Application layer services to the dependency injection container
|
|
/// Registers MediatR, pipeline behaviors, and AutoMapper
|
|
/// </summary>
|
|
/// <param name="services">The service collection</param>
|
|
/// <returns>The service collection for chaining</returns>
|
|
public static IServiceCollection AddJobRunnerServices(this IServiceCollection services, string recClientApiUrl)
|
|
{
|
|
var assembly = Assembly.GetExecutingAssembly();
|
|
|
|
// Register MediatR with all handlers from this assembly
|
|
#if NET48
|
|
services.AddMediatR(assembly);
|
|
#else
|
|
services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(assembly));
|
|
#endif
|
|
services.AddRecClient(recClientApiUrl, opt =>
|
|
{
|
|
opt.LogSuccessfulRequests = true;
|
|
});
|
|
|
|
// Register pipeline behaviors in execution order
|
|
// Order matters: MainQuery -> CheckQuery -> ReCRequest
|
|
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(MainQueryExecutionBehavior<,>));
|
|
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(CheckQueryExecutionBehavior<,>));
|
|
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ReCRequestExecutionBehavior<,>));
|
|
|
|
return services;
|
|
}
|
|
}
|
|
}
|