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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user