feat(infrastructure): implement ISQLExecutor with EF6/EF Core support

- Move ISQLExecutor interface from Application to Domain layer
  - Follow Clean Architecture: Infrastructure references Domain, not Application
  - Namespace: ECMJobRunner.Domain.Interfaces
- Implement SQLExecutor service with conditional compilation
  - EF6 (net480): Database.SqlQuery<T>()
  - EF Core (net8.0): Database.SqlQueryRaw<T>()
- Register ISQLExecutor in DI (AddInfrastructure, AddInfrastructureInMemory)
  - Scoped lifetime (aligns with DbContext)
This commit is contained in:
2026-07-11 16:43:57 +02:00
parent 4767bcfbe1
commit 26ea1db09f
3 changed files with 87 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ using Microsoft.Extensions.DependencyInjection;
using ECMJobRunner.Domain.Interfaces;
using ECMJobRunner.Infrastructure.Data;
using ECMJobRunner.Infrastructure.Repositories;
using ECMJobRunner.Infrastructure.Services;
namespace ECMJobRunner.Infrastructure
{
@@ -43,6 +44,9 @@ namespace ECMJobRunner.Infrastructure
services.AddScoped<IProfileSqlJobRepository, ProfileSqlJobRepository>();
services.AddScoped<IProfileHistoryRepository, ProfileHistoryRepository>();
// Register SQL executor as scoped
services.AddScoped<ISQLExecutor, SQLExecutor>();
return services;
}
@@ -70,6 +74,9 @@ namespace ECMJobRunner.Infrastructure
services.AddScoped<IProfileSqlJobRepository, ProfileSqlJobRepository>();
services.AddScoped<IProfileHistoryRepository, ProfileHistoryRepository>();
// Register SQL executor as scoped
services.AddScoped<ISQLExecutor, SQLExecutor>();
return services;
}
#else
@@ -96,6 +103,9 @@ namespace ECMJobRunner.Infrastructure
services.AddScoped<IProfileSqlJobRepository, ProfileSqlJobRepository>();
services.AddScoped<IProfileHistoryRepository, ProfileHistoryRepository>();
// Register SQL executor as scoped
services.AddScoped<ISQLExecutor, SQLExecutor>();
return services;
}
#endif